bump product version to 7.2.5.1
[LibreOffice.git] / connectivity / source / drivers / odbc / ODatabaseMetaData.cxx
blob9571420271822631d6b5ebc0d48f431cf14e84cd
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 #include <odbc/ODatabaseMetaData.hxx>
21 #include <odbc/OTools.hxx>
22 #include <odbc/ODatabaseMetaDataResultSet.hxx>
23 #include <FDatabaseMetaDataResultSet.hxx>
24 #include <com/sun/star/sdbc/DataType.hpp>
25 #include <com/sun/star/sdbc/ResultSetType.hpp>
26 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
27 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
28 #include <TPrivilegesResultSet.hxx>
29 #include <rtl/ustrbuf.hxx>
30 #include <sal/log.hxx>
32 using namespace connectivity::odbc;
33 using namespace com::sun::star::uno;
34 using namespace com::sun::star::lang;
35 using namespace com::sun::star::beans;
36 using namespace com::sun::star::sdbc;
38 ODatabaseMetaData::ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon)
39 : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
40 ,m_aConnectionHandle(_pHandle)
41 ,m_pConnection(_pCon)
42 ,m_bUseCatalog(true)
44 OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
45 if(!m_pConnection->isCatalogUsed())
47 osl_atomic_increment( &m_refCount );
48 try
50 m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
52 catch(SQLException& )
53 { // doesn't matter here
55 osl_atomic_decrement( &m_refCount );
59 ODatabaseMetaData::~ODatabaseMetaData()
63 Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
65 Reference< XResultSet > xRef;
66 try
68 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
69 xRef = pResult;
70 pResult->openTypeInfo();
72 catch(SQLException&)
74 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
77 return xRef;
80 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( )
82 Reference< XResultSet > xRef;
83 if(!m_bUseCatalog)
85 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
87 else
89 try
91 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
92 xRef = pResult;
93 pResult->openCatalogs();
95 catch(SQLException&)
97 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
101 return xRef;
104 OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
106 OUString aVal;
107 if ( m_bUseCatalog )
108 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_NAME_SEPARATOR,aVal,*this,m_pConnection->getTextEncoding());
110 return aVal;
113 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( )
115 Reference< XResultSet > xRef;
118 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
119 xRef = pResult;
120 pResult->openSchemas();
122 catch(SQLException&)
124 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eSchemas);
126 return xRef;
129 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
130 const Any& catalog, const OUString& schema, const OUString& table,
131 const OUString& columnNamePattern )
133 Reference< XResultSet > xRef;
136 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
137 xRef = pResult;
138 pResult->openColumnPrivileges(m_bUseCatalog ? catalog : Any(),schema,table,columnNamePattern);
140 catch(SQLException&)
142 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumnPrivileges);
144 return xRef;
147 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
148 const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern,
149 const OUString& columnNamePattern )
151 Reference< XResultSet > xRef;
154 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
155 xRef = pResult;
156 pResult->openColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,columnNamePattern);
158 catch(SQLException&)
160 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
162 return xRef;
165 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
166 const Any& catalog, const OUString& schemaPattern,
167 const OUString& tableNamePattern, const Sequence< OUString >& types )
169 Reference< XResultSet > xRef;
172 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
173 xRef = pResult;
174 pResult->openTables(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,types);
176 catch(SQLException&)
178 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
180 return xRef;
183 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
184 const Any& catalog, const OUString& schemaPattern,
185 const OUString& procedureNamePattern, const OUString& columnNamePattern )
187 Reference< XResultSet > xRef;
190 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
191 xRef = pResult;
192 pResult->openProcedureColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern,columnNamePattern);
194 catch(SQLException&)
196 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedureColumns);
198 return xRef;
201 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
202 const Any& catalog, const OUString& schemaPattern,
203 const OUString& procedureNamePattern )
205 Reference< XResultSet > xRef;
208 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
209 xRef = pResult;
210 pResult->openProcedures(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern);
212 catch(SQLException&)
214 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedures);
216 return xRef;
219 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
220 const Any& catalog, const OUString& schema, const OUString& table )
222 Reference< XResultSet > xRef;
223 bool bSuccess = false;
226 if ( !m_pConnection->preventGetVersionColumns() )
228 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
229 xRef = pResult;
230 pResult->openVersionColumns(m_bUseCatalog ? catalog : Any(),schema,table);
231 bSuccess = true;
234 catch(SQLException&)
238 if ( !bSuccess )
240 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
243 return xRef;
246 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( )
248 SQLUINTEGER nValue;
249 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_BINARY_LITERAL_LEN,nValue,*this);
250 return nValue;
253 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( )
255 SQLUINTEGER nValue;
256 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_ROW_SIZE,nValue,*this);
257 return nValue;
260 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( )
262 SQLUSMALLINT nValue;
263 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CATALOG_NAME_LEN,nValue,*this);
264 return nValue;
267 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( )
269 SQLUINTEGER nValue;
270 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CHAR_LITERAL_LEN,nValue,*this);
271 return nValue;
274 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( )
276 SQLUSMALLINT nValue;
277 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMN_NAME_LEN,nValue,*this);
278 return nValue;
281 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( )
283 SQLUSMALLINT nValue;
284 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_INDEX,nValue,*this);
285 return nValue;
288 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( )
290 SQLUSMALLINT nValue;
291 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CURSOR_NAME_LEN,nValue,*this);
292 return nValue;
295 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( )
297 SQLUSMALLINT nValue;
298 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_DRIVER_CONNECTIONS/*SQL_ACTIVE_CONNECTIONS*/,nValue,*this);
299 return nValue;
302 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( )
304 SQLUSMALLINT nValue;
305 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_TABLE,nValue,*this);
306 return nValue;
309 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( )
311 SQLUINTEGER nValue;
312 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_STATEMENT_LEN,nValue,*this);
313 return nValue;
316 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( )
318 SQLUSMALLINT nValue;
319 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLE_NAME_LEN,nValue,*this);
320 return nValue;
323 sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
325 SQLUSMALLINT nValue;
326 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLES_IN_SELECT,nValue,*this);
327 return nValue;
330 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
331 const Any& catalog, const OUString& schema, const OUString& table )
333 Reference< XResultSet > xRef;
336 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
337 xRef = pResult;
338 pResult->openExportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
340 catch(SQLException&)
342 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eExportedKeys);
344 return xRef;
347 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
348 const Any& catalog, const OUString& schema, const OUString& table )
350 Reference< XResultSet > xRef;
353 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
354 xRef = pResult;
355 pResult->openImportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
357 catch(SQLException&)
359 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eImportedKeys);
361 return xRef;
364 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
365 const Any& catalog, const OUString& schema, const OUString& table )
367 Reference< XResultSet > xRef;
370 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
371 xRef = pResult;
372 pResult->openPrimaryKeys(m_bUseCatalog ? catalog : Any(),schema,table);
374 catch(SQLException&)
376 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::ePrimaryKeys);
378 return xRef;
381 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
382 const Any& catalog, const OUString& schema, const OUString& table,
383 sal_Bool unique, sal_Bool approximate )
385 Reference< XResultSet > xRef;
388 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
389 xRef = pResult;
390 pResult->openIndexInfo(m_bUseCatalog ? catalog : Any(),schema,table,unique,approximate);
392 catch(SQLException&)
394 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eIndexInfo);
396 return xRef;
399 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
400 const Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope,
401 sal_Bool nullable )
403 Reference< XResultSet > xRef;
406 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
407 xRef = pResult;
408 pResult->openBestRowIdentifier(m_bUseCatalog ? catalog : Any(),schema,table,scope,nullable);
410 catch(SQLException&)
412 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eBestRowIdentifier);
414 return xRef;
417 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
418 const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern )
420 if ( m_pConnection->isIgnoreDriverPrivilegesEnabled() )
422 return new OResultSetPrivileges(this,catalog,schemaPattern,tableNamePattern);
424 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
425 pResult->openTablePrivileges(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern);
426 return pResult;
429 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
430 const Any& primaryCatalog, const OUString& primarySchema,
431 const OUString& primaryTable, const Any& foreignCatalog,
432 const OUString& foreignSchema, const OUString& foreignTable )
434 Reference< XResultSet > xRef;
437 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
438 xRef = pResult;
439 pResult->openForeignKeys(m_bUseCatalog ? primaryCatalog : Any(),primarySchema.toChar() == '%' ? &primarySchema : nullptr,&primaryTable,
440 m_bUseCatalog ? foreignCatalog : Any(), foreignSchema.toChar() == '%' ? &foreignSchema : nullptr,&foreignTable);
442 catch(SQLException&)
444 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCrossReference);
446 return xRef;
449 sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( )
451 OUString aVal;
452 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_ROW_SIZE_INCLUDES_LONG,aVal,*this,m_pConnection->getTextEncoding());
453 return aVal.toChar() == 'Y';
456 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( )
458 SQLUSMALLINT nValue;
459 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
460 return nValue == SQL_IC_LOWER;
463 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( )
465 SQLUSMALLINT nValue;
466 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
467 return nValue == SQL_IC_LOWER;
470 bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
472 SQLUSMALLINT nValue;
473 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
474 return nValue == SQL_IC_MIXED;
477 sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( )
479 SQLUSMALLINT nValue;
480 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
481 return nValue == SQL_IC_MIXED;
484 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( )
486 SQLUSMALLINT nValue;
487 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
488 return nValue == SQL_IC_UPPER;
491 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( )
493 SQLUSMALLINT nValue;
494 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
495 return nValue == SQL_IC_UPPER;
498 bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
500 SQLUINTEGER nValue;
501 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this);
502 return (nValue & SQL_AT_ADD_COLUMN) == SQL_AT_ADD_COLUMN;
505 bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
507 SQLUINTEGER nValue;
508 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this);
509 return ((nValue & SQL_AT_DROP_COLUMN) == SQL_AT_DROP_COLUMN) ||
510 ((nValue & SQL_AT_DROP_COLUMN_CASCADE) == SQL_AT_DROP_COLUMN_CASCADE) ||
511 ((nValue & SQL_AT_DROP_COLUMN_RESTRICT) == SQL_AT_DROP_COLUMN_RESTRICT);
514 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( )
516 SQLUINTEGER nValue;
517 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_INDEX_SIZE,nValue,*this);
518 return nValue;
521 sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( )
523 SQLUSMALLINT nValue;
524 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NON_NULLABLE_COLUMNS,nValue,*this);
525 return nValue == SQL_NNC_NON_NULL;
528 OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( )
530 OUString aVal;
531 if(m_bUseCatalog)
532 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_TERM,aVal,*this,m_pConnection->getTextEncoding());
533 return aVal;
536 OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
538 OUString aVal;
539 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_QUOTE_CHAR,aVal,*this,m_pConnection->getTextEncoding());
540 return aVal;
543 OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( )
545 OUString aVal;
546 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SPECIAL_CHARACTERS,aVal,*this,m_pConnection->getTextEncoding());
547 return aVal;
550 sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( )
552 SQLUSMALLINT nValue;
553 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
554 return nValue != SQL_CN_NONE;
557 bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
559 SQLUSMALLINT nValue=0;
560 if ( m_bUseCatalog )
561 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_LOCATION,nValue,*this);
562 return nValue == SQL_CL_START;
565 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( )
567 SQLUSMALLINT nValue;
568 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
569 return nValue == SQL_TC_DDL_IGNORE;
572 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( )
574 SQLUSMALLINT nValue;
575 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
576 return nValue == SQL_TC_DDL_COMMIT;
579 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( )
581 SQLUSMALLINT nValue;
582 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
583 return nValue == SQL_TC_DML;
586 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( )
588 SQLUSMALLINT nValue;
589 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
590 return nValue == SQL_TC_ALL;
593 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( )
595 SQLUINTEGER nValue;
596 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
597 return (nValue & SQL_CA1_POS_DELETE) == SQL_CA1_POS_DELETE;
600 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( )
602 SQLUINTEGER nValue;
603 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
604 return (nValue & SQL_CA1_POS_UPDATE) == SQL_CA1_POS_UPDATE;
607 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( )
609 SQLUSMALLINT nValue;
610 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
611 return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
614 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( )
616 SQLUSMALLINT nValue;
617 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
618 return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
621 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( )
623 SQLUSMALLINT nValue;
624 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
625 return nValue == SQL_CB_PRESERVE;
628 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( )
630 SQLUSMALLINT nValue;
631 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
632 return nValue == SQL_CB_PRESERVE;
635 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level )
637 SQLUINTEGER nValue;
638 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_ISOLATION_OPTION,nValue,*this);
639 return (nValue & static_cast<SQLUINTEGER>(level)) == static_cast<SQLUINTEGER>(level);
642 bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
644 SQLUINTEGER nValue;
645 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
646 return (nValue & SQL_SU_DML_STATEMENTS) == SQL_SU_DML_STATEMENTS;
649 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( )
651 SQLUINTEGER nValue;
652 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
653 return static_cast<bool>(nValue & SQL_SC_SQL92_FULL);
656 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( )
658 SQLUINTEGER nValue;
659 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
660 return static_cast<bool>(nValue &SQL_SC_SQL92_ENTRY);
663 sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( )
665 OUString aStr;
666 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_INTEGRITY,aStr,*this,m_pConnection->getTextEncoding());
667 return aStr.toChar() == 'Y';
670 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( )
672 SQLUINTEGER nValue;
673 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
674 return (nValue & SQL_SU_INDEX_DEFINITION) == SQL_SU_INDEX_DEFINITION;
677 bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
679 SQLUINTEGER nValue;
680 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
681 return (nValue & SQL_SU_TABLE_DEFINITION) == SQL_SU_TABLE_DEFINITION;
684 bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
686 SQLUINTEGER nValue=0;
687 if(m_bUseCatalog)
688 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
689 return (nValue & SQL_CU_TABLE_DEFINITION) == SQL_CU_TABLE_DEFINITION;
692 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( )
694 SQLUINTEGER nValue=0;
695 if(m_bUseCatalog)
696 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
697 return (nValue & SQL_CU_INDEX_DEFINITION) == SQL_CU_INDEX_DEFINITION;
700 bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
702 SQLUINTEGER nValue=0;
703 if(m_bUseCatalog)
704 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
705 return (nValue & SQL_CU_DML_STATEMENTS) == SQL_CU_DML_STATEMENTS;
708 sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( )
710 SQLUINTEGER nValue;
711 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
712 return ((nValue & (SQL_OJ_FULL|SQL_OJ_LEFT|SQL_OJ_RIGHT|SQL_OJ_NESTED|SQL_OJ_NOT_ORDERED|SQL_OJ_ALL_COMPARISON_OPS|SQL_OJ_INNER)) != 0);
715 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( )
717 Reference< XResultSet > xRef;
720 rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(m_pConnection);
721 xRef = pResult;
722 pResult->openTablesTypes();
724 catch(SQLException&)
726 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
728 return xRef;
731 sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
733 SQLUSMALLINT nValue;
734 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CONCURRENT_ACTIVITIES,nValue,*this);
735 return nValue;
738 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( )
740 SQLUSMALLINT nValue;
741 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_PROCEDURE_NAME_LEN,nValue,*this);
742 return nValue;
745 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( )
747 SQLUSMALLINT nValue;
748 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_SCHEMA_NAME_LEN,nValue,*this);
749 return nValue;
752 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( )
754 SQLUSMALLINT nValue;
755 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
756 return nValue != SQL_TC_NONE;
759 sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( )
761 OUString aValue;
762 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ACCESSIBLE_PROCEDURES,aValue,*this,m_pConnection->getTextEncoding());
763 return aValue.toChar() == 'Y';
766 sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( )
768 OUString aValue;
769 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_PROCEDURES,aValue,*this,m_pConnection->getTextEncoding());
770 return aValue.toChar() == 'Y';
773 sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( )
775 SQLUINTEGER nValue;
776 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
777 return (nValue & SQL_CA1_POSITIONED_UPDATE) == SQL_CA1_POSITIONED_UPDATE;
780 sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( )
782 OUString aValue;
783 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ACCESSIBLE_TABLES,aValue,*this,m_pConnection->getTextEncoding());
784 return aValue.toChar() == 'Y';
787 sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( )
789 return m_pConnection->isReadOnly();
792 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( )
794 SQLUSMALLINT nValue;
795 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this);
796 return nValue == SQL_FILE_CATALOG;
799 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( )
801 SQLUSMALLINT nValue;
802 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this);
803 return nValue == SQL_FILE_TABLE;
806 sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( )
808 SQLUINTEGER nValue;
809 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_FUNCTIONS,nValue,*this);
810 return (nValue & SQL_FN_CVT_CONVERT) == SQL_FN_CVT_CONVERT;
813 sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( )
815 SQLUSMALLINT nValue;
816 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONCAT_NULL_BEHAVIOR,nValue,*this);
817 return nValue == SQL_CB_NULL;
820 sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( )
822 OUString aValue;
823 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_COLUMN_ALIAS,aValue,*this,m_pConnection->getTextEncoding());
824 return aValue.toChar() == 'Y';
827 sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( )
829 SQLUSMALLINT nValue;
830 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
831 return nValue != SQL_CN_NONE;
834 sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType )
836 if(fromType == toType)
837 return true;
839 SQLUINTEGER nValue=0;
840 switch(fromType)
842 case DataType::BIT:
843 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BIT,nValue,*this);
844 break;
845 case DataType::TINYINT:
846 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TINYINT,nValue,*this);
847 break;
848 case DataType::SMALLINT:
849 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_SMALLINT,nValue,*this);
850 break;
851 case DataType::INTEGER:
852 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_INTEGER,nValue,*this);
853 break;
854 case DataType::BIGINT:
855 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BIGINT,nValue,*this);
856 break;
857 case DataType::FLOAT:
858 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_FLOAT,nValue,*this);
859 break;
860 case DataType::REAL:
861 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_REAL,nValue,*this);
862 break;
863 case DataType::DOUBLE:
864 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DOUBLE,nValue,*this);
865 break;
866 case DataType::NUMERIC:
867 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_NUMERIC,nValue,*this);
868 break;
869 case DataType::DECIMAL:
870 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DECIMAL,nValue,*this);
871 break;
872 case DataType::CHAR:
873 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_CHAR,nValue,*this);
874 break;
875 case DataType::VARCHAR:
876 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARCHAR,nValue,*this);
877 break;
878 case DataType::LONGVARCHAR:
879 case DataType::CLOB:
880 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARCHAR,nValue,*this);
881 break;
882 case DataType::DATE:
883 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DATE,nValue,*this);
884 break;
885 case DataType::TIME:
886 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TIME,nValue,*this);
887 break;
888 case DataType::TIMESTAMP:
889 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TIMESTAMP,nValue,*this);
890 break;
891 case DataType::BINARY:
892 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BINARY,nValue,*this);
893 break;
894 case DataType::VARBINARY:
895 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARBINARY,nValue,*this);
896 break;
897 case DataType::LONGVARBINARY:
898 case DataType::BLOB:
899 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARBINARY,nValue,*this);
900 break;
901 case DataType::SQLNULL:
902 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
903 break;
904 case DataType::OTHER:
905 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
906 break;
907 case DataType::OBJECT:
908 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
909 break;
910 case DataType::DISTINCT:
911 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
912 break;
913 case DataType::STRUCT:
914 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
915 break;
916 case DataType::ARRAY:
917 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
918 break;
919 case DataType::REF:
920 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
921 break;
923 bool bConvert = false;
924 switch(toType)
926 case DataType::BIT:
927 bConvert = (nValue & SQL_CVT_BIT) == SQL_CVT_BIT;
928 break;
929 case DataType::TINYINT:
930 bConvert = (nValue & SQL_CVT_TINYINT) == SQL_CVT_TINYINT;
931 break;
932 case DataType::SMALLINT:
933 bConvert = (nValue & SQL_CVT_SMALLINT) == SQL_CVT_SMALLINT;
934 break;
935 case DataType::INTEGER:
936 bConvert = (nValue & SQL_CVT_INTEGER) == SQL_CVT_INTEGER;
937 break;
938 case DataType::BIGINT:
939 bConvert = (nValue & SQL_CVT_BIGINT) == SQL_CVT_BIGINT;
940 break;
941 case DataType::FLOAT:
942 bConvert = (nValue & SQL_CVT_FLOAT) == SQL_CVT_FLOAT;
943 break;
944 case DataType::REAL:
945 bConvert = (nValue & SQL_CVT_REAL) == SQL_CVT_REAL;
946 break;
947 case DataType::DOUBLE:
948 bConvert = (nValue & SQL_CVT_DOUBLE) == SQL_CVT_DOUBLE;
949 break;
950 case DataType::NUMERIC:
951 bConvert = (nValue & SQL_CVT_NUMERIC) == SQL_CVT_NUMERIC;
952 break;
953 case DataType::DECIMAL:
954 bConvert = (nValue & SQL_CVT_DECIMAL) == SQL_CVT_DECIMAL;
955 break;
956 case DataType::CHAR:
957 bConvert = (nValue & SQL_CVT_CHAR) == SQL_CVT_CHAR;
958 break;
959 case DataType::VARCHAR:
960 bConvert = (nValue & SQL_CVT_VARCHAR) == SQL_CVT_VARCHAR;
961 break;
962 case DataType::LONGVARCHAR:
963 case DataType::CLOB:
964 bConvert = (nValue & SQL_CVT_LONGVARCHAR) == SQL_CVT_LONGVARCHAR;
965 break;
966 case DataType::DATE:
967 bConvert = (nValue & SQL_CVT_DATE) == SQL_CVT_DATE;
968 break;
969 case DataType::TIME:
970 bConvert = (nValue & SQL_CVT_TIME) == SQL_CVT_TIME;
971 break;
972 case DataType::TIMESTAMP:
973 bConvert = (nValue & SQL_CVT_TIMESTAMP) == SQL_CVT_TIMESTAMP;
974 break;
975 case DataType::BINARY:
976 bConvert = (nValue & SQL_CVT_BINARY) == SQL_CVT_BINARY;
977 break;
978 case DataType::VARBINARY:
979 bConvert = (nValue & SQL_CVT_VARBINARY) == SQL_CVT_VARBINARY;
980 break;
981 case DataType::LONGVARBINARY:
982 case DataType::BLOB:
983 bConvert = (nValue & SQL_CVT_LONGVARBINARY) == SQL_CVT_LONGVARBINARY;
984 break;
987 return bConvert;
990 sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( )
992 OUString aValue;
993 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_EXPRESSIONS_IN_ORDERBY,aValue,*this,m_pConnection->getTextEncoding());
994 return aValue.toChar() == 'Y';
997 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( )
999 SQLUSMALLINT nValue;
1000 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1001 return nValue != SQL_GB_NOT_SUPPORTED;
1004 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( )
1006 SQLUSMALLINT nValue;
1007 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1008 return nValue != SQL_GB_GROUP_BY_CONTAINS_SELECT;
1011 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( )
1013 SQLUSMALLINT nValue;
1014 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1015 return nValue == SQL_GB_NO_RELATION;
1018 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( )
1020 OUString aValue;
1021 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MULTIPLE_ACTIVE_TXN,aValue,*this,m_pConnection->getTextEncoding());
1022 return aValue.toChar() == 'Y';
1025 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( )
1027 OUString aValue;
1028 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MULT_RESULT_SETS,aValue,*this,m_pConnection->getTextEncoding());
1029 return aValue.toChar() == 'Y';
1032 sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( )
1034 OUString aValue;
1035 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_LIKE_ESCAPE_CLAUSE,aValue,*this,m_pConnection->getTextEncoding());
1036 return aValue.toChar() == 'Y';
1039 sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( )
1041 OUString aValue;
1042 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ORDER_BY_COLUMNS_IN_SELECT,aValue,*this,m_pConnection->getTextEncoding());
1043 return aValue.toChar() == 'N';
1046 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( )
1048 SQLUINTEGER nValue;
1049 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_UNION,nValue,*this);
1050 return (nValue & SQL_U_UNION) == SQL_U_UNION;
1053 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( )
1055 SQLUINTEGER nValue;
1056 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_UNION,nValue,*this);
1057 return (nValue & SQL_U_UNION_ALL) == SQL_U_UNION_ALL;
1060 sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( )
1062 SQLUSMALLINT nValue;
1063 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
1064 return nValue == SQL_IC_MIXED;
1067 bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
1069 SQLUSMALLINT nValue;
1070 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
1071 return nValue == SQL_IC_MIXED;
1074 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( )
1076 SQLUSMALLINT nValue;
1077 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1078 return nValue == SQL_NC_END;
1081 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( )
1083 SQLUSMALLINT nValue;
1084 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1085 return nValue == SQL_NC_START;
1088 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( )
1090 SQLUSMALLINT nValue;
1091 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1092 return nValue == SQL_NC_HIGH;
1095 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( )
1097 SQLUSMALLINT nValue;
1098 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1099 return nValue == SQL_NC_LOW;
1102 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( )
1104 SQLUINTEGER nValue;
1105 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
1106 return (nValue & SQL_SU_PROCEDURE_INVOCATION) == SQL_SU_PROCEDURE_INVOCATION;
1109 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( )
1111 SQLUINTEGER nValue;
1112 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
1113 return (nValue & SQL_SU_PRIVILEGE_DEFINITION) == SQL_SU_PRIVILEGE_DEFINITION;
1116 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( )
1118 SQLUINTEGER nValue=0;
1119 if(m_bUseCatalog)
1120 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
1121 return (nValue & SQL_CU_PROCEDURE_INVOCATION) == SQL_CU_PROCEDURE_INVOCATION;
1124 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( )
1126 SQLUINTEGER nValue=0;
1127 if(m_bUseCatalog)
1128 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
1129 return (nValue & SQL_CU_PRIVILEGE_DEFINITION) == SQL_CU_PRIVILEGE_DEFINITION;
1132 sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( )
1134 SQLUINTEGER nValue;
1135 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1136 return (nValue & SQL_SQ_CORRELATED_SUBQUERIES) == SQL_SQ_CORRELATED_SUBQUERIES;
1139 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( )
1141 SQLUINTEGER nValue;
1142 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1143 return (nValue & SQL_SQ_COMPARISON) == SQL_SQ_COMPARISON;
1146 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( )
1148 SQLUINTEGER nValue;
1149 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1150 return (nValue & SQL_SQ_EXISTS) == SQL_SQ_EXISTS;
1153 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( )
1155 SQLUINTEGER nValue;
1156 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1157 return (nValue & SQL_SQ_IN) == SQL_SQ_IN;
1160 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( )
1162 SQLUINTEGER nValue;
1163 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1164 return (nValue & SQL_SQ_QUANTIFIED) == SQL_SQ_QUANTIFIED;
1167 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( )
1169 SQLUINTEGER nValue;
1170 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
1171 return static_cast<bool>(nValue & SQL_SC_SQL92_INTERMEDIATE);
1174 OUString ODatabaseMetaData::getURLImpl()
1176 OUString aValue;
1177 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DATA_SOURCE_NAME,aValue,*this,m_pConnection->getTextEncoding());
1178 return aValue;
1181 OUString SAL_CALL ODatabaseMetaData::getURL( )
1183 OUString aValue = m_pConnection->getURL();
1184 if ( aValue.isEmpty() )
1186 aValue = "sdbc:odbc:" + getURLImpl();
1188 return aValue;
1191 OUString SAL_CALL ODatabaseMetaData::getUserName( )
1193 OUString aValue;
1194 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_USER_NAME,aValue,*this,m_pConnection->getTextEncoding());
1195 return aValue;
1198 OUString SAL_CALL ODatabaseMetaData::getDriverName( )
1200 OUString aValue;
1201 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_NAME,aValue,*this,m_pConnection->getTextEncoding());
1202 return aValue;
1205 OUString SAL_CALL ODatabaseMetaData::getDriverVersion()
1207 OUString aValue;
1208 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_ODBC_VER,aValue,*this,m_pConnection->getTextEncoding());
1209 return aValue;
1212 OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( )
1214 OUString aValue;
1215 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1216 return aValue;
1219 OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( )
1221 OUString aValue;
1222 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DBMS_NAME,aValue,*this,m_pConnection->getTextEncoding());
1223 return aValue;
1226 OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( )
1228 OUString aValue;
1229 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_PROCEDURE_TERM,aValue,*this,m_pConnection->getTextEncoding());
1230 return aValue;
1233 OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( )
1235 OUString aValue;
1236 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_TERM,aValue,*this,m_pConnection->getTextEncoding());
1237 return aValue;
1240 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) try
1242 OUString aValue;
1243 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1244 return aValue.copy(0,aValue.indexOf('.')).toInt32();
1246 catch (const SQLException &)
1248 return 0;
1251 sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( )
1253 SQLUINTEGER nValue;
1254 sal_Int32 nValueTranslated;
1255 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DEFAULT_TXN_ISOLATION,nValue,*this);
1256 switch(nValue)
1258 case SQL_TXN_READ_UNCOMMITTED:
1259 nValueTranslated = css::sdbc::TransactionIsolation::READ_UNCOMMITTED;
1260 break;
1261 case SQL_TXN_READ_COMMITTED:
1262 nValueTranslated = css::sdbc::TransactionIsolation::READ_COMMITTED;
1263 break;
1264 case SQL_TXN_REPEATABLE_READ:
1265 nValueTranslated = css::sdbc::TransactionIsolation::REPEATABLE_READ;
1266 break;
1267 case SQL_TXN_SERIALIZABLE:
1268 nValueTranslated = css::sdbc::TransactionIsolation::SERIALIZABLE;
1269 break;
1270 default:
1271 nValueTranslated = 0;
1273 return nValueTranslated;
1276 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) try
1278 OUString aValue;
1279 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1280 return aValue.copy(0,aValue.lastIndexOf('.')).toInt32();
1282 catch (const SQLException &)
1284 return 0;
1287 OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( )
1289 OUString aValue;
1290 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_KEYWORDS,aValue,*this,m_pConnection->getTextEncoding());
1291 return aValue;
1294 OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( )
1296 OUString aValue;
1297 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SEARCH_PATTERN_ESCAPE,aValue,*this,m_pConnection->getTextEncoding());
1298 return aValue;
1301 OUString SAL_CALL ODatabaseMetaData::getStringFunctions( )
1303 SQLUINTEGER nValue;
1304 OUStringBuffer aValue;
1305 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_STRING_FUNCTIONS,nValue,*this);
1306 if(nValue & SQL_FN_STR_ASCII)
1307 aValue.append("ASCII,");
1308 if(nValue & SQL_FN_STR_BIT_LENGTH)
1309 aValue.append("BIT_LENGTH,");
1310 if(nValue & SQL_FN_STR_CHAR)
1311 aValue.append("CHAR,");
1312 if(nValue & SQL_FN_STR_CHAR_LENGTH)
1313 aValue.append("CHAR_LENGTH,");
1314 if(nValue & SQL_FN_STR_CHARACTER_LENGTH)
1315 aValue.append("CHARACTER_LENGTH,");
1316 if(nValue & SQL_FN_STR_CONCAT)
1317 aValue.append("CONCAT,");
1318 if(nValue & SQL_FN_STR_DIFFERENCE)
1319 aValue.append("DIFFERENCE,");
1320 if(nValue & SQL_FN_STR_INSERT)
1321 aValue.append("INSERT,");
1322 if(nValue & SQL_FN_STR_LCASE)
1323 aValue.append("LCASE,");
1324 if(nValue & SQL_FN_STR_LEFT)
1325 aValue.append("LEFT,");
1326 if(nValue & SQL_FN_STR_LENGTH)
1327 aValue.append("LENGTH,");
1328 if(nValue & SQL_FN_STR_LOCATE)
1329 aValue.append("LOCATE,");
1330 if(nValue & SQL_FN_STR_LOCATE_2)
1331 aValue.append("LOCATE_2,");
1332 if(nValue & SQL_FN_STR_LTRIM)
1333 aValue.append("LTRIM,");
1334 if(nValue & SQL_FN_STR_OCTET_LENGTH)
1335 aValue.append("OCTET_LENGTH,");
1336 if(nValue & SQL_FN_STR_POSITION)
1337 aValue.append("POSITION,");
1338 if(nValue & SQL_FN_STR_REPEAT)
1339 aValue.append("REPEAT,");
1340 if(nValue & SQL_FN_STR_REPLACE)
1341 aValue.append("REPLACE,");
1342 if(nValue & SQL_FN_STR_RIGHT)
1343 aValue.append("RIGHT,");
1344 if(nValue & SQL_FN_STR_RTRIM)
1345 aValue.append("RTRIM,");
1346 if(nValue & SQL_FN_STR_SOUNDEX)
1347 aValue.append("SOUNDEX,");
1348 if(nValue & SQL_FN_STR_SPACE)
1349 aValue.append("SPACE,");
1350 if(nValue & SQL_FN_STR_SUBSTRING)
1351 aValue.append("SUBSTRING,");
1352 if(nValue & SQL_FN_STR_UCASE)
1353 aValue.append("UCASE,");
1356 if ( !aValue.isEmpty() )
1357 aValue.setLength(aValue.getLength()-1);
1359 return aValue.makeStringAndClear();
1362 OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( )
1364 SQLUINTEGER nValue;
1365 OUStringBuffer aValue;
1366 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TIMEDATE_FUNCTIONS,nValue,*this);
1368 if(nValue & SQL_FN_TD_CURRENT_DATE)
1369 aValue.append("CURRENT_DATE,");
1370 if(nValue & SQL_FN_TD_CURRENT_TIME)
1371 aValue.append("CURRENT_TIME,");
1372 if(nValue & SQL_FN_TD_CURRENT_TIMESTAMP)
1373 aValue.append("CURRENT_TIMESTAMP,");
1374 if(nValue & SQL_FN_TD_CURDATE)
1375 aValue.append("CURDATE,");
1376 if(nValue & SQL_FN_TD_CURTIME)
1377 aValue.append("CURTIME,");
1378 if(nValue & SQL_FN_TD_DAYNAME)
1379 aValue.append("DAYNAME,");
1380 if(nValue & SQL_FN_TD_DAYOFMONTH)
1381 aValue.append("DAYOFMONTH,");
1382 if(nValue & SQL_FN_TD_DAYOFWEEK)
1383 aValue.append("DAYOFWEEK,");
1384 if(nValue & SQL_FN_TD_DAYOFYEAR)
1385 aValue.append("DAYOFYEAR,");
1386 if(nValue & SQL_FN_TD_EXTRACT)
1387 aValue.append("EXTRACT,");
1388 if(nValue & SQL_FN_TD_HOUR)
1389 aValue.append("HOUR,");
1390 if(nValue & SQL_FN_TD_MINUTE)
1391 aValue.append("MINUTE,");
1392 if(nValue & SQL_FN_TD_MONTH)
1393 aValue.append("MONTH,");
1394 if(nValue & SQL_FN_TD_MONTHNAME)
1395 aValue.append("MONTHNAME,");
1396 if(nValue & SQL_FN_TD_NOW)
1397 aValue.append("NOW,");
1398 if(nValue & SQL_FN_TD_QUARTER)
1399 aValue.append("QUARTER,");
1400 if(nValue & SQL_FN_TD_SECOND)
1401 aValue.append("SECOND,");
1402 if(nValue & SQL_FN_TD_TIMESTAMPADD)
1403 aValue.append("TIMESTAMPADD,");
1404 if(nValue & SQL_FN_TD_TIMESTAMPDIFF)
1405 aValue.append("TIMESTAMPDIFF,");
1406 if(nValue & SQL_FN_TD_WEEK)
1407 aValue.append("WEEK,");
1408 if(nValue & SQL_FN_TD_YEAR)
1409 aValue.append("YEAR,");
1411 if ( !aValue.isEmpty() )
1412 aValue.setLength(aValue.getLength()-1);
1414 return aValue.makeStringAndClear();
1417 OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( )
1419 SQLUINTEGER nValue;
1420 OUStringBuffer aValue;
1421 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SYSTEM_FUNCTIONS,nValue,*this);
1423 if(nValue & SQL_FN_SYS_DBNAME)
1424 aValue.append("DBNAME,");
1425 if(nValue & SQL_FN_SYS_IFNULL)
1426 aValue.append("IFNULL,");
1427 if(nValue & SQL_FN_SYS_USERNAME)
1428 aValue.append("USERNAME,");
1430 if ( !aValue.isEmpty() )
1431 aValue.setLength(aValue.getLength()-1);
1433 return aValue.makeStringAndClear();
1436 OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( )
1438 SQLUINTEGER nValue;
1439 OUStringBuffer aValue;
1440 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NUMERIC_FUNCTIONS,nValue,*this);
1442 if(nValue & SQL_FN_NUM_ABS)
1443 aValue.append("ABS,");
1444 if(nValue & SQL_FN_NUM_ACOS)
1445 aValue.append("ACOS,");
1446 if(nValue & SQL_FN_NUM_ASIN)
1447 aValue.append("ASIN,");
1448 if(nValue & SQL_FN_NUM_ATAN)
1449 aValue.append("ATAN,");
1450 if(nValue & SQL_FN_NUM_ATAN2)
1451 aValue.append("ATAN2,");
1452 if(nValue & SQL_FN_NUM_CEILING)
1453 aValue.append("CEILING,");
1454 if(nValue & SQL_FN_NUM_COS)
1455 aValue.append("COS,");
1456 if(nValue & SQL_FN_NUM_COT)
1457 aValue.append("COT,");
1458 if(nValue & SQL_FN_NUM_DEGREES)
1459 aValue.append("DEGREES,");
1460 if(nValue & SQL_FN_NUM_EXP)
1461 aValue.append("EXP,");
1462 if(nValue & SQL_FN_NUM_FLOOR)
1463 aValue.append("FLOOR,");
1464 if(nValue & SQL_FN_NUM_LOG)
1465 aValue.append("LOGF,");
1466 if(nValue & SQL_FN_NUM_LOG10)
1467 aValue.append("LOG10,");
1468 if(nValue & SQL_FN_NUM_MOD)
1469 aValue.append("MOD,");
1470 if(nValue & SQL_FN_NUM_PI)
1471 aValue.append("PI,");
1472 if(nValue & SQL_FN_NUM_POWER)
1473 aValue.append("POWER,");
1474 if(nValue & SQL_FN_NUM_RADIANS)
1475 aValue.append("RADIANS,");
1476 if(nValue & SQL_FN_NUM_RAND)
1477 aValue.append("RAND,");
1478 if(nValue & SQL_FN_NUM_ROUND)
1479 aValue.append("ROUND,");
1480 if(nValue & SQL_FN_NUM_SIGN)
1481 aValue.append("SIGN,");
1482 if(nValue & SQL_FN_NUM_SIN)
1483 aValue.append("SIN,");
1484 if(nValue & SQL_FN_NUM_SQRT)
1485 aValue.append("SQRT,");
1486 if(nValue & SQL_FN_NUM_TAN)
1487 aValue.append("TAN,");
1488 if(nValue & SQL_FN_NUM_TRUNCATE)
1489 aValue.append("TRUNCATE,");
1491 if ( !aValue.isEmpty() )
1492 aValue.setLength(aValue.getLength()-1);
1494 return aValue.makeStringAndClear();
1497 sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( )
1499 SQLUINTEGER nValue;
1500 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1501 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1502 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1503 "connectivity.odbc",
1504 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1505 return nValue == SQL_OSC_EXTENDED;
1508 sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( )
1510 SQLUINTEGER nValue;
1511 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1512 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1513 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1514 "connectivity.odbc",
1515 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1516 return nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED;
1519 sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( )
1521 SQLUINTEGER nValue;
1522 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1523 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1524 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1525 "connectivity.odbc",
1526 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1527 return nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED;
1530 sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( )
1532 SQLUINTEGER nValue;
1533 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
1534 return (nValue & SQL_OJ_FULL) == SQL_OJ_FULL;
1537 sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( )
1539 return supportsFullOuterJoins( );
1542 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( )
1544 SQLUSMALLINT nValue;
1545 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_GROUP_BY,nValue,*this);
1546 return nValue;
1549 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( )
1551 SQLUSMALLINT nValue;
1552 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_ORDER_BY,nValue,*this);
1553 return nValue;
1556 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( )
1558 SQLUSMALLINT nValue;
1559 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_SELECT,nValue,*this);
1560 return nValue;
1563 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( )
1565 SQLUSMALLINT nValue;
1566 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_USER_NAME_LEN,nValue,*this);
1567 return nValue;
1570 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType )
1572 SQLUINTEGER nValue;
1573 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_SENSITIVITY,nValue,*this);
1574 return (nValue & static_cast<SQLUINTEGER>(setType)) == static_cast<SQLUINTEGER>(setType);
1577 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency )
1579 SQLUINTEGER nValue;
1580 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1581 switch(setType)
1583 default:
1584 case ResultSetType::FORWARD_ONLY:
1585 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1586 break;
1587 case ResultSetType::SCROLL_INSENSITIVE:
1588 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1589 break;
1590 case ResultSetType::SCROLL_SENSITIVE:
1591 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1592 break;
1595 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1596 bool bRet = false;
1597 switch(concurrency)
1599 case ResultSetConcurrency::READ_ONLY:
1600 bRet = (nValue & SQL_CA2_READ_ONLY_CONCURRENCY) == SQL_CA2_READ_ONLY_CONCURRENCY;
1601 break;
1602 case ResultSetConcurrency::UPDATABLE:
1603 bRet = (nValue & SQL_CA2_OPT_VALUES_CONCURRENCY) == SQL_CA2_OPT_VALUES_CONCURRENCY;
1604 break;
1606 return bRet;
1609 sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType )
1611 SQLUINTEGER nValue;
1612 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1613 switch(setType)
1615 default:
1616 case ResultSetType::FORWARD_ONLY:
1617 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1618 break;
1619 case ResultSetType::SCROLL_INSENSITIVE:
1620 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1621 break;
1622 case ResultSetType::SCROLL_SENSITIVE:
1623 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1624 break;
1627 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1628 return (nValue & SQL_CA2_SENSITIVITY_UPDATES) == SQL_CA2_SENSITIVITY_UPDATES;
1631 sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType )
1633 SQLUINTEGER nValue;
1634 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1635 switch(setType)
1637 default:
1638 case ResultSetType::FORWARD_ONLY:
1639 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1640 break;
1641 case ResultSetType::SCROLL_INSENSITIVE:
1642 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1643 break;
1644 case ResultSetType::SCROLL_SENSITIVE:
1645 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1646 break;
1649 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1650 return (nValue & SQL_CA2_SENSITIVITY_DELETIONS) != SQL_CA2_SENSITIVITY_DELETIONS;
1653 sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType )
1655 SQLUINTEGER nValue;
1656 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1657 switch(setType)
1659 default:
1660 case ResultSetType::FORWARD_ONLY:
1661 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1662 break;
1663 case ResultSetType::SCROLL_INSENSITIVE:
1664 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1665 break;
1666 case ResultSetType::SCROLL_SENSITIVE:
1667 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1668 break;
1671 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1672 return (nValue & SQL_CA2_SENSITIVITY_ADDITIONS) == SQL_CA2_SENSITIVITY_ADDITIONS;
1675 sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType )
1677 return ownUpdatesAreVisible(setType);
1680 sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType )
1682 return ownDeletesAreVisible(setType);
1685 sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType )
1687 return ownInsertsAreVisible(setType);
1690 sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ )
1692 return false;
1695 sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ )
1697 return false;
1700 sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ )
1702 return false;
1705 sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( )
1707 return false;
1710 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ )
1712 return nullptr;
1716 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */