xref: /trunk/main/connectivity/source/inc/odbc/ODatabaseMetaData.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_
25 #define _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_
26 
27 #include "odbc/OConnection.hxx"
28 #include "odbc/odbcbasedllapi.hxx"
29 #include "TDatabaseMetaDataBase.hxx"
30 
31 namespace connectivity
32 {
33     namespace odbc
34     {
35         //**************************************************************
36         //************ Class: ODatabaseMetaData
37         //**************************************************************
38 
39         class OOO_DLLPUBLIC_ODBCBASE ODatabaseMetaData :
40             public ODatabaseMetaDataBase
41         {
42             SQLHANDLE       m_aConnectionHandle;
43             OConnection*    m_pConnection;
44             sal_Bool        m_bUseCatalog;
45             sal_Bool        m_bOdbc3;
46 
47             // cached database information
48             virtual ::rtl::OUString impl_getIdentifierQuoteString_throw(  );
49             virtual sal_Bool        impl_isCatalogAtStart_throw(  );
50             virtual ::rtl::OUString impl_getCatalogSeparator_throw(  );
51             virtual sal_Bool        impl_supportsCatalogsInTableDefinitions_throw(  );
52             virtual sal_Bool        impl_supportsSchemasInTableDefinitions_throw(  ) ;
53             virtual sal_Bool        impl_supportsCatalogsInDataManipulation_throw(  );
54             virtual sal_Bool        impl_supportsSchemasInDataManipulation_throw(  ) ;
55             virtual sal_Bool        impl_supportsMixedCaseQuotedIdentifiers_throw(  ) ;
56             virtual sal_Bool        impl_supportsAlterTableWithAddColumn_throw(  );
57             virtual sal_Bool        impl_supportsAlterTableWithDropColumn_throw(  );
58             virtual sal_Int32       impl_getMaxStatements_throw(  );
59             virtual sal_Int32       impl_getMaxTablesInSelect_throw(  );
60             virtual sal_Bool        impl_storesMixedCaseQuotedIdentifiers_throw(  );
61         protected:
62             ::rtl::OUString getURLImpl();
63             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw();
64             virtual ~ODatabaseMetaData();
65         public:
66 
getOwnConnection() const67             inline OConnection* getOwnConnection() const { return m_pConnection; }
getOdbcFunction(sal_Int32 _nIndex) const68             inline oslGenericFunction getOdbcFunction(sal_Int32 _nIndex)  const
69             {
70                 return m_pConnection->getOdbcFunction(_nIndex);
71             }
72 
73             ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon);
74 
75 
76 
77             // XDatabaseMetaData
78             virtual sal_Bool SAL_CALL allProceduresAreCallable(  );
79             virtual sal_Bool SAL_CALL allTablesAreSelectable(  );
80             virtual ::rtl::OUString SAL_CALL getURL(  );
81             virtual ::rtl::OUString SAL_CALL getUserName(  );
82             virtual sal_Bool SAL_CALL isReadOnly(  );
83             virtual sal_Bool SAL_CALL nullsAreSortedHigh(  );
84             virtual sal_Bool SAL_CALL nullsAreSortedLow(  );
85             virtual sal_Bool SAL_CALL nullsAreSortedAtStart(  );
86             virtual sal_Bool SAL_CALL nullsAreSortedAtEnd(  );
87             virtual ::rtl::OUString SAL_CALL getDatabaseProductName(  );
88             virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion(  );
89             virtual ::rtl::OUString SAL_CALL getDriverName(  );
90             virtual ::rtl::OUString SAL_CALL getDriverVersion(  );
91             virtual sal_Int32 SAL_CALL getDriverMajorVersion(  );
92             virtual sal_Int32 SAL_CALL getDriverMinorVersion(  );
93             virtual sal_Bool SAL_CALL usesLocalFiles(  );
94             virtual sal_Bool SAL_CALL usesLocalFilePerTable(  );
95             virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers(  );
96             virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers(  );
97             virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers(  );
98             virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers(  );
99 
100             virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers(  );
101             virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers(  );
102 
103             virtual ::rtl::OUString SAL_CALL getSQLKeywords(  );
104             virtual ::rtl::OUString SAL_CALL getNumericFunctions(  );
105             virtual ::rtl::OUString SAL_CALL getStringFunctions(  );
106             virtual ::rtl::OUString SAL_CALL getSystemFunctions(  );
107             virtual ::rtl::OUString SAL_CALL getTimeDateFunctions(  );
108             virtual ::rtl::OUString SAL_CALL getSearchStringEscape(  );
109             virtual ::rtl::OUString SAL_CALL getExtraNameCharacters(  );
110             virtual sal_Bool SAL_CALL supportsColumnAliasing(  );
111             virtual sal_Bool SAL_CALL nullPlusNonNullIsNull(  );
112             virtual sal_Bool SAL_CALL supportsTypeConversion(  );
113             virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType );
114             virtual sal_Bool SAL_CALL supportsTableCorrelationNames(  );
115             virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames(  );
116             virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy(  );
117             virtual sal_Bool SAL_CALL supportsOrderByUnrelated(  );
118             virtual sal_Bool SAL_CALL supportsGroupBy(  );
119             virtual sal_Bool SAL_CALL supportsGroupByUnrelated(  );
120             virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect(  );
121             virtual sal_Bool SAL_CALL supportsLikeEscapeClause(  );
122             virtual sal_Bool SAL_CALL supportsMultipleResultSets(  );
123             virtual sal_Bool SAL_CALL supportsMultipleTransactions(  );
124             virtual sal_Bool SAL_CALL supportsNonNullableColumns(  );
125             virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar(  );
126             virtual sal_Bool SAL_CALL supportsCoreSQLGrammar(  );
127             virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar(  );
128             virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL(  );
129             virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL(  );
130             virtual sal_Bool SAL_CALL supportsANSI92FullSQL(  );
131             virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility(  );
132             virtual sal_Bool SAL_CALL supportsOuterJoins(  );
133             virtual sal_Bool SAL_CALL supportsFullOuterJoins(  );
134             virtual sal_Bool SAL_CALL supportsLimitedOuterJoins(  );
135             virtual ::rtl::OUString SAL_CALL getSchemaTerm(  );
136             virtual ::rtl::OUString SAL_CALL getProcedureTerm(  );
137             virtual ::rtl::OUString SAL_CALL getCatalogTerm(  );
138 
139             virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls(  );
140             virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions(  );
141             virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions(  );
142             virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls(  );
143 
144             virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions(  );
145             virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions(  );
146             virtual sal_Bool SAL_CALL supportsPositionedDelete(  );
147             virtual sal_Bool SAL_CALL supportsPositionedUpdate(  );
148             virtual sal_Bool SAL_CALL supportsSelectForUpdate(  );
149             virtual sal_Bool SAL_CALL supportsStoredProcedures(  );
150             virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons(  );
151             virtual sal_Bool SAL_CALL supportsSubqueriesInExists(  );
152             virtual sal_Bool SAL_CALL supportsSubqueriesInIns(  );
153             virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds(  );
154             virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries(  );
155             virtual sal_Bool SAL_CALL supportsUnion(  );
156             virtual sal_Bool SAL_CALL supportsUnionAll(  );
157             virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit(  );
158             virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback(  );
159             virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit(  );
160             virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback(  );
161             virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength(  );
162             virtual sal_Int32 SAL_CALL getMaxCharLiteralLength(  );
163             virtual sal_Int32 SAL_CALL getMaxColumnNameLength(  );
164             virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy(  );
165             virtual sal_Int32 SAL_CALL getMaxColumnsInIndex(  );
166             virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy(  );
167             virtual sal_Int32 SAL_CALL getMaxColumnsInSelect(  );
168             virtual sal_Int32 SAL_CALL getMaxColumnsInTable(  );
169             virtual sal_Int32 SAL_CALL getMaxConnections(  );
170             virtual sal_Int32 SAL_CALL getMaxCursorNameLength(  );
171             virtual sal_Int32 SAL_CALL getMaxIndexLength(  );
172             virtual sal_Int32 SAL_CALL getMaxSchemaNameLength(  );
173             virtual sal_Int32 SAL_CALL getMaxProcedureNameLength(  );
174             virtual sal_Int32 SAL_CALL getMaxCatalogNameLength(  );
175             virtual sal_Int32 SAL_CALL getMaxRowSize(  );
176             virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs(  );
177             virtual sal_Int32 SAL_CALL getMaxStatementLength(  );
178             virtual sal_Int32 SAL_CALL getMaxTableNameLength(  );
179             virtual sal_Int32 SAL_CALL getMaxUserNameLength(  );
180             virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation(  );
181             virtual sal_Bool SAL_CALL supportsTransactions(  );
182             virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level );
183             virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions(  );
184             virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly(  );
185             virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit(  );
186             virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions(  );
187             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 );
188             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 );
189             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types );
190             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas(  );
191             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs(  );
192             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes(  );
193             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern );
194             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 );
195             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 );
196             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 );
197             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 );
198             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 );
199             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 );
200             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 );
201             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 );
202             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 );
203             virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType );
204             virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency );
205             virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType );
206             virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType );
207             virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType );
208             virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType );
209             virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType );
210             virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType );
211             virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType );
212             virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType );
213             virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType );
214             virtual sal_Bool SAL_CALL supportsBatchUpdates(  );
215             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types );
216         };
217     }
218 }
219 #endif // _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_
220