nss: upgrade to release 3.73
[LibreOffice.git] / connectivity / source / inc / TDatabaseMetaDataBase.hxx
bloba13adf215167363dc9676a989375af8c68c5624f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_TDATABASEMETADATABASE_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_TDATABASEMETADATABASE_HXX
23 #include <com/sun/star/sdbc/XDatabaseMetaData2.hpp>
24 #include <cppuhelper/implbase.hxx>
25 #include <cppuhelper/basemutex.hxx>
26 #include <com/sun/star/lang/XEventListener.hpp>
27 #include "FDatabaseMetaDataResultSet.hxx"
28 #include <functional>
29 #include <connectivity/dbtoolsdllapi.hxx>
31 namespace connectivity
33 class OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataBase :
34 public cppu::BaseMutex,
35 public ::cppu::WeakImplHelper< css::sdbc::XDatabaseMetaData2,
36 css::lang::XEventListener>
38 private:
39 css::uno::Sequence< css::beans::PropertyValue > m_aConnectionInfo;
40 ::connectivity::ODatabaseMetaDataResultSet::ORows m_aTypeInfoRows;
42 // cached database information
43 std::pair<bool,bool> m_isCatalogAtStart;
44 std::pair<bool,OUString> m_sCatalogSeparator;
45 std::pair<bool,OUString> m_sIdentifierQuoteString;
46 std::pair<bool,bool> m_supportsCatalogsInTableDefinitions;
47 std::pair<bool,bool> m_supportsSchemasInTableDefinitions;
48 std::pair<bool,bool> m_supportsCatalogsInDataManipulation;
49 std::pair<bool,bool> m_supportsSchemasInDataManipulation;
50 std::pair<bool,bool> m_supportsMixedCaseQuotedIdentifiers;
51 std::pair<bool,bool> m_supportsAlterTableWithAddColumn;
52 std::pair<bool,bool> m_supportsAlterTableWithDropColumn;
53 std::pair<bool,sal_Int32> m_MaxStatements;
54 std::pair<bool,sal_Int32> m_MaxTablesInSelect;
55 std::pair<bool,bool> m_storesMixedCaseQuotedIdentifiers;
57 template <typename T> T callImplMethod(std::pair<bool,T>& _rCache,const std::function<T(ODatabaseMetaDataBase *)>& _pImplMethod)
59 ::osl::MutexGuard aGuard( m_aMutex );
60 if ( !_rCache.first )
62 _rCache.second = _pImplMethod(this);
63 _rCache.first = true;
65 return _rCache.second;
67 protected:
68 css::uno::Reference< css::sdbc::XConnection > m_xConnection;
69 css::uno::Reference< css::lang::XEventListener> m_xListenerHelper; // forward the calls from the connection to me
71 virtual ~ODatabaseMetaDataBase() override;
73 protected:
74 virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() = 0;
75 // cached database information
76 virtual OUString impl_getIdentifierQuoteString_throw( ) = 0;
77 virtual bool impl_isCatalogAtStart_throw( ) = 0;
78 virtual OUString impl_getCatalogSeparator_throw( ) = 0;
79 virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) = 0;
80 virtual bool impl_supportsSchemasInTableDefinitions_throw( ) = 0;
81 virtual bool impl_supportsCatalogsInDataManipulation_throw( ) = 0;
82 virtual bool impl_supportsSchemasInDataManipulation_throw( ) = 0;
83 virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) = 0;
84 virtual bool impl_supportsAlterTableWithAddColumn_throw( ) = 0;
85 virtual bool impl_supportsAlterTableWithDropColumn_throw( ) = 0;
86 virtual sal_Int32 impl_getMaxStatements_throw( ) = 0;
87 virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) = 0;
88 virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) = 0;
91 public:
93 ODatabaseMetaDataBase(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,const css::uno::Sequence< css::beans::PropertyValue >& _rInfo);
95 // XDatabaseMetaData2
96 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getConnectionInfo( ) override;
98 // XEventListener
99 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
101 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTypeInfo( ) override;
102 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override;
103 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override;
104 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override;
105 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override;
106 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override;
107 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override;
108 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope, sal_Bool nullable ) override;
109 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getVersionColumns( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override;
110 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override;
111 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override;
112 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override;
113 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override;
114 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override;
116 virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( ) override;
117 // cached database information
118 virtual OUString SAL_CALL getIdentifierQuoteString( ) override;
119 virtual sal_Bool SAL_CALL isCatalogAtStart( ) override;
120 virtual OUString SAL_CALL getCatalogSeparator( ) override;
121 virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) override;
122 virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) override;
123 virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) override;
124 virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) override;
125 virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) override;
126 virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) override;
127 virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) override;
128 virtual sal_Int32 SAL_CALL getMaxStatements( ) override;
129 virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) override;
130 virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) override;
133 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_TDATABASEMETADATABASE_HXX
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */