LCOV - code coverage report
Current view: top level - connectivity/source/inc - TDatabaseMetaDataBase.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 6 100.0 %
Date: 2012-08-25 Functions: 3 3 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 15 24 62.5 %

           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                 :            : #ifndef _CONNECTIVITY_ODATABASEMETADATABASE_HXX_
      21                 :            : #define _CONNECTIVITY_ODATABASEMETADATABASE_HXX_
      22                 :            : 
      23                 :            : #include <com/sun/star/sdbc/XDatabaseMetaData2.hpp>
      24                 :            : #include <cppuhelper/implbase2.hxx>
      25                 :            : #include <comphelper/broadcasthelper.hxx>
      26                 :            : #include <com/sun/star/lang/XEventListener.hpp>
      27                 :            : #include "FDatabaseMetaDataResultSet.hxx"
      28                 :            : #include <functional>
      29                 :            : #include "connectivity/dbtoolsdllapi.hxx"
      30                 :            : 
      31                 :            : namespace connectivity
      32                 :            : {
      33                 :            :         typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >  TConditions;
      34                 :            :         class OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataBase :
      35                 :            :                                         public  comphelper::OBaseMutex,
      36                 :            :                                         public ::cppu::WeakImplHelper2< ::com::sun::star::sdbc::XDatabaseMetaData2,
      37                 :            :                                                                         ::com::sun::star::lang::XEventListener>
      38                 :            :         {
      39                 :            :         private:
      40                 :            :             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >   m_aConnectionInfo;
      41                 :            :             ::connectivity::ODatabaseMetaDataResultSet::ORows                           m_aTypeInfoRows;
      42                 :            : 
      43                 :            :             // cached database information
      44                 :            :             ::std::pair<bool,sal_Bool>          m_isCatalogAtStart;
      45                 :            :             ::std::pair<bool,::rtl::OUString>   m_sCatalogSeparator;
      46                 :            :             ::std::pair<bool,::rtl::OUString>   m_sIdentifierQuoteString;
      47                 :            :             ::std::pair<bool,sal_Bool>          m_supportsCatalogsInTableDefinitions;
      48                 :            :             ::std::pair<bool,sal_Bool>          m_supportsSchemasInTableDefinitions;
      49                 :            :             ::std::pair<bool,sal_Bool>          m_supportsCatalogsInDataManipulation;
      50                 :            :             ::std::pair<bool,sal_Bool>          m_supportsSchemasInDataManipulation;
      51                 :            :             ::std::pair<bool,sal_Bool>          m_supportsMixedCaseQuotedIdentifiers;
      52                 :            :             ::std::pair<bool,sal_Bool>          m_supportsAlterTableWithAddColumn;
      53                 :            :             ::std::pair<bool,sal_Bool>          m_supportsAlterTableWithDropColumn;
      54                 :            :             ::std::pair<bool,sal_Int32>         m_MaxStatements;
      55                 :            :             ::std::pair<bool,sal_Int32>         m_MaxTablesInSelect;
      56                 :            :             ::std::pair<bool,sal_Bool>          m_storesMixedCaseQuotedIdentifiers;
      57                 :            : 
      58                 :      13662 :             template <typename T> T callImplMethod(::std::pair<bool,T>& _rCache,const ::std::mem_fun_t<T,ODatabaseMetaDataBase>& _pImplMethod)
      59                 :            :             {
      60 [ +  - ][ +  - ]:      13662 :                 ::osl::MutexGuard aGuard( m_aMutex );
                 [ +  - ]
      61 [ +  + ][ +  + ]:      13662 :                 if ( !_rCache.first )
                 [ +  + ]
      62                 :            :                 {
      63 [ +  - ][ +  - ]:        312 :                     _rCache.second = _pImplMethod(this);
                 [ +  - ]
      64                 :        312 :                     _rCache.first = true;
      65                 :            :                 }
      66 [ +  - ][ +  - ]:      13662 :                 return _rCache.second;
                 [ +  - ]
      67                 :            :             }
      68                 :            :         protected:
      69                 :            :             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >     m_xConnection;
      70                 :            :             ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>   m_xListenerHelper; // forward the calls from the connection to me
      71                 :            : 
      72                 :            :             virtual ~ODatabaseMetaDataBase();
      73                 :            : 
      74                 :            :         protected:
      75                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw() = 0;
      76                 :            :             // cached database information
      77                 :            :             virtual ::rtl::OUString impl_getIdentifierQuoteString_throw(  )             = 0;
      78                 :            :             virtual sal_Bool        impl_isCatalogAtStart_throw(  )                     = 0;
      79                 :            :             virtual ::rtl::OUString impl_getCatalogSeparator_throw(  )                  = 0;
      80                 :            :             virtual sal_Bool        impl_supportsCatalogsInTableDefinitions_throw(  )   = 0;
      81                 :            :             virtual sal_Bool        impl_supportsSchemasInTableDefinitions_throw(  )    = 0;
      82                 :            :             virtual sal_Bool        impl_supportsCatalogsInDataManipulation_throw(  )   = 0;
      83                 :            :             virtual sal_Bool        impl_supportsSchemasInDataManipulation_throw(  )    = 0;
      84                 :            :             virtual sal_Bool        impl_supportsMixedCaseQuotedIdentifiers_throw(  )   = 0;
      85                 :            :             virtual sal_Bool        impl_supportsAlterTableWithAddColumn_throw(  )      = 0;
      86                 :            :             virtual sal_Bool        impl_supportsAlterTableWithDropColumn_throw(  )     = 0;
      87                 :            :             virtual sal_Int32       impl_getMaxStatements_throw(  )                     = 0;
      88                 :            :             virtual sal_Int32       impl_getMaxTablesInSelect_throw(  )                 = 0;
      89                 :            :             virtual sal_Bool        impl_storesMixedCaseQuotedIdentifiers_throw(  )     = 0;
      90                 :            : 
      91                 :            : 
      92                 :            :         public:
      93                 :            : 
      94                 :            :             ODatabaseMetaDataBase(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo);
      95                 :            : 
      96                 :            :             // XDatabaseMetaData2
      97                 :            :             virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getConnectionInfo(  ) throw (::com::sun::star::uno::RuntimeException);
      98                 :            : 
      99                 :            :             // XEventListener
     100                 :            :             virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
     101                 :            : 
     102                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTypeInfo(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     103                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     104                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     105                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     106                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     107                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     108                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     109                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     110                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     111                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     112                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     113                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     114                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     115                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     116                 :            : 
     117                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     118                 :            :             // cached database information
     119                 :            :             virtual ::rtl::OUString SAL_CALL getIdentifierQuoteString(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     120                 :            :             virtual sal_Bool SAL_CALL isCatalogAtStart(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     121                 :            :             virtual ::rtl::OUString SAL_CALL getCatalogSeparator(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     122                 :            :             virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     123                 :            :             virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     124                 :            :             virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     125                 :            :             virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     126                 :            :             virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     127                 :            :             virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     128                 :            :             virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     129                 :            :             virtual sal_Int32 SAL_CALL getMaxStatements(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     130                 :            :             virtual sal_Int32 SAL_CALL getMaxTablesInSelect(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     131                 :            :             virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     132                 :            :         };
     133                 :            : }
     134                 :            : #endif // _CONNECTIVITY_ODATABASEMETADATABASE_HXX_
     135                 :            : 
     136                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10