1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * Effective License of whole file:
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1, as published by the Free Software Foundation.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
25 * Copyright: 2000 by Sun Microsystems, Inc.
27 * Contributor(s): Joerg Budischewski
29 * All parts contributed on or after August 2011:
31 * This Source Code Form is subject to the terms of the Mozilla Public
32 * License, v. 2.0. If a copy of the MPL was not distributed with this
33 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
35 ************************************************************************/
39 #include "pq_connection.hxx"
40 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
42 #include <cppuhelper/implbase.hxx>
44 namespace pq_sdbc_driver
47 class DatabaseMetaData
:
48 public ::cppu::WeakImplHelper
< css::sdbc::XDatabaseMetaData
>
50 ::rtl::Reference
< comphelper::RefCountedMutex
> m_xMutex
;
51 ConnectionSettings
*m_pSettings
;
52 css::uno::Reference
< css::sdbc::XConnection
> m_origin
;
53 css::uno::Reference
< css::sdbc::XPreparedStatement
> m_getIntSetting_stmt
;
54 css::uno::Reference
< css::sdbc::XPreparedStatement
> m_getReferences_stmt
[16];
55 css::uno::Reference
< css::sdbc::XPreparedStatement
> m_getTablePrivs_stmt
;
56 css::uno::Reference
< css::sdbc::XPreparedStatement
> m_getColumnPrivs_stmt
;
58 /// @throws css::sdbc::SQLException
59 /// @throws css::uno::RuntimeException
60 sal_Int32
getIntSetting(const OUString
& settingName
);
61 /// @throws css::sdbc::SQLException
62 /// @throws css::uno::RuntimeException
63 sal_Int32
getMaxIndexKeys();
64 /// @throws css::sdbc::SQLException
65 /// @throws css::uno::RuntimeException
66 sal_Int32
getMaxNameLength();
67 /// @throws css::sdbc::SQLException
68 /// @throws css::uno::RuntimeException
69 css::uno::Reference
< css::sdbc::XResultSet
> getImportedExportedKeys(
70 const css::uno::Any
& primaryCatalog
, const OUString
& primarySchema
, const OUString
& primaryTable
,
71 const css::uno::Any
& foreignCatalog
, const OUString
& foreignSchema
, const OUString
& foreignTable
);
72 void init_getReferences_stmt ();
73 void init_getPrivs_stmt ();
77 ::rtl::Reference
< comphelper::RefCountedMutex
> reMutex
,
78 css::uno::Reference
< css::sdbc::XConnection
> origin
,
79 ConnectionSettings
*pSettings
84 virtual sal_Bool SAL_CALL
allProceduresAreCallable( ) override
;
85 virtual sal_Bool SAL_CALL
allTablesAreSelectable( ) override
;
86 virtual OUString SAL_CALL
getURL( ) override
;
87 virtual OUString SAL_CALL
getUserName( ) override
;
88 virtual sal_Bool SAL_CALL
isReadOnly( ) override
;
89 virtual sal_Bool SAL_CALL
nullsAreSortedHigh( ) override
;
90 virtual sal_Bool SAL_CALL
nullsAreSortedLow( ) override
;
91 virtual sal_Bool SAL_CALL
nullsAreSortedAtStart( ) override
;
92 virtual sal_Bool SAL_CALL
nullsAreSortedAtEnd( ) override
;
93 virtual OUString SAL_CALL
getDatabaseProductName( ) override
;
94 virtual OUString SAL_CALL
getDatabaseProductVersion( ) override
;
95 virtual OUString SAL_CALL
getDriverName( ) override
;
96 virtual OUString SAL_CALL
getDriverVersion( ) override
;
97 virtual sal_Int32 SAL_CALL
getDriverMajorVersion( ) override
;
98 virtual sal_Int32 SAL_CALL
getDriverMinorVersion( ) override
;
99 virtual sal_Bool SAL_CALL
usesLocalFiles( ) override
;
100 virtual sal_Bool SAL_CALL
usesLocalFilePerTable( ) override
;
101 virtual sal_Bool SAL_CALL
supportsMixedCaseIdentifiers( ) override
;
102 virtual sal_Bool SAL_CALL
storesUpperCaseIdentifiers( ) override
;
103 virtual sal_Bool SAL_CALL
storesLowerCaseIdentifiers( ) override
;
104 virtual sal_Bool SAL_CALL
storesMixedCaseIdentifiers( ) override
;
105 virtual sal_Bool SAL_CALL
supportsMixedCaseQuotedIdentifiers( ) override
;
106 virtual sal_Bool SAL_CALL
storesUpperCaseQuotedIdentifiers( ) override
;
107 virtual sal_Bool SAL_CALL
storesLowerCaseQuotedIdentifiers( ) override
;
108 virtual sal_Bool SAL_CALL
storesMixedCaseQuotedIdentifiers( ) override
;
109 virtual OUString SAL_CALL
getIdentifierQuoteString( ) override
;
110 virtual OUString SAL_CALL
getSQLKeywords( ) override
;
111 virtual OUString SAL_CALL
getNumericFunctions( ) override
;
112 virtual OUString SAL_CALL
getStringFunctions( ) override
;
113 virtual OUString SAL_CALL
getSystemFunctions( ) override
;
114 virtual OUString SAL_CALL
getTimeDateFunctions( ) override
;
115 virtual OUString SAL_CALL
getSearchStringEscape( ) override
;
116 virtual OUString SAL_CALL
getExtraNameCharacters( ) override
;
117 virtual sal_Bool SAL_CALL
supportsAlterTableWithAddColumn( ) override
;
118 virtual sal_Bool SAL_CALL
supportsAlterTableWithDropColumn( ) override
;
119 virtual sal_Bool SAL_CALL
supportsColumnAliasing( ) override
;
120 virtual sal_Bool SAL_CALL
nullPlusNonNullIsNull( ) override
;
121 virtual sal_Bool SAL_CALL
supportsTypeConversion( ) override
;
122 virtual sal_Bool SAL_CALL
supportsConvert( sal_Int32 fromType
, sal_Int32 toType
) override
;
123 virtual sal_Bool SAL_CALL
supportsTableCorrelationNames( ) override
;
124 virtual sal_Bool SAL_CALL
supportsDifferentTableCorrelationNames( ) override
;
125 virtual sal_Bool SAL_CALL
supportsExpressionsInOrderBy( ) override
;
126 virtual sal_Bool SAL_CALL
supportsOrderByUnrelated( ) override
;
127 virtual sal_Bool SAL_CALL
supportsGroupBy( ) override
;
128 virtual sal_Bool SAL_CALL
supportsGroupByUnrelated( ) override
;
129 virtual sal_Bool SAL_CALL
supportsGroupByBeyondSelect( ) override
;
130 virtual sal_Bool SAL_CALL
supportsLikeEscapeClause( ) override
;
131 virtual sal_Bool SAL_CALL
supportsMultipleResultSets( ) override
;
132 virtual sal_Bool SAL_CALL
supportsMultipleTransactions( ) override
;
133 virtual sal_Bool SAL_CALL
supportsNonNullableColumns( ) override
;
134 virtual sal_Bool SAL_CALL
supportsMinimumSQLGrammar( ) override
;
135 virtual sal_Bool SAL_CALL
supportsCoreSQLGrammar( ) override
;
136 virtual sal_Bool SAL_CALL
supportsExtendedSQLGrammar( ) override
;
137 virtual sal_Bool SAL_CALL
supportsANSI92EntryLevelSQL( ) override
;
138 virtual sal_Bool SAL_CALL
supportsANSI92IntermediateSQL( ) override
;
139 virtual sal_Bool SAL_CALL
supportsANSI92FullSQL( ) override
;
140 virtual sal_Bool SAL_CALL
supportsIntegrityEnhancementFacility( ) override
;
141 virtual sal_Bool SAL_CALL
supportsOuterJoins( ) override
;
142 virtual sal_Bool SAL_CALL
supportsFullOuterJoins( ) override
;
143 virtual sal_Bool SAL_CALL
supportsLimitedOuterJoins( ) override
;
144 virtual OUString SAL_CALL
getSchemaTerm( ) override
;
145 virtual OUString SAL_CALL
getProcedureTerm( ) override
;
146 virtual OUString SAL_CALL
getCatalogTerm( ) override
;
147 virtual sal_Bool SAL_CALL
isCatalogAtStart( ) override
;
148 virtual OUString SAL_CALL
getCatalogSeparator( ) override
;
149 virtual sal_Bool SAL_CALL
supportsSchemasInDataManipulation( ) override
;
150 virtual sal_Bool SAL_CALL
supportsSchemasInProcedureCalls( ) override
;
151 virtual sal_Bool SAL_CALL
supportsSchemasInTableDefinitions( ) override
;
152 virtual sal_Bool SAL_CALL
supportsSchemasInIndexDefinitions( ) override
;
153 virtual sal_Bool SAL_CALL
supportsSchemasInPrivilegeDefinitions( ) override
;
154 virtual sal_Bool SAL_CALL
supportsCatalogsInDataManipulation( ) override
;
155 virtual sal_Bool SAL_CALL
supportsCatalogsInProcedureCalls( ) override
;
156 virtual sal_Bool SAL_CALL
supportsCatalogsInTableDefinitions( ) override
;
157 virtual sal_Bool SAL_CALL
supportsCatalogsInIndexDefinitions( ) override
;
158 virtual sal_Bool SAL_CALL
supportsCatalogsInPrivilegeDefinitions( ) override
;
159 virtual sal_Bool SAL_CALL
supportsPositionedDelete( ) override
;
160 virtual sal_Bool SAL_CALL
supportsPositionedUpdate( ) override
;
161 virtual sal_Bool SAL_CALL
supportsSelectForUpdate( ) override
;
162 virtual sal_Bool SAL_CALL
supportsStoredProcedures( ) override
;
163 virtual sal_Bool SAL_CALL
supportsSubqueriesInComparisons( ) override
;
164 virtual sal_Bool SAL_CALL
supportsSubqueriesInExists( ) override
;
165 virtual sal_Bool SAL_CALL
supportsSubqueriesInIns( ) override
;
166 virtual sal_Bool SAL_CALL
supportsSubqueriesInQuantifieds( ) override
;
167 virtual sal_Bool SAL_CALL
supportsCorrelatedSubqueries( ) override
;
168 virtual sal_Bool SAL_CALL
supportsUnion( ) override
;
169 virtual sal_Bool SAL_CALL
supportsUnionAll( ) override
;
170 virtual sal_Bool SAL_CALL
supportsOpenCursorsAcrossCommit( ) override
;
171 virtual sal_Bool SAL_CALL
supportsOpenCursorsAcrossRollback( ) override
;
172 virtual sal_Bool SAL_CALL
supportsOpenStatementsAcrossCommit( ) override
;
173 virtual sal_Bool SAL_CALL
supportsOpenStatementsAcrossRollback( ) override
;
174 virtual sal_Int32 SAL_CALL
getMaxBinaryLiteralLength( ) override
;
175 virtual sal_Int32 SAL_CALL
getMaxCharLiteralLength( ) override
;
176 virtual sal_Int32 SAL_CALL
getMaxColumnNameLength( ) override
;
177 virtual sal_Int32 SAL_CALL
getMaxColumnsInGroupBy( ) override
;
178 virtual sal_Int32 SAL_CALL
getMaxColumnsInIndex( ) override
;
179 virtual sal_Int32 SAL_CALL
getMaxColumnsInOrderBy( ) override
;
180 virtual sal_Int32 SAL_CALL
getMaxColumnsInSelect( ) override
;
181 virtual sal_Int32 SAL_CALL
getMaxColumnsInTable( ) override
;
182 virtual sal_Int32 SAL_CALL
getMaxConnections( ) override
;
183 virtual sal_Int32 SAL_CALL
getMaxCursorNameLength( ) override
;
184 virtual sal_Int32 SAL_CALL
getMaxIndexLength( ) override
;
185 virtual sal_Int32 SAL_CALL
getMaxSchemaNameLength( ) override
;
186 virtual sal_Int32 SAL_CALL
getMaxProcedureNameLength( ) override
;
187 virtual sal_Int32 SAL_CALL
getMaxCatalogNameLength( ) override
;
188 virtual sal_Int32 SAL_CALL
getMaxRowSize( ) override
;
189 virtual sal_Bool SAL_CALL
doesMaxRowSizeIncludeBlobs( ) override
;
190 virtual sal_Int32 SAL_CALL
getMaxStatementLength( ) override
;
191 virtual sal_Int32 SAL_CALL
getMaxStatements( ) override
;
192 virtual sal_Int32 SAL_CALL
getMaxTableNameLength( ) override
;
193 virtual sal_Int32 SAL_CALL
getMaxTablesInSelect( ) override
;
194 virtual sal_Int32 SAL_CALL
getMaxUserNameLength( ) override
;
195 virtual sal_Int32 SAL_CALL
getDefaultTransactionIsolation( ) override
;
196 virtual sal_Bool SAL_CALL
supportsTransactions( ) override
;
197 virtual sal_Bool SAL_CALL
supportsTransactionIsolationLevel( sal_Int32 level
) override
;
198 virtual sal_Bool SAL_CALL
supportsDataDefinitionAndDataManipulationTransactions( ) override
;
199 virtual sal_Bool SAL_CALL
supportsDataManipulationTransactionsOnly( ) override
;
200 virtual sal_Bool SAL_CALL
dataDefinitionCausesTransactionCommit( ) override
;
201 virtual sal_Bool SAL_CALL
dataDefinitionIgnoredInTransactions( ) override
;
202 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getProcedures( const css::uno::Any
& catalog
, const OUString
& schemaPattern
, const OUString
& procedureNamePattern
) override
;
203 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
;
204 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getTables( const css::uno::Any
& catalog
, const OUString
& schemaPattern
, const OUString
& tableNamePattern
, const css::uno::Sequence
< OUString
>& types
) override
;
205 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getSchemas( ) override
;
206 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getCatalogs( ) override
;
207 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getTableTypes( ) override
;
208 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getColumns( const css::uno::Any
& catalog
, const OUString
& schemaPattern
, const OUString
& tableNamePattern
, const OUString
& columnNamePattern
) override
;
209 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
;
210 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getTablePrivileges( const css::uno::Any
& catalog
, const OUString
& schemaPattern
, const OUString
& tableNamePattern
) override
;
211 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
;
212 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getVersionColumns( const css::uno::Any
& catalog
, const OUString
& schema
, const OUString
& table
) override
;
213 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getPrimaryKeys( const css::uno::Any
& catalog
, const OUString
& schema
, const OUString
& table
) override
;
214 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getImportedKeys( const css::uno::Any
& catalog
, const OUString
& schema
, const OUString
& table
) override
;
215 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getExportedKeys( const css::uno::Any
& catalog
, const OUString
& schema
, const OUString
& table
) override
;
216 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
;
217 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getTypeInfo( ) override
;
218 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
;
219 virtual sal_Bool SAL_CALL
supportsResultSetType( sal_Int32 setType
) override
;
220 virtual sal_Bool SAL_CALL
supportsResultSetConcurrency( sal_Int32 setType
, sal_Int32 concurrency
) override
;
221 virtual sal_Bool SAL_CALL
ownUpdatesAreVisible( sal_Int32 setType
) override
;
222 virtual sal_Bool SAL_CALL
ownDeletesAreVisible( sal_Int32 setType
) override
;
223 virtual sal_Bool SAL_CALL
ownInsertsAreVisible( sal_Int32 setType
) override
;
224 virtual sal_Bool SAL_CALL
othersUpdatesAreVisible( sal_Int32 setType
) override
;
225 virtual sal_Bool SAL_CALL
othersDeletesAreVisible( sal_Int32 setType
) override
;
226 virtual sal_Bool SAL_CALL
othersInsertsAreVisible( sal_Int32 setType
) override
;
227 virtual sal_Bool SAL_CALL
updatesAreDetected( sal_Int32 setType
) override
;
228 virtual sal_Bool SAL_CALL
deletesAreDetected( sal_Int32 setType
) override
;
229 virtual sal_Bool SAL_CALL
insertsAreDetected( sal_Int32 setType
) override
;
230 virtual sal_Bool SAL_CALL
supportsBatchUpdates( ) override
;
231 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getUDTs( const css::uno::Any
& catalog
, const OUString
& schemaPattern
, const OUString
& typeNamePattern
, const css::uno::Sequence
< sal_Int32
>& types
) override
;
232 virtual css::uno::Reference
< css::sdbc::XConnection
> SAL_CALL
getConnection( ) override
;
237 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */