1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include <ado/ADatabaseMetaData.hxx>
21 #include <ado/ADatabaseMetaDataResultSet.hxx>
22 #include <com/sun/star/sdbc/DataType.hpp>
23 #include <com/sun/star/sdbc/ResultSetType.hpp>
24 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
25 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
26 #include <ado/AConnection.hxx>
27 #include <ado/adoimp.hxx>
28 #include <FDatabaseMetaDataResultSet.hxx>
29 #include <comphelper/types.hxx>
30 #include <connectivity/dbexception.hxx>
32 using namespace ::comphelper
;
34 using namespace connectivity
;
35 using namespace connectivity::ado
;
36 using namespace com::sun::star::uno
;
37 using namespace com::sun::star::lang
;
38 using namespace com::sun::star::beans
;
39 using namespace com::sun::star::sdbc
;
42 ODatabaseMetaData::ODatabaseMetaData(OConnection
* _pCon
)
43 : ::connectivity::ODatabaseMetaDataBase(_pCon
,_pCon
->getConnectionInfo())
44 ,m_pADOConnection(_pCon
->getConnection())
49 sal_Int32
ODatabaseMetaData::getInt32Property(const OUString
& _aProperty
)
51 connectivity::ado::WpADOProperties
aProps(m_pADOConnection
->get_Properties());
52 // ADOS::ThrowException(*m_pADOConnection,*this);
53 OSL_ENSURE(aProps
.IsValid(),"There are no properties at the connection");
56 if(!aVar
.isNull() && !aVar
.isEmpty())
57 nValue
= aVar
.getInt32();
62 bool ODatabaseMetaData::getBoolProperty(const OUString
& _aProperty
)
64 connectivity::ado::WpADOProperties
aProps(m_pADOConnection
->get_Properties());
65 ADOS::ThrowException(*m_pADOConnection
,*this);
66 OSL_ENSURE(aProps
.IsValid(),"There are no properties at the connection");
68 return !aVar
.isNull() && !aVar
.isEmpty() && aVar
.getBool();
71 OUString
ODatabaseMetaData::getStringProperty(const OUString
& _aProperty
)
73 connectivity::ado::WpADOProperties
aProps(m_pADOConnection
->get_Properties());
74 ADOS::ThrowException(*m_pADOConnection
,*this);
75 OSL_ENSURE(aProps
.IsValid(),"There are no properties at the connection");
79 if(!aVar
.isNull() && !aVar
.isEmpty() && aVar
.getType() == VT_BSTR
)
80 aValue
= aVar
.getString();
85 Reference
< XResultSet
> ODatabaseMetaData::impl_getTypeInfo_throw( )
87 ADORecordset
*pRecordset
= m_pADOConnection
->getTypeInfo();
89 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
90 pResult
->setTypeInfoMap(ADOS::isJetEngine(m_pConnection
->getEngineType()));
91 Reference
< XResultSet
> xRef
= pResult
;
95 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getCatalogs( )
100 ADORecordset
*pRecordset
= nullptr;
101 m_pADOConnection
->OpenSchema(adSchemaCatalogs
,vtEmpty
,vtEmpty
,&pRecordset
);
102 ADOS::ThrowException(*m_pADOConnection
,*this);
104 Reference
< XResultSet
> xRef
;
106 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
107 pResult
->setCatalogsMap();
113 OUString
ODatabaseMetaData::impl_getCatalogSeparator_throw( )
115 return getLiteral(DBLITERAL_CATALOG_SEPARATOR
);
118 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getSchemas( )
123 ADORecordset
*pRecordset
= nullptr;
124 m_pADOConnection
->OpenSchema(adSchemaSchemata
,vtEmpty
,vtEmpty
,&pRecordset
);
125 ADOS::ThrowException(*m_pADOConnection
,*this);
127 Reference
< XResultSet
> xRef
;
129 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
130 pResult
->setSchemasMap();
135 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getColumnPrivileges(
136 const Any
& catalog
, const OUString
& schema
, const OUString
& table
,
137 const OUString
& columnNamePattern
)
139 ADORecordset
*pRecordset
= m_pADOConnection
->getColumnPrivileges(catalog
,schema
,table
,columnNamePattern
);
140 ADOS::ThrowException(*m_pADOConnection
,*this);
142 Reference
< XResultSet
> xRef
;
144 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
145 pResult
->setColumnPrivilegesMap();
150 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getColumns(
151 const Any
& catalog
, const OUString
& schemaPattern
, const OUString
& tableNamePattern
,
152 const OUString
& columnNamePattern
)
154 ADORecordset
*pRecordset
= m_pADOConnection
->getColumns(catalog
,schemaPattern
,tableNamePattern
,columnNamePattern
);
155 ADOS::ThrowException(*m_pADOConnection
,*this);
157 Reference
< XResultSet
> xRef
;
159 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
160 pResult
->setColumnsMap();
166 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getTables(
167 const Any
& catalog
, const OUString
& schemaPattern
,
168 const OUString
& tableNamePattern
, const Sequence
< OUString
>& types
)
170 ADORecordset
*pRecordset
= m_pADOConnection
->getTables(catalog
,schemaPattern
,tableNamePattern
,types
);
171 ADOS::ThrowException(*m_pADOConnection
,*this);
173 Reference
< XResultSet
> xRef
;
175 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
176 pResult
->setTablesMap();
182 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getProcedureColumns(
183 const Any
& catalog
, const OUString
& schemaPattern
,
184 const OUString
& procedureNamePattern
, const OUString
& columnNamePattern
)
186 ADORecordset
*pRecordset
= m_pADOConnection
->getProcedureColumns(catalog
,schemaPattern
,procedureNamePattern
,columnNamePattern
);
187 ADOS::ThrowException(*m_pADOConnection
,*this);
189 Reference
< XResultSet
> xRef
;
191 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
192 pResult
->setProcedureColumnsMap();
198 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getProcedures(
199 const Any
& catalog
, const OUString
& schemaPattern
,
200 const OUString
& procedureNamePattern
)
202 // Create elements used in the array
203 ADORecordset
*pRecordset
= m_pADOConnection
->getProcedures(catalog
,schemaPattern
,procedureNamePattern
);
204 ADOS::ThrowException(*m_pADOConnection
,*this);
206 Reference
< XResultSet
> xRef
;
208 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
209 pResult
->setProceduresMap();
215 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxBinaryLiteralLength( )
217 return getMaxSize(DBLITERAL_BINARY_LITERAL
);
220 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxRowSize( )
222 return getInt32Property("Maximum Row Size");
225 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxCatalogNameLength( )
227 return getMaxSize(DBLITERAL_CATALOG_NAME
);
230 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxCharLiteralLength( )
232 return getMaxSize(DBLITERAL_CHAR_LITERAL
);
235 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnNameLength( )
237 return getMaxSize(DBLITERAL_COLUMN_NAME
);
240 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInIndex( )
245 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxCursorNameLength( )
247 return getMaxSize(DBLITERAL_CURSOR_NAME
);
250 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxConnections( )
252 return getInt32Property("Active Sessions");
255 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInTable( )
257 return getInt32Property("Max Columns in Table");
260 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxStatementLength( )
262 return getMaxSize(DBLITERAL_TEXT_COMMAND
);
265 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxTableNameLength( )
267 return getMaxSize(DBLITERAL_TABLE_NAME
);
270 sal_Int32
ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
272 return getInt32Property("Maximum Tables in SELECT");
275 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getExportedKeys(
276 const Any
& catalog
, const OUString
& schema
, const OUString
& table
)
278 ADORecordset
*pRecordset
= m_pADOConnection
->getExportedKeys(catalog
,schema
,table
);
279 ADOS::ThrowException(*m_pADOConnection
,*this);
281 Reference
< XResultSet
> xRef
;
282 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
283 pResult
->setCrossReferenceMap();
289 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getImportedKeys(
290 const Any
& catalog
, const OUString
& schema
, const OUString
& table
)
292 ADORecordset
*pRecordset
= m_pADOConnection
->getImportedKeys(catalog
,schema
,table
);
293 ADOS::ThrowException(*m_pADOConnection
,*this);
295 Reference
< XResultSet
> xRef
;
297 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
298 pResult
->setCrossReferenceMap();
304 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getPrimaryKeys(
305 const Any
& catalog
, const OUString
& schema
, const OUString
& table
)
307 ADORecordset
*pRecordset
= m_pADOConnection
->getPrimaryKeys(catalog
,schema
,table
);
308 ADOS::ThrowException(*m_pADOConnection
,*this);
310 Reference
< XResultSet
> xRef
;
312 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
313 pResult
->setPrimaryKeysMap();
319 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getIndexInfo(
320 const Any
& catalog
, const OUString
& schema
, const OUString
& table
,
321 sal_Bool unique
, sal_Bool approximate
)
323 ADORecordset
*pRecordset
= m_pADOConnection
->getIndexInfo(catalog
,schema
,table
,unique
,approximate
);
324 ADOS::ThrowException(*m_pADOConnection
,*this);
326 Reference
< XResultSet
> xRef
;
328 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
329 pResult
->setIndexInfoMap();
335 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getTablePrivileges(
336 const Any
& catalog
, const OUString
& schemaPattern
, const OUString
& tableNamePattern
)
338 Reference
< XResultSet
> xRef
;
339 if(!ADOS::isJetEngine(m_pConnection
->getEngineType()))
340 { // the jet provider doesn't support this method
341 // Create elements used in the array
343 ADORecordset
*pRecordset
= m_pADOConnection
->getTablePrivileges(catalog
,schemaPattern
,tableNamePattern
);
344 ADOS::ThrowException(*m_pADOConnection
,*this);
346 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
347 pResult
->setTablePrivilegesMap();
352 ::connectivity::ODatabaseMetaDataResultSet
* pResult
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTablePrivileges
);
354 ::connectivity::ODatabaseMetaDataResultSet::ORows aRows
;
355 ::connectivity::ODatabaseMetaDataResultSet::ORow
aRow(8);
358 aRow
[0] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
359 aRow
[1] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
360 aRow
[2] = new ::connectivity::ORowSetValueDecorator(tableNamePattern
);
361 aRow
[3] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
362 aRow
[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
363 aRow
[5] = new ::connectivity::ORowSetValueDecorator(getUserName());
364 aRow
[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue();
365 aRow
[7] = new ::connectivity::ORowSetValueDecorator(OUString("NO"));
367 aRows
.push_back(aRow
);
368 aRow
[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue();
369 aRows
.push_back(aRow
);
370 aRow
[6] = ::connectivity::ODatabaseMetaDataResultSet::getDeleteValue();
371 aRows
.push_back(aRow
);
372 aRow
[6] = ::connectivity::ODatabaseMetaDataResultSet::getUpdateValue();
373 aRows
.push_back(aRow
);
374 aRow
[6] = ::connectivity::ODatabaseMetaDataResultSet::getCreateValue();
375 aRows
.push_back(aRow
);
376 aRow
[6] = ::connectivity::ODatabaseMetaDataResultSet::getReadValue();
377 aRows
.push_back(aRow
);
378 aRow
[6] = ::connectivity::ODatabaseMetaDataResultSet::getAlterValue();
379 aRows
.push_back(aRow
);
380 aRow
[6] = ::connectivity::ODatabaseMetaDataResultSet::getDropValue();
381 aRows
.push_back(aRow
);
382 pResult
->setRows(aRows
);
388 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getCrossReference(
389 const Any
& primaryCatalog
, const OUString
& primarySchema
,
390 const OUString
& primaryTable
, const Any
& foreignCatalog
,
391 const OUString
& foreignSchema
, const OUString
& foreignTable
)
393 ADORecordset
*pRecordset
= m_pADOConnection
->getCrossReference(primaryCatalog
,primarySchema
,primaryTable
,foreignCatalog
,foreignSchema
,foreignTable
);
394 ADOS::ThrowException(*m_pADOConnection
,*this);
396 Reference
< XResultSet
> xRef
;
398 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(pRecordset
);
399 pResult
->setCrossReferenceMap();
405 sal_Bool SAL_CALL
ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( )
407 return getBoolProperty("Maximum Row Size Includes BLOB");
410 sal_Bool SAL_CALL
ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( )
412 return (getInt32Property("Identifier Case Sensitivity") & DBPROPVAL_IC_LOWER
) == DBPROPVAL_IC_LOWER
;
415 sal_Bool SAL_CALL
ODatabaseMetaData::storesLowerCaseIdentifiers( )
417 return (getInt32Property("Identifier Case Sensitivity") & DBPROPVAL_IC_LOWER
) == DBPROPVAL_IC_LOWER
;
420 bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
422 return (getInt32Property("Identifier Case Sensitivity") & DBPROPVAL_IC_MIXED
) == DBPROPVAL_IC_MIXED
;
425 sal_Bool SAL_CALL
ODatabaseMetaData::storesMixedCaseIdentifiers( )
427 return (getInt32Property("Identifier Case Sensitivity") & DBPROPVAL_IC_MIXED
) == DBPROPVAL_IC_MIXED
;
430 sal_Bool SAL_CALL
ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( )
432 return (getInt32Property("Identifier Case Sensitivity") & DBPROPVAL_IC_UPPER
) == DBPROPVAL_IC_UPPER
;
435 sal_Bool SAL_CALL
ODatabaseMetaData::storesUpperCaseIdentifiers( )
437 return (getInt32Property("Identifier Case Sensitivity") & DBPROPVAL_IC_UPPER
) == DBPROPVAL_IC_UPPER
;
440 bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
445 bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
450 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxIndexLength( )
452 return getInt32Property("Maximum Index Size");
455 sal_Bool SAL_CALL
ODatabaseMetaData::supportsNonNullableColumns( )
457 return getInt32Property("NULL Concatenation Behavior") == DBPROPVAL_CB_NON_NULL
;
460 OUString SAL_CALL
ODatabaseMetaData::getCatalogTerm( )
462 return getStringProperty("Catalog Term");
465 OUString
ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
467 return getLiteral(DBLITERAL_QUOTE_PREFIX
);
471 OUString SAL_CALL
ODatabaseMetaData::getExtraNameCharacters( )
476 sal_Bool SAL_CALL
ODatabaseMetaData::supportsDifferentTableCorrelationNames( )
478 return isCapable(DBLITERAL_CORRELATION_NAME
);
481 bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
483 return getInt32Property("Catalog Location") == DBPROPVAL_CL_START
;
486 sal_Bool SAL_CALL
ODatabaseMetaData::dataDefinitionIgnoredInTransactions( )
488 return getInt32Property("Transaction DDL") == DBPROPVAL_TC_DDL_IGNORE
;
491 sal_Bool SAL_CALL
ODatabaseMetaData::dataDefinitionCausesTransactionCommit( )
493 return getInt32Property("Transaction DDL") == DBPROPVAL_TC_DDL_COMMIT
;
496 sal_Bool SAL_CALL
ODatabaseMetaData::supportsDataManipulationTransactionsOnly( )
498 return getInt32Property("Transaction DDL") == DBPROPVAL_TC_DML
;
501 sal_Bool SAL_CALL
ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( )
503 return getInt32Property("Transaction DDL") == DBPROPVAL_TC_ALL
;
506 sal_Bool SAL_CALL
ODatabaseMetaData::supportsPositionedDelete( )
511 sal_Bool SAL_CALL
ODatabaseMetaData::supportsPositionedUpdate( )
516 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenStatementsAcrossRollback( )
518 return getInt32Property("Prepare Abort Behavior") == DBPROPVAL_CB_PRESERVE
;
521 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenStatementsAcrossCommit( )
523 return getInt32Property("Prepare Commit Behavior") == DBPROPVAL_CB_PRESERVE
;
526 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenCursorsAcrossCommit( )
528 return (getInt32Property("Isolation Retention") & DBPROPVAL_TR_COMMIT
) == DBPROPVAL_TR_COMMIT
;
531 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenCursorsAcrossRollback( )
533 return (getInt32Property("Isolation Retention") & DBPROPVAL_TR_ABORT
) == DBPROPVAL_TR_ABORT
;
536 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level
)
540 sal_Int32 nTxn
= getInt32Property("Isolation Levels");
541 if(level
== TransactionIsolation::NONE
)
543 else if(level
== TransactionIsolation::READ_UNCOMMITTED
)
544 bValue
= (nTxn
& DBPROPVAL_TI_READUNCOMMITTED
) == DBPROPVAL_TI_READUNCOMMITTED
;
545 else if(level
== TransactionIsolation::READ_COMMITTED
)
546 bValue
= (nTxn
& DBPROPVAL_TI_READCOMMITTED
) == DBPROPVAL_TI_READCOMMITTED
;
547 else if(level
== TransactionIsolation::REPEATABLE_READ
)
548 bValue
= (nTxn
& DBPROPVAL_TI_REPEATABLEREAD
) == DBPROPVAL_TI_REPEATABLEREAD
;
549 else if(level
== TransactionIsolation::SERIALIZABLE
)
550 bValue
= (nTxn
& DBPROPVAL_TI_SERIALIZABLE
) == DBPROPVAL_TI_SERIALIZABLE
;
555 bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
557 return (getInt32Property("Schema Usage") & DBPROPVAL_SU_DML_STATEMENTS
) == DBPROPVAL_SU_DML_STATEMENTS
;
560 sal_Bool SAL_CALL
ODatabaseMetaData::supportsANSI92FullSQL( )
562 sal_Int32 nProp
= getInt32Property("SQL Support");
563 return (nProp
== 512) || ((nProp
& DBPROPVAL_SQL_ANSI92_FULL
) == DBPROPVAL_SQL_ANSI92_FULL
);
566 sal_Bool SAL_CALL
ODatabaseMetaData::supportsANSI92EntryLevelSQL( )
568 sal_Int32 nProp
= getInt32Property("SQL Support");
569 return (nProp
== 512) || ((nProp
& DBPROPVAL_SQL_ANSI92_ENTRY
) == DBPROPVAL_SQL_ANSI92_ENTRY
);
572 sal_Bool SAL_CALL
ODatabaseMetaData::supportsIntegrityEnhancementFacility( )
574 sal_Int32 nProp
= getInt32Property("SQL Support");
575 return (nProp
== 512) || ((nProp
& DBPROPVAL_SQL_ANSI89_IEF
) == DBPROPVAL_SQL_ANSI89_IEF
);
578 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSchemasInIndexDefinitions( )
580 return (getInt32Property("Schema Usage") & DBPROPVAL_SU_INDEX_DEFINITION
) == DBPROPVAL_SU_INDEX_DEFINITION
;
583 bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
585 return (getInt32Property("Schema Usage") & DBPROPVAL_SU_TABLE_DEFINITION
) == DBPROPVAL_SU_TABLE_DEFINITION
;
588 bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
593 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCatalogsInIndexDefinitions( )
598 bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
603 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOuterJoins( )
605 if ( ADOS::isJetEngine(m_pConnection
->getEngineType()) )
607 return getBoolProperty("Outer Join Capabilities");
610 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getTableTypes( )
612 return new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes
);
615 sal_Int32
ODatabaseMetaData::impl_getMaxStatements_throw( )
620 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxProcedureNameLength( )
622 return getMaxSize(DBLITERAL_PROCEDURE_NAME
);
625 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxSchemaNameLength( )
627 return getMaxSize(DBLITERAL_SCHEMA_NAME
);
630 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTransactions( )
632 return getInt32Property("Transaction DDL") == DBPROPVAL_TC_NONE
;
635 sal_Bool SAL_CALL
ODatabaseMetaData::allProceduresAreCallable( )
640 sal_Bool SAL_CALL
ODatabaseMetaData::supportsStoredProcedures( )
645 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSelectForUpdate( )
650 sal_Bool SAL_CALL
ODatabaseMetaData::allTablesAreSelectable( )
655 sal_Bool SAL_CALL
ODatabaseMetaData::isReadOnly( )
657 return getBoolProperty("Read-Only Data Source");
660 sal_Bool SAL_CALL
ODatabaseMetaData::usesLocalFiles( )
665 sal_Bool SAL_CALL
ODatabaseMetaData::usesLocalFilePerTable( )
670 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTypeConversion( )
675 sal_Bool SAL_CALL
ODatabaseMetaData::nullPlusNonNullIsNull( )
677 return getInt32Property("NULL Concatenation Behavior") == DBPROPVAL_CB_NULL
;
680 sal_Bool SAL_CALL
ODatabaseMetaData::supportsColumnAliasing( )
682 return isCapable(DBLITERAL_COLUMN_ALIAS
);
685 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTableCorrelationNames( )
687 return isCapable(DBLITERAL_CORRELATION_NAME
);
690 sal_Bool SAL_CALL
ODatabaseMetaData::supportsConvert( sal_Int32
/*fromType*/, sal_Int32
/*toType*/ )
692 return getBoolProperty("Rowset Conversions on Command");
695 sal_Bool SAL_CALL
ODatabaseMetaData::supportsExpressionsInOrderBy( )
697 return getBoolProperty("ORDER BY Columns in Select List");
700 sal_Bool SAL_CALL
ODatabaseMetaData::supportsGroupBy( )
702 return getInt32Property("GROUP BY Support") != DBPROPVAL_GB_NOT_SUPPORTED
;
705 sal_Bool SAL_CALL
ODatabaseMetaData::supportsGroupByBeyondSelect( )
707 return getInt32Property("GROUP BY Support") != DBPROPVAL_GB_CONTAINS_SELECT
;
710 sal_Bool SAL_CALL
ODatabaseMetaData::supportsGroupByUnrelated( )
712 return getInt32Property("GROUP BY Support") == DBPROPVAL_GB_NO_RELATION
;
715 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMultipleTransactions( )
720 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMultipleResultSets( )
725 sal_Bool SAL_CALL
ODatabaseMetaData::supportsLikeEscapeClause( )
727 return isCapable(DBLITERAL_ESCAPE_PERCENT
);
730 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOrderByUnrelated( )
732 return getBoolProperty("ORDER BY Columns in Select List");
735 sal_Bool SAL_CALL
ODatabaseMetaData::supportsUnion( )
740 sal_Bool SAL_CALL
ODatabaseMetaData::supportsUnionAll( )
745 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMixedCaseIdentifiers( )
747 return (getInt32Property("Identifier Case Sensitivity") & DBPROPVAL_IC_MIXED
) == DBPROPVAL_IC_MIXED
;
750 bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
752 return (getInt32Property("Identifier Case Sensitivity") & DBPROPVAL_IC_MIXED
) == DBPROPVAL_IC_MIXED
;
755 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedAtEnd( )
757 return (getInt32Property("NULL Collation Order") & DBPROPVAL_NC_END
) == DBPROPVAL_NC_END
;
760 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedAtStart( )
762 return (getInt32Property("NULL Collation Order") & DBPROPVAL_NC_START
) == DBPROPVAL_NC_START
;
765 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedHigh( )
767 return (getInt32Property("NULL Collation Order") & DBPROPVAL_NC_HIGH
) == DBPROPVAL_NC_HIGH
;
770 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedLow( )
772 return (getInt32Property("NULL Collation Order") & DBPROPVAL_NC_LOW
) == DBPROPVAL_NC_LOW
;
775 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSchemasInProcedureCalls( )
780 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( )
782 return (getInt32Property("Schema Usage") & DBPROPVAL_SU_PRIVILEGE_DEFINITION
) == DBPROPVAL_SU_PRIVILEGE_DEFINITION
;
785 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCatalogsInProcedureCalls( )
790 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( )
795 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCorrelatedSubqueries( )
797 return (getInt32Property("Subquery Support") & DBPROPVAL_SQ_CORRELATEDSUBQUERIES
) == DBPROPVAL_SQ_CORRELATEDSUBQUERIES
;
800 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInComparisons( )
802 return (getInt32Property("Subquery Support") & DBPROPVAL_SQ_COMPARISON
) == DBPROPVAL_SQ_COMPARISON
;
805 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInExists( )
807 return (getInt32Property("Subquery Support") & DBPROPVAL_SQ_EXISTS
) == DBPROPVAL_SQ_EXISTS
;
810 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInIns( )
812 return (getInt32Property("Subquery Support") & DBPROPVAL_SQ_IN
) == DBPROPVAL_SQ_IN
;
815 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInQuantifieds( )
817 return (getInt32Property("Subquery Support") & DBPROPVAL_SQ_QUANTIFIED
) == DBPROPVAL_SQ_QUANTIFIED
;
820 sal_Bool SAL_CALL
ODatabaseMetaData::supportsANSI92IntermediateSQL( )
822 sal_Int32 nProp
= getInt32Property("SQL Support");
823 return (nProp
== 512) || ((nProp
& DBPROPVAL_SQL_ANSI92_INTERMEDIATE
) == DBPROPVAL_SQL_ANSI92_INTERMEDIATE
);
826 OUString SAL_CALL
ODatabaseMetaData::getURL( )
828 return "sdbc:ado:"+ m_pADOConnection
->GetConnectionString();
831 OUString SAL_CALL
ODatabaseMetaData::getUserName( )
833 return getStringProperty("User Name");
836 OUString SAL_CALL
ODatabaseMetaData::getDriverName( )
838 return getStringProperty("Provider Friendly Name");
841 OUString SAL_CALL
ODatabaseMetaData::getDriverVersion( )
843 return getStringProperty("Provider Version");
846 OUString SAL_CALL
ODatabaseMetaData::getDatabaseProductVersion( )
848 return getStringProperty("DBMS Version");
851 OUString SAL_CALL
ODatabaseMetaData::getDatabaseProductName( )
853 return getStringProperty("DBMS Name");
856 OUString SAL_CALL
ODatabaseMetaData::getProcedureTerm( )
858 return getStringProperty("Procedure Term");
861 OUString SAL_CALL
ODatabaseMetaData::getSchemaTerm( )
863 return getStringProperty("Schema Term");
866 sal_Int32 SAL_CALL
ODatabaseMetaData::getDriverMajorVersion( )
871 sal_Int32 SAL_CALL
ODatabaseMetaData::getDefaultTransactionIsolation( )
873 sal_Int32 nRet
= TransactionIsolation::NONE
;
874 switch(m_pADOConnection
->get_IsolationLevel())
876 case adXactReadCommitted
:
877 nRet
= TransactionIsolation::READ_COMMITTED
;
879 case adXactRepeatableRead
:
880 nRet
= TransactionIsolation::REPEATABLE_READ
;
882 case adXactSerializable
:
883 nRet
= TransactionIsolation::SERIALIZABLE
;
885 case adXactReadUncommitted
:
886 nRet
= TransactionIsolation::READ_UNCOMMITTED
;
894 sal_Int32 SAL_CALL
ODatabaseMetaData::getDriverMinorVersion( )
899 OUString SAL_CALL
ODatabaseMetaData::getSQLKeywords( )
901 ADORecordset
*pRecordset
= nullptr;
904 m_pADOConnection
->OpenSchema(adSchemaDBInfoKeywords
,vtEmpty
,vtEmpty
,&pRecordset
);
905 OSL_ENSURE(pRecordset
,"getSQLKeywords: no resultset!");
906 ADOS::ThrowException(*m_pADOConnection
,*this);
909 WpADORecordset
aRecordset(pRecordset
);
911 aRecordset
.MoveFirst();
914 while(!aRecordset
.IsAtEOF())
916 WpOLEAppendCollection
<ADOFields
, ADOField
, WpADOField
> aFields(aRecordset
.GetFields());
917 WpADOField
aField(aFields
.GetItem(0));
918 aField
.get_Value(aValue
);
919 aRet
= aRet
+ aValue
.getString() + ",";
920 aRecordset
.MoveNext();
923 if ( !aRet
.isEmpty() )
924 return aRet
.copy(0,aRet
.lastIndexOf(','));
929 OUString SAL_CALL
ODatabaseMetaData::getSearchStringEscape( )
931 return getLiteral(DBLITERAL_ESCAPE_PERCENT
);
934 OUString SAL_CALL
ODatabaseMetaData::getStringFunctions( )
937 return aValue
.copy(0,aValue
.lastIndexOf(','));
940 OUString SAL_CALL
ODatabaseMetaData::getTimeDateFunctions( )
945 OUString SAL_CALL
ODatabaseMetaData::getSystemFunctions( )
948 return aValue
.copy(0,aValue
.lastIndexOf(','));
951 OUString SAL_CALL
ODatabaseMetaData::getNumericFunctions( )
956 sal_Bool SAL_CALL
ODatabaseMetaData::supportsExtendedSQLGrammar( )
958 sal_Int32 nProp
= getInt32Property("SQL Support");
959 return (nProp
== 512) || ((nProp
& DBPROPVAL_SQL_ODBC_EXTENDED
) == DBPROPVAL_SQL_ODBC_EXTENDED
);
962 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCoreSQLGrammar( )
964 sal_Int32 nProp
= getInt32Property("SQL Support");
965 return (nProp
== 512) || ((nProp
& DBPROPVAL_SQL_ODBC_CORE
) == DBPROPVAL_SQL_ODBC_CORE
);
968 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMinimumSQLGrammar( )
970 sal_Int32 nProp
= getInt32Property("SQL Support");
971 return (nProp
== 512) || ((nProp
& DBPROPVAL_SQL_ODBC_MINIMUM
) == DBPROPVAL_SQL_ODBC_MINIMUM
);
974 sal_Bool SAL_CALL
ODatabaseMetaData::supportsFullOuterJoins( )
976 if ( ADOS::isJetEngine(m_pConnection
->getEngineType()) )
978 return (getInt32Property("Outer Join Capabilities") & 0x00000004L
) == 0x00000004L
;
981 sal_Bool SAL_CALL
ODatabaseMetaData::supportsLimitedOuterJoins( )
983 return supportsFullOuterJoins( );
986 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInGroupBy( )
988 return getInt32Property("Max Columns in GROUP BY");
991 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInOrderBy( )
993 return getInt32Property("Max Columns in ORDER BY");
996 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInSelect( )
1001 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxUserNameLength( )
1003 return getMaxSize(DBLITERAL_USER_NAME
);
1006 sal_Bool SAL_CALL
ODatabaseMetaData::supportsResultSetType( sal_Int32
/*setType*/ )
1011 sal_Bool SAL_CALL
ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32
/*setType*/, sal_Int32
/*concurrency*/ )
1016 sal_Bool SAL_CALL
ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType
)
1018 return ResultSetType::FORWARD_ONLY
!= setType
;
1021 sal_Bool SAL_CALL
ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType
)
1023 return ResultSetType::FORWARD_ONLY
!= setType
;
1026 sal_Bool SAL_CALL
ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType
)
1028 return ResultSetType::FORWARD_ONLY
!= setType
;
1031 sal_Bool SAL_CALL
ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType
)
1033 return ResultSetType::FORWARD_ONLY
!= setType
;
1036 sal_Bool SAL_CALL
ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType
)
1038 return ResultSetType::FORWARD_ONLY
!= setType
;
1041 sal_Bool SAL_CALL
ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType
)
1043 return ResultSetType::FORWARD_ONLY
!= setType
;
1046 sal_Bool SAL_CALL
ODatabaseMetaData::updatesAreDetected( sal_Int32 setType
)
1048 return ResultSetType::FORWARD_ONLY
!= setType
;
1051 sal_Bool SAL_CALL
ODatabaseMetaData::deletesAreDetected( sal_Int32 setType
)
1053 return ResultSetType::FORWARD_ONLY
!= setType
;
1056 sal_Bool SAL_CALL
ODatabaseMetaData::insertsAreDetected( sal_Int32 setType
)
1058 return ResultSetType::FORWARD_ONLY
!= setType
;
1061 sal_Bool SAL_CALL
ODatabaseMetaData::supportsBatchUpdates( )
1066 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getUDTs( const Any
& /*catalog*/, const OUString
& /*schemaPattern*/, const OUString
& /*typeNamePattern*/, const Sequence
< sal_Int32
>& /*types*/ )
1068 ::dbtools::throwFeatureNotImplementedSQLException( "XDatabaseMetaData::getUDTs", *this );
1069 return Reference
< XResultSet
>();
1073 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */