LCOV - code coverage report
Current view: top level - connectivity/source/drivers/file - FConnection.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 101 205 49.3 %
Date: 2012-08-25 Functions: 13 36 36.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 108 418 25.8 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include <cppuhelper/typeprovider.hxx>
      21                 :            : #include "file/FConnection.hxx"
      22                 :            : #include "file/FDatabaseMetaData.hxx"
      23                 :            : #include "file/FDriver.hxx"
      24                 :            : #include "file/FStatement.hxx"
      25                 :            : #include "file/FPreparedStatement.hxx"
      26                 :            : #include <com/sun/star/sdbc/ColumnValue.hpp>
      27                 :            : #include <com/sun/star/sdbc/XRow.hpp>
      28                 :            : #include <com/sun/star/lang/DisposedException.hpp>
      29                 :            : #include <com/sun/star/container/XChild.hpp>
      30                 :            : #include <com/sun/star/ucb/XContent.hpp>
      31                 :            : #include <com/sun/star/ucb/XContentIdentifier.hpp>
      32                 :            : #include <tools/urlobj.hxx>
      33                 :            : #include "file/FCatalog.hxx"
      34                 :            : #include <unotools/pathoptions.hxx>
      35                 :            : #include <ucbhelper/content.hxx>
      36                 :            : #include <connectivity/dbcharset.hxx>
      37                 :            : #include <connectivity/dbexception.hxx>
      38                 :            : #include <osl/thread.h>
      39                 :            : #include <osl/nlsupport.h>
      40                 :            : #include "resource/file_res.hrc"
      41                 :            : 
      42                 :            : using namespace connectivity::file;
      43                 :            : using namespace dbtools;
      44                 :            : //------------------------------------------------------------------------------
      45                 :            : using namespace com::sun::star::uno;
      46                 :            : using namespace com::sun::star::lang;
      47                 :            : using namespace com::sun::star::beans;
      48                 :            : using namespace com::sun::star::sdbc;
      49                 :            : using namespace com::sun::star::sdbcx;
      50                 :            : using namespace com::sun::star::container;
      51                 :            : using namespace com::sun::star::ucb;
      52                 :            : using namespace ::ucbhelper;
      53                 :            : using rtl::OUString;
      54                 :            : typedef connectivity::OMetaConnection OConnection_BASE;
      55                 :            : // --------------------------------------------------------------------------------
      56                 :         56 : OConnection::OConnection(OFileDriver*   _pDriver)
      57                 :            :                          : OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this)
      58                 :            :                          ,m_pDriver(_pDriver)
      59                 :            :                          ,m_bClosed(sal_False)
      60                 :            :                          ,m_bShowDeleted(sal_False)
      61                 :            :                          ,m_bCaseSensitiveExtension( sal_True )
      62                 :            :                          ,m_bCheckSQL92(sal_False)
      63 [ +  - ][ +  - ]:         56 :                          ,m_bDefaultTextEncoding(false)
         [ +  - ][ +  - ]
      64                 :            : {
      65                 :         56 :     m_nTextEncoding = RTL_TEXTENCODING_DONTKNOW;
      66                 :         56 : }
      67                 :            : //-----------------------------------------------------------------------------
      68 [ +  - ][ +  - ]:         56 : OConnection::~OConnection()
         [ +  - ][ +  - ]
      69                 :            : {
      70 [ +  - ][ -  + ]:         56 :     if(!isClosed(  ))
      71         [ #  # ]:          0 :         close();
      72         [ -  + ]:         56 : }
      73                 :            : //-----------------------------------------------------------------------------
      74                 :       4528 : void SAL_CALL OConnection::release() throw()
      75                 :            : {
      76                 :       4528 :     relase_ChildImpl();
      77                 :       4528 : }
      78                 :            : 
      79                 :            : //-----------------------------------------------------------------------------
      80                 :        284 : sal_Bool OConnection::matchesExtension( const String& _rExt ) const
      81                 :            : {
      82         [ +  - ]:        284 :     if ( isCaseSensitveExtension() )
      83         [ +  - ]:        284 :         return ( getExtension() == _rExt );
      84                 :            : 
      85         [ #  # ]:          0 :     String sMyExtension( getExtension() );
      86         [ #  # ]:          0 :     sMyExtension.ToLowerAscii();
      87         [ #  # ]:          0 :     String sExt( _rExt );
      88         [ #  # ]:          0 :     sExt.ToLowerAscii();
      89                 :            : 
      90 [ #  # ][ #  # ]:        284 :     return sMyExtension == sExt;
                 [ #  # ]
      91                 :            : }
      92                 :            : 
      93                 :            : //-----------------------------------------------------------------------------
      94                 :         56 : void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info)  throw(SQLException)
      95                 :            : {
      96         [ +  - ]:         56 :     osl_incrementInterlockedCount( &m_refCount );
      97                 :            : 
      98                 :         56 :     ::rtl::OUString aExt;
      99                 :         56 :     const PropertyValue *pIter  = info.getConstArray();
     100                 :         56 :     const PropertyValue *pEnd    = pIter + info.getLength();
     101         [ +  + ]:        228 :     for(;pIter != pEnd;++pIter)
     102                 :            :     {
     103         [ -  + ]:        172 :         if(0 == pIter->Name.compareToAscii("Extension"))
     104                 :          0 :             OSL_VERIFY( pIter->Value >>= aExt );
     105         [ +  + ]:        172 :         else if(0 == pIter->Name.compareToAscii("CharSet"))
     106                 :            :         {
     107                 :         56 :             ::rtl::OUString sIanaName;
     108                 :         56 :             OSL_VERIFY( pIter->Value >>= sIanaName );
     109                 :            : 
     110         [ +  - ]:         56 :             ::dbtools::OCharsetMap aLookupIanaName;
     111         [ +  - ]:         56 :             ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.find(sIanaName, ::dbtools::OCharsetMap::IANA());
     112 [ +  - ][ +  - ]:         56 :             if (aLookup != aLookupIanaName.end())
         [ +  - ][ +  - ]
     113 [ +  - ][ +  - ]:         56 :                 m_nTextEncoding = (*aLookup).getEncoding();
     114                 :            :             else
     115 [ +  - ][ +  - ]:         56 :                 m_nTextEncoding = RTL_TEXTENCODING_DONTKNOW;
     116                 :            :         }
     117         [ +  + ]:        116 :         else if (0 == pIter->Name.compareToAscii("ShowDeleted"))
     118                 :            :         {
     119                 :         56 :             OSL_VERIFY( pIter->Value >>= m_bShowDeleted );
     120                 :            :         }
     121         [ +  + ]:         60 :         else if (0 == pIter->Name.compareToAscii("EnableSQL92Check"))
     122                 :            :         {
     123                 :         56 :             pIter->Value >>= m_bCheckSQL92;
     124                 :            :         }
     125                 :            :     } // for(;pIter != pEnd;++pIter)
     126                 :            : 
     127                 :            :     {
     128                 :         56 :         sal_Int32 nLen = url.indexOf(':');
     129                 :         56 :         nLen = url.indexOf(':',nLen+1);
     130                 :         56 :         ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD;
     131                 :            : 
     132         [ +  - ]:         56 :         String aFileName = aDSN;
     133         [ +  - ]:         56 :         INetURLObject aURL;
     134                 :         56 :         aURL.SetSmartProtocol(INET_PROT_FILE);
     135                 :            :         {
     136         [ +  - ]:         56 :             SvtPathOptions aPathOptions;
     137 [ +  - ][ +  - ]:         56 :             aFileName = aPathOptions.SubstituteVariable(aFileName);
         [ +  - ][ +  - ]
     138                 :            :         }
     139                 :            : 
     140 [ +  - ][ +  - ]:         56 :         aURL.SetSmartURL(aFileName);
     141                 :            : 
     142 [ +  - ][ +  - ]:         56 :         setURL(aURL.GetMainURL(INetURLObject::NO_DECODE));
                 [ +  - ]
     143                 :            :     }
     144                 :            : 
     145         [ +  + ]:         56 :     if ( m_nTextEncoding == RTL_TEXTENCODING_DONTKNOW )
     146                 :            :     {
     147                 :            :         //m_nTextEncoding = osl_getTextEncodingFromLocale(NULL);
     148         [ +  - ]:         44 :         m_nTextEncoding = osl_getThreadTextEncoding();
     149                 :         44 :         m_bDefaultTextEncoding = true;
     150                 :            :     }
     151                 :            : 
     152         [ -  + ]:         56 :     if ( !aExt.isEmpty() )
     153         [ #  # ]:          0 :         m_aFilenameExtension = aExt;
     154                 :            : 
     155                 :            :     try
     156                 :            :     {
     157         [ +  - ]:         56 :         ::ucbhelper::Content aFile;
     158                 :            :         try
     159                 :            :         {
     160 [ +  - ][ +  - ]:         56 :             aFile = ::ucbhelper::Content(getURL(),Reference< XCommandEnvironment >());
                 [ +  - ]
     161                 :            :         }
     162   [ #  #  #  # ]:          0 :         catch(ContentCreationException& e)
     163                 :            :         {
     164         [ #  # ]:          0 :             throwUrlNotValid(getURL(),e.Message);
     165                 :            :         }
     166                 :            : 
     167                 :            :         // set fields to fetch
     168         [ +  - ]:         56 :         Sequence< OUString > aProps(1);
     169         [ +  - ]:         56 :         OUString* pProps = aProps.getArray();
     170                 :         56 :         pProps[ 0 ] = OUString("Title");
     171                 :            : 
     172                 :            :         try
     173                 :            :         {
     174 [ +  - ][ +  - ]:         56 :             if (aFile.isFolder())
     175                 :            :             {
     176 [ +  - ][ +  - ]:         56 :                 m_xDir = aFile.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
     177 [ +  - ][ +  - ]:         56 :                 m_xContent = aFile.get();
     178                 :            :             }
     179 [ #  # ][ #  # ]:          0 :             else if (aFile.isDocument())
     180                 :            :             {
     181 [ #  # ][ #  # ]:          0 :                 Reference<XContent> xParent(Reference<XChild>(aFile.get(),UNO_QUERY)->getParent(),UNO_QUERY);
         [ #  # ][ #  # ]
                 [ #  # ]
     182 [ #  # ][ #  # ]:          0 :                 Reference<XContentIdentifier> xIdent = xParent->getIdentifier();
     183         [ #  # ]:          0 :                 m_xContent = xParent;
     184                 :            : 
     185 [ #  # ][ #  # ]:          0 :                 ::ucbhelper::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >());
                 [ #  # ]
     186 [ #  # ][ #  # ]:          0 :                 m_xDir = aParent.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
                 [ #  # ]
     187                 :            :             }
     188                 :            :             else
     189                 :            :             {
     190                 :            :                 OSL_FAIL("OConnection::construct: ::ucbhelper::Content isn't a folde nor a document! How that?!");
     191         [ #  # ]:          0 :                 throw SQLException();
     192                 :            :             }
     193                 :            :         }
     194   [ #  #  #  # ]:          0 :         catch(Exception& e) // a execption is thrown when no file exists
     195                 :            :         {
     196         [ #  # ]:          0 :             throwUrlNotValid(getURL(),e.Message);
     197                 :            :         }
     198 [ +  - ][ -  + ]:         56 :         if(!m_xDir.is() || !m_xContent.is())
                 [ -  + ]
     199         [ #  # ]:          0 :             throwUrlNotValid(getURL(),::rtl::OUString());
     200                 :            : 
     201 [ +  - ][ +  - ]:         56 :         if (m_aFilenameExtension.Search('*') != STRING_NOTFOUND || m_aFilenameExtension.Search('?') != STRING_NOTFOUND)
         [ +  - ][ -  + ]
                 [ -  + ]
     202 [ #  # ][ +  - ]:         56 :             throw SQLException();
                 [ +  - ]
     203                 :            :     }
     204         [ #  # ]:          0 :     catch(const Exception&)
     205                 :            :     {
     206         [ #  # ]:          0 :         osl_decrementInterlockedCount( &m_refCount );
     207                 :          0 :         throw;
     208                 :            :     }
     209                 :            : 
     210         [ +  - ]:         56 :     osl_decrementInterlockedCount( &m_refCount );
     211                 :         56 : }
     212                 :            : // XServiceInfo
     213                 :            : // --------------------------------------------------------------------------------
     214 [ #  # ][ #  # ]:          0 : IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.file.Connection", "com.sun.star.sdbc.Connection")
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     215                 :            : 
     216                 :            : // --------------------------------------------------------------------------------
     217                 :          0 : Reference< XStatement > SAL_CALL OConnection::createStatement(  ) throw(SQLException, RuntimeException)
     218                 :            : {
     219         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     220         [ #  # ]:          0 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
     221                 :            : 
     222                 :            : 
     223 [ #  # ][ #  # ]:          0 :     Reference< XStatement > xReturn = new OStatement(this);
                 [ #  # ]
     224 [ #  # ][ #  # ]:          0 :     m_aStatements.push_back(WeakReferenceHelper(xReturn));
                 [ #  # ]
     225         [ #  # ]:          0 :     return xReturn;
     226                 :            : }
     227                 :            : // --------------------------------------------------------------------------------
     228                 :          0 : Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
     229                 :            : {
     230         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     231         [ #  # ]:          0 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
     232                 :            : 
     233                 :            : 
     234         [ #  # ]:          0 :     OPreparedStatement* pStmt = new OPreparedStatement(this);
     235 [ #  # ][ #  # ]:          0 :     Reference< XPreparedStatement > xHoldAlive = pStmt;
     236         [ #  # ]:          0 :     pStmt->construct(sql);
     237 [ #  # ][ #  # ]:          0 :     m_aStatements.push_back(WeakReferenceHelper(*pStmt));
         [ #  # ][ #  # ]
     238 [ #  # ][ #  # ]:          0 :     return pStmt;
                 [ #  # ]
     239                 :            : }
     240                 :            : // --------------------------------------------------------------------------------
     241                 :          0 : Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
     242                 :            : {
     243         [ #  # ]:          0 :     throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
     244                 :          0 :     return NULL;
     245                 :            : }
     246                 :            : // --------------------------------------------------------------------------------
     247                 :          0 : ::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
     248                 :            : {
     249                 :          0 :     return sql;
     250                 :            : }
     251                 :            : // --------------------------------------------------------------------------------
     252                 :          0 : void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException)
     253                 :            : {
     254         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     255         [ #  # ]:          0 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
     256                 :            : 
     257         [ #  # ]:          0 :     m_bAutoCommit = autoCommit;
     258                 :          0 : }
     259                 :            : // --------------------------------------------------------------------------------
     260                 :          0 : sal_Bool SAL_CALL OConnection::getAutoCommit(  ) throw(SQLException, RuntimeException)
     261                 :            : {
     262         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     263         [ #  # ]:          0 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
     264                 :            : 
     265         [ #  # ]:          0 :     return m_bAutoCommit;
     266                 :            : }
     267                 :            : // --------------------------------------------------------------------------------
     268                 :          0 : void SAL_CALL OConnection::commit(  ) throw(SQLException, RuntimeException)
     269                 :            : {
     270                 :          0 : }
     271                 :            : // --------------------------------------------------------------------------------
     272                 :          0 : void SAL_CALL OConnection::rollback(  ) throw(SQLException, RuntimeException)
     273                 :            : {
     274                 :          0 : }
     275                 :            : // --------------------------------------------------------------------------------
     276                 :         56 : sal_Bool SAL_CALL OConnection::isClosed(  ) throw(SQLException, RuntimeException)
     277                 :            : {
     278         [ +  - ]:         56 :     ::osl::MutexGuard aGuard( m_aMutex );
     279                 :            : 
     280         [ +  - ]:         56 :     return OConnection_BASE::rBHelper.bDisposed;
     281                 :            : }
     282                 :            : // --------------------------------------------------------------------------------
     283                 :          0 : Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData(  ) throw(SQLException, RuntimeException)
     284                 :            : {
     285         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     286         [ #  # ]:          0 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
     287                 :            : 
     288                 :            : 
     289         [ #  # ]:          0 :     Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
     290         [ #  # ]:          0 :     if(!xMetaData.is())
     291                 :            :     {
     292 [ #  # ][ #  # ]:          0 :         xMetaData = new ODatabaseMetaData(this);
                 [ #  # ]
     293         [ #  # ]:          0 :         m_xMetaData = xMetaData;
     294                 :            :     }
     295                 :            : 
     296         [ #  # ]:          0 :     return xMetaData;
     297                 :            : }
     298                 :            : // --------------------------------------------------------------------------------
     299                 :          0 : void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException)
     300                 :            : {
     301         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     302         [ #  # ]:          0 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
     303                 :            : 
     304                 :            : 
     305         [ #  # ]:          0 :     m_bReadOnly = readOnly;
     306                 :          0 : }
     307                 :            : // --------------------------------------------------------------------------------
     308                 :          0 : sal_Bool SAL_CALL OConnection::isReadOnly(  ) throw(SQLException, RuntimeException)
     309                 :            : {
     310         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     311         [ #  # ]:          0 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
     312                 :            : 
     313                 :            : 
     314         [ #  # ]:          0 :     return m_bReadOnly;
     315                 :            : }
     316                 :            : // --------------------------------------------------------------------------------
     317                 :          0 : void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& /*catalog*/ ) throw(SQLException, RuntimeException)
     318                 :            : {
     319         [ #  # ]:          0 :     throwFeatureNotImplementedException( "XConnection::setCatalog", *this );
     320                 :          0 : }
     321                 :            : // --------------------------------------------------------------------------------
     322                 :          0 : ::rtl::OUString SAL_CALL OConnection::getCatalog(  ) throw(SQLException, RuntimeException)
     323                 :            : {
     324                 :          0 :     return ::rtl::OUString();
     325                 :            : }
     326                 :            : // --------------------------------------------------------------------------------
     327                 :          0 : void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException)
     328                 :            : {
     329         [ #  # ]:          0 :     throwFeatureNotImplementedException( "XConnection::setTransactionIsolation", *this );
     330                 :          0 : }
     331                 :            : // --------------------------------------------------------------------------------
     332                 :          0 : sal_Int32 SAL_CALL OConnection::getTransactionIsolation(  ) throw(SQLException, RuntimeException)
     333                 :            : {
     334                 :          0 :     return 0;
     335                 :            : }
     336                 :            : // --------------------------------------------------------------------------------
     337                 :          0 : Reference< XNameAccess > SAL_CALL OConnection::getTypeMap(  ) throw(SQLException, RuntimeException)
     338                 :            : {
     339                 :          0 :     return NULL;
     340                 :            : }
     341                 :            : // --------------------------------------------------------------------------------
     342                 :          0 : void SAL_CALL OConnection::setTypeMap( const Reference< XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
     343                 :            : {
     344                 :          0 : }
     345                 :            : // --------------------------------------------------------------------------------
     346                 :            : // XCloseable
     347                 :         56 : void SAL_CALL OConnection::close(  ) throw(SQLException, RuntimeException)
     348                 :            : {
     349                 :            :     {
     350         [ +  - ]:         56 :         ::osl::MutexGuard aGuard( m_aMutex );
     351 [ +  - ][ +  - ]:         56 :         checkDisposed(OConnection_BASE::rBHelper.bDisposed);
     352                 :            : 
     353                 :            :     }
     354                 :         56 :     dispose();
     355                 :         56 : }
     356                 :            : // --------------------------------------------------------------------------------
     357                 :            : // XWarningsSupplier
     358                 :          4 : Any SAL_CALL OConnection::getWarnings(  ) throw(SQLException, RuntimeException)
     359                 :            : {
     360                 :          4 :     return Any();
     361                 :            : }
     362                 :            : // --------------------------------------------------------------------------------
     363                 :          4 : void SAL_CALL OConnection::clearWarnings(  ) throw(SQLException, RuntimeException)
     364                 :            : {
     365                 :          4 : }
     366                 :            : //------------------------------------------------------------------------------
     367                 :         56 : void OConnection::disposing()
     368                 :            : {
     369         [ +  - ]:         56 :     ::osl::MutexGuard aGuard(m_aMutex);
     370         [ +  - ]:         56 :     OConnection_BASE::disposing();
     371                 :            : 
     372                 :         56 :     m_bClosed   = sal_True;
     373                 :         56 : m_xDir.clear();
     374                 :         56 : m_xContent.clear();
     375 [ +  - ][ +  - ]:         56 :     m_xCatalog  = WeakReference< XTablesSupplier>();
                 [ +  - ]
     376                 :            : 
     377 [ +  - ][ +  - ]:         56 :     dispose_ChildImpl();
     378                 :         56 : }
     379                 :            : //------------------------------------------------------------------------------
     380                 :          0 : Reference< XTablesSupplier > OConnection::createCatalog()
     381                 :            : {
     382         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     383         [ #  # ]:          0 :     Reference< XTablesSupplier > xTab = m_xCatalog;
     384         [ #  # ]:          0 :     if(!xTab.is())
     385                 :            :     {
     386 [ #  # ][ #  # ]:          0 :         xTab = new OFileCatalog(this);
                 [ #  # ]
     387         [ #  # ]:          0 :         m_xCatalog = xTab;
     388                 :            :     }
     389         [ #  # ]:          0 :     return xTab;
     390                 :            : }
     391                 :            : // -----------------------------------------------------------------------------
     392                 :        194 : Reference< XDynamicResultSet > OConnection::getDir() const
     393                 :            : {
     394                 :        194 :     Reference<XDynamicResultSet> xContent;
     395         [ +  - ]:        194 :     Sequence< ::rtl::OUString > aProps(1);
     396         [ +  - ]:        194 :     ::rtl::OUString* pProps = aProps.getArray();
     397                 :        194 :     pProps[ 0 ] = ::rtl::OUString("Title");
     398                 :            :     try
     399                 :            :     {
     400 [ +  - ][ +  - ]:        194 :         Reference<XContentIdentifier> xIdent = getContent()->getIdentifier();
                 [ +  - ]
     401 [ +  - ][ +  - ]:        194 :         ::ucbhelper::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >());
                 [ +  - ]
     402 [ +  - ][ +  - ]:        194 :         xContent = aParent.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
         [ #  # ][ +  - ]
     403                 :            :     }
     404         [ #  # ]:          0 :     catch(Exception&)
     405                 :            :     {
     406                 :            :     }
     407         [ +  - ]:        194 :     return xContent;
     408                 :            : }
     409                 :            : // -----------------------------------------------------------------------------
     410                 :         56 : sal_Int64 SAL_CALL OConnection::getSomething( const Sequence< sal_Int8 >& rId ) throw (RuntimeException)
     411                 :            : {
     412 [ +  - ][ +  - ]:        168 :     return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
                 [ #  # ]
     413                 :            :         ? reinterpret_cast< sal_Int64 >( this )
     414   [ +  -  +  - ]:        168 :         : (sal_Int64)0;
     415                 :            : }
     416                 :            : // -----------------------------------------------------------------------------
     417                 :        112 : Sequence< sal_Int8 > OConnection::getUnoTunnelImplementationId()
     418                 :            : {
     419                 :            :     static ::cppu::OImplementationId * pId = 0;
     420         [ +  + ]:        112 :     if (! pId)
     421                 :            :     {
     422 [ +  - ][ +  - ]:          9 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     423         [ +  - ]:          9 :         if (! pId)
     424                 :            :         {
     425 [ +  - ][ +  - ]:          9 :             static ::cppu::OImplementationId aId;
     426                 :          9 :             pId = &aId;
     427         [ +  - ]:          9 :         }
     428                 :            :     }
     429                 :        112 :     return pId->getImplementationId();
     430                 :            : }
     431                 :            : // -----------------------------------------------------------------------------
     432                 :          0 : void OConnection::throwUrlNotValid(const ::rtl::OUString & _rsUrl,const ::rtl::OUString & _rsMessage)
     433                 :            : {
     434         [ #  # ]:          0 :     SQLException aError;
     435                 :          0 :     aError.Message = getResources().getResourceStringWithSubstitution(
     436                 :            :                 STR_NO_VALID_FILE_URL,
     437                 :            :                 "$URL$", _rsUrl
     438         [ #  # ]:          0 :             );
     439                 :            : 
     440                 :          0 :     aError.SQLState = ::rtl::OUString("S1000");
     441                 :          0 :     aError.ErrorCode = 0;
     442         [ #  # ]:          0 :     aError.Context = static_cast< XConnection* >(this);
     443         [ #  # ]:          0 :     if (!_rsMessage.isEmpty())
     444 [ #  # ][ #  # ]:          0 :         aError.NextException <<= SQLException(_rsMessage, aError.Context, ::rtl::OUString(), 0, Any());
                 [ #  # ]
     445                 :            : 
     446         [ #  # ]:          0 :     throw aError;
     447                 :            : }
     448                 :            : // -----------------------------------------------------------------------------
     449                 :            : 
     450                 :            : 
     451                 :            : 
     452                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10