bump product version to 6.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / odbc / ODatabaseMetaData.cxx
blob1f2ba68b02a0f6f7249dbc8f205dcf44b74a4203
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 <connectivity/odbc.hxx>
29 #include <TPrivilegesResultSet.hxx>
30 #include <connectivity/dbexception.hxx>
31 #include <rtl/ustrbuf.hxx>
32 #include <sal/log.hxx>
34 using namespace connectivity::odbc;
35 using namespace com::sun::star::uno;
36 using namespace com::sun::star::lang;
37 using namespace com::sun::star::beans;
38 using namespace com::sun::star::sdbc;
40 ODatabaseMetaData::ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon)
41 : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
42 ,m_aConnectionHandle(_pHandle)
43 ,m_pConnection(_pCon)
44 ,m_bUseCatalog(true)
46 OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
47 if(!m_pConnection->isCatalogUsed())
49 osl_atomic_increment( &m_refCount );
50 try
52 m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
54 catch(SQLException& )
55 { // doesn't matter here
57 osl_atomic_decrement( &m_refCount );
61 ODatabaseMetaData::~ODatabaseMetaData()
65 Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
67 Reference< XResultSet > xRef;
68 try
70 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
71 xRef = pResult;
72 pResult->openTypeInfo();
74 catch(SQLException&)
76 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
79 return xRef;
82 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( )
84 Reference< XResultSet > xRef;
85 if(!m_bUseCatalog)
87 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
89 else
91 try
93 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
94 xRef = pResult;
95 pResult->openCatalogs();
97 catch(SQLException&)
99 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
103 return xRef;
106 OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
108 OUString aVal;
109 if ( m_bUseCatalog )
110 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_NAME_SEPARATOR,aVal,*this,m_pConnection->getTextEncoding());
112 return aVal;
115 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( )
117 Reference< XResultSet > xRef;
120 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
121 xRef = pResult;
122 pResult->openSchemas();
124 catch(SQLException&)
126 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eSchemas);
128 return xRef;
131 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
132 const Any& catalog, const OUString& schema, const OUString& table,
133 const OUString& columnNamePattern )
135 Reference< XResultSet > xRef;
138 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
139 xRef = pResult;
140 pResult->openColumnPrivileges(m_bUseCatalog ? catalog : Any(),schema,table,columnNamePattern);
142 catch(SQLException&)
144 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumnPrivileges);
146 return xRef;
149 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
150 const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern,
151 const OUString& columnNamePattern )
153 Reference< XResultSet > xRef;
156 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
157 xRef = pResult;
158 pResult->openColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,columnNamePattern);
160 catch(SQLException&)
162 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
164 return xRef;
167 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
168 const Any& catalog, const OUString& schemaPattern,
169 const OUString& tableNamePattern, const Sequence< OUString >& types )
171 Reference< XResultSet > xRef;
174 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
175 xRef = pResult;
176 pResult->openTables(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,types);
178 catch(SQLException&)
180 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
182 return xRef;
185 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
186 const Any& catalog, const OUString& schemaPattern,
187 const OUString& procedureNamePattern, const OUString& columnNamePattern )
189 Reference< XResultSet > xRef;
192 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
193 xRef = pResult;
194 pResult->openProcedureColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern,columnNamePattern);
196 catch(SQLException&)
198 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedureColumns);
200 return xRef;
203 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
204 const Any& catalog, const OUString& schemaPattern,
205 const OUString& procedureNamePattern )
207 Reference< XResultSet > xRef;
210 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
211 xRef = pResult;
212 pResult->openProcedures(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern);
214 catch(SQLException&)
216 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedures);
218 return xRef;
221 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
222 const Any& catalog, const OUString& schema, const OUString& table )
224 Reference< XResultSet > xRef;
225 bool bSuccess = false;
228 if ( !m_pConnection->preventGetVersionColumns() )
230 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
231 xRef = pResult;
232 pResult->openVersionColumns(m_bUseCatalog ? catalog : Any(),schema,table);
233 bSuccess = true;
236 catch(SQLException&)
240 if ( !bSuccess )
242 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
245 return xRef;
248 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( )
250 SQLUINTEGER nValue;
251 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_BINARY_LITERAL_LEN,nValue,*this);
252 return nValue;
255 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( )
257 SQLUINTEGER nValue;
258 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_ROW_SIZE,nValue,*this);
259 return nValue;
262 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( )
264 SQLUSMALLINT nValue;
265 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CATALOG_NAME_LEN,nValue,*this);
266 return nValue;
269 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( )
271 SQLUINTEGER nValue;
272 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CHAR_LITERAL_LEN,nValue,*this);
273 return nValue;
276 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( )
278 SQLUSMALLINT nValue;
279 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMN_NAME_LEN,nValue,*this);
280 return nValue;
283 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( )
285 SQLUSMALLINT nValue;
286 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_INDEX,nValue,*this);
287 return nValue;
290 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( )
292 SQLUSMALLINT nValue;
293 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CURSOR_NAME_LEN,nValue,*this);
294 return nValue;
297 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( )
299 SQLUSMALLINT nValue;
300 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_DRIVER_CONNECTIONS/*SQL_ACTIVE_CONNECTIONS*/,nValue,*this);
301 return nValue;
304 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( )
306 SQLUSMALLINT nValue;
307 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_TABLE,nValue,*this);
308 return nValue;
311 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( )
313 SQLUINTEGER nValue;
314 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_STATEMENT_LEN,nValue,*this);
315 return nValue;
318 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( )
320 SQLUSMALLINT nValue;
321 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLE_NAME_LEN,nValue,*this);
322 return nValue;
325 sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
327 SQLUSMALLINT nValue;
328 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLES_IN_SELECT,nValue,*this);
329 return nValue;
332 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
333 const Any& catalog, const OUString& schema, const OUString& table )
335 Reference< XResultSet > xRef;
338 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
339 xRef = pResult;
340 pResult->openExportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
342 catch(SQLException&)
344 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eExportedKeys);
346 return xRef;
349 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
350 const Any& catalog, const OUString& schema, const OUString& table )
352 Reference< XResultSet > xRef;
355 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
356 xRef = pResult;
357 pResult->openImportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
359 catch(SQLException&)
361 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eImportedKeys);
363 return xRef;
366 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
367 const Any& catalog, const OUString& schema, const OUString& table )
369 Reference< XResultSet > xRef;
372 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
373 xRef = pResult;
374 pResult->openPrimaryKeys(m_bUseCatalog ? catalog : Any(),schema,table);
376 catch(SQLException&)
378 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::ePrimaryKeys);
380 return xRef;
383 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
384 const Any& catalog, const OUString& schema, const OUString& table,
385 sal_Bool unique, sal_Bool approximate )
387 Reference< XResultSet > xRef;
390 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
391 xRef = pResult;
392 pResult->openIndexInfo(m_bUseCatalog ? catalog : Any(),schema,table,unique,approximate);
394 catch(SQLException&)
396 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eIndexInfo);
398 return xRef;
401 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
402 const Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope,
403 sal_Bool nullable )
405 Reference< XResultSet > xRef;
408 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
409 xRef = pResult;
410 pResult->openBestRowIdentifier(m_bUseCatalog ? catalog : Any(),schema,table,scope,nullable);
412 catch(SQLException&)
414 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eBestRowIdentifier);
416 return xRef;
419 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
420 const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern )
422 if ( m_pConnection->isIgnoreDriverPrivilegesEnabled() )
424 return new OResultSetPrivileges(this,catalog,schemaPattern,tableNamePattern);
426 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
427 Reference< XResultSet > xRef = pResult;
428 pResult->openTablePrivileges(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern);
429 return xRef;
432 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
433 const Any& primaryCatalog, const OUString& primarySchema,
434 const OUString& primaryTable, const Any& foreignCatalog,
435 const OUString& foreignSchema, const OUString& foreignTable )
437 Reference< XResultSet > xRef;
440 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
441 xRef = pResult;
442 pResult->openForeignKeys(m_bUseCatalog ? primaryCatalog : Any(),primarySchema.toChar() == '%' ? &primarySchema : nullptr,&primaryTable,
443 m_bUseCatalog ? foreignCatalog : Any(), foreignSchema.toChar() == '%' ? &foreignSchema : nullptr,&foreignTable);
445 catch(SQLException&)
447 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCrossReference);
449 return xRef;
452 sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( )
454 OUString aVal;
455 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_ROW_SIZE_INCLUDES_LONG,aVal,*this,m_pConnection->getTextEncoding());
456 return aVal.toChar() == 'Y';
459 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( )
461 SQLUSMALLINT nValue;
462 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
463 return nValue == SQL_IC_LOWER;
466 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( )
468 SQLUSMALLINT nValue;
469 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
470 return nValue == SQL_IC_LOWER;
473 bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
475 SQLUSMALLINT nValue;
476 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
477 return nValue == SQL_IC_MIXED;
480 sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( )
482 SQLUSMALLINT nValue;
483 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
484 return nValue == SQL_IC_MIXED;
487 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( )
489 SQLUSMALLINT nValue;
490 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
491 return nValue == SQL_IC_UPPER;
494 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( )
496 SQLUSMALLINT nValue;
497 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
498 return nValue == SQL_IC_UPPER;
501 bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
503 SQLUINTEGER nValue;
504 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this);
505 return (nValue & SQL_AT_ADD_COLUMN) == SQL_AT_ADD_COLUMN;
508 bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
510 SQLUINTEGER nValue;
511 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this);
512 return ((nValue & SQL_AT_DROP_COLUMN) == SQL_AT_DROP_COLUMN) ||
513 ((nValue & SQL_AT_DROP_COLUMN_CASCADE) == SQL_AT_DROP_COLUMN_CASCADE) ||
514 ((nValue & SQL_AT_DROP_COLUMN_RESTRICT) == SQL_AT_DROP_COLUMN_RESTRICT);
517 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( )
519 SQLUINTEGER nValue;
520 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_INDEX_SIZE,nValue,*this);
521 return nValue;
524 sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( )
526 SQLUSMALLINT nValue;
527 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NON_NULLABLE_COLUMNS,nValue,*this);
528 return nValue == SQL_NNC_NON_NULL;
531 OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( )
533 OUString aVal;
534 if(m_bUseCatalog)
535 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_TERM,aVal,*this,m_pConnection->getTextEncoding());
536 return aVal;
539 OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
541 OUString aVal;
542 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_QUOTE_CHAR,aVal,*this,m_pConnection->getTextEncoding());
543 return aVal;
546 OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( )
548 OUString aVal;
549 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SPECIAL_CHARACTERS,aVal,*this,m_pConnection->getTextEncoding());
550 return aVal;
553 sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( )
555 SQLUSMALLINT nValue;
556 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
557 return nValue != SQL_CN_NONE;
560 bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
562 SQLUSMALLINT nValue=0;
563 if ( m_bUseCatalog )
564 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_LOCATION,nValue,*this);
565 return nValue == SQL_CL_START;
568 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( )
570 SQLUSMALLINT nValue;
571 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
572 return nValue == SQL_TC_DDL_IGNORE;
575 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( )
577 SQLUSMALLINT nValue;
578 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
579 return nValue == SQL_TC_DDL_COMMIT;
582 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( )
584 SQLUSMALLINT nValue;
585 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
586 return nValue == SQL_TC_DML;
589 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( )
591 SQLUSMALLINT nValue;
592 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
593 return nValue == SQL_TC_ALL;
596 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( )
598 SQLUINTEGER nValue;
599 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
600 return (nValue & SQL_CA1_POS_DELETE) == SQL_CA1_POS_DELETE;
603 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( )
605 SQLUINTEGER nValue;
606 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
607 return (nValue & SQL_CA1_POS_UPDATE) == SQL_CA1_POS_UPDATE;
610 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( )
612 SQLUSMALLINT nValue;
613 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
614 return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
617 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( )
619 SQLUSMALLINT nValue;
620 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
621 return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
624 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( )
626 SQLUSMALLINT nValue;
627 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
628 return nValue == SQL_CB_PRESERVE;
631 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( )
633 SQLUSMALLINT nValue;
634 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
635 return nValue == SQL_CB_PRESERVE;
638 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level )
640 SQLUINTEGER nValue;
641 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_ISOLATION_OPTION,nValue,*this);
642 return (nValue & static_cast<SQLUINTEGER>(level)) == static_cast<SQLUINTEGER>(level);
645 bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
647 SQLUINTEGER nValue;
648 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
649 return (nValue & SQL_SU_DML_STATEMENTS) == SQL_SU_DML_STATEMENTS;
652 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( )
654 SQLUINTEGER nValue;
655 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
656 return static_cast<bool>(nValue & SQL_SC_SQL92_FULL);
659 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( )
661 SQLUINTEGER nValue;
662 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
663 return static_cast<bool>(nValue &SQL_SC_SQL92_ENTRY);
666 sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( )
668 OUString aStr;
669 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_INTEGRITY,aStr,*this,m_pConnection->getTextEncoding());
670 return aStr.toChar() == 'Y';
673 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( )
675 SQLUINTEGER nValue;
676 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
677 return (nValue & SQL_SU_INDEX_DEFINITION) == SQL_SU_INDEX_DEFINITION;
680 bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
682 SQLUINTEGER nValue;
683 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
684 return (nValue & SQL_SU_TABLE_DEFINITION) == SQL_SU_TABLE_DEFINITION;
687 bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
689 SQLUINTEGER nValue=0;
690 if(m_bUseCatalog)
691 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
692 return (nValue & SQL_CU_TABLE_DEFINITION) == SQL_CU_TABLE_DEFINITION;
695 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( )
697 SQLUINTEGER nValue=0;
698 if(m_bUseCatalog)
699 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
700 return (nValue & SQL_CU_INDEX_DEFINITION) == SQL_CU_INDEX_DEFINITION;
703 bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
705 SQLUINTEGER nValue=0;
706 if(m_bUseCatalog)
707 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
708 return (nValue & SQL_CU_DML_STATEMENTS) == SQL_CU_DML_STATEMENTS;
711 sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( )
713 SQLUINTEGER nValue;
714 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
715 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);
718 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( )
720 Reference< XResultSet > xRef;
723 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
724 xRef = pResult;
725 pResult->openTablesTypes();
727 catch(SQLException&)
729 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
731 return xRef;
734 sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
736 SQLUSMALLINT nValue;
737 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CONCURRENT_ACTIVITIES,nValue,*this);
738 return nValue;
741 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( )
743 SQLUSMALLINT nValue;
744 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_PROCEDURE_NAME_LEN,nValue,*this);
745 return nValue;
748 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( )
750 SQLUSMALLINT nValue;
751 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_SCHEMA_NAME_LEN,nValue,*this);
752 return nValue;
755 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( )
757 SQLUSMALLINT nValue;
758 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
759 return nValue != SQL_TC_NONE;
762 sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( )
764 OUString aValue;
765 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ACCESSIBLE_PROCEDURES,aValue,*this,m_pConnection->getTextEncoding());
766 return aValue.toChar() == 'Y';
769 sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( )
771 OUString aValue;
772 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_PROCEDURES,aValue,*this,m_pConnection->getTextEncoding());
773 return aValue.toChar() == 'Y';
776 sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( )
778 SQLUINTEGER nValue;
779 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
780 return (nValue & SQL_CA1_POSITIONED_UPDATE) == SQL_CA1_POSITIONED_UPDATE;
783 sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( )
785 OUString aValue;
786 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ACCESSIBLE_TABLES,aValue,*this,m_pConnection->getTextEncoding());
787 return aValue.toChar() == 'Y';
790 sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( )
792 return m_pConnection->isReadOnly();
795 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( )
797 SQLUSMALLINT nValue;
798 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this);
799 return nValue == SQL_FILE_CATALOG;
802 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( )
804 SQLUSMALLINT nValue;
805 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this);
806 return nValue == SQL_FILE_TABLE;
809 sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( )
811 SQLUINTEGER nValue;
812 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_FUNCTIONS,nValue,*this);
813 return (nValue & SQL_FN_CVT_CONVERT) == SQL_FN_CVT_CONVERT;
816 sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( )
818 SQLUSMALLINT nValue;
819 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONCAT_NULL_BEHAVIOR,nValue,*this);
820 return nValue == SQL_CB_NULL;
823 sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( )
825 OUString aValue;
826 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_COLUMN_ALIAS,aValue,*this,m_pConnection->getTextEncoding());
827 return aValue.toChar() == 'Y';
830 sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( )
832 SQLUSMALLINT nValue;
833 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
834 return nValue != SQL_CN_NONE;
837 sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType )
839 if(fromType == toType)
840 return true;
842 SQLUINTEGER nValue=0;
843 switch(fromType)
845 case DataType::BIT:
846 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BIT,nValue,*this);
847 break;
848 case DataType::TINYINT:
849 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TINYINT,nValue,*this);
850 break;
851 case DataType::SMALLINT:
852 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_SMALLINT,nValue,*this);
853 break;
854 case DataType::INTEGER:
855 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_INTEGER,nValue,*this);
856 break;
857 case DataType::BIGINT:
858 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BIGINT,nValue,*this);
859 break;
860 case DataType::FLOAT:
861 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_FLOAT,nValue,*this);
862 break;
863 case DataType::REAL:
864 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_REAL,nValue,*this);
865 break;
866 case DataType::DOUBLE:
867 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DOUBLE,nValue,*this);
868 break;
869 case DataType::NUMERIC:
870 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_NUMERIC,nValue,*this);
871 break;
872 case DataType::DECIMAL:
873 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DECIMAL,nValue,*this);
874 break;
875 case DataType::CHAR:
876 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_CHAR,nValue,*this);
877 break;
878 case DataType::VARCHAR:
879 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARCHAR,nValue,*this);
880 break;
881 case DataType::LONGVARCHAR:
882 case DataType::CLOB:
883 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARCHAR,nValue,*this);
884 break;
885 case DataType::DATE:
886 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DATE,nValue,*this);
887 break;
888 case DataType::TIME:
889 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TIME,nValue,*this);
890 break;
891 case DataType::TIMESTAMP:
892 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TIMESTAMP,nValue,*this);
893 break;
894 case DataType::BINARY:
895 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BINARY,nValue,*this);
896 break;
897 case DataType::VARBINARY:
898 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARBINARY,nValue,*this);
899 break;
900 case DataType::LONGVARBINARY:
901 case DataType::BLOB:
902 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARBINARY,nValue,*this);
903 break;
904 case DataType::SQLNULL:
905 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
906 break;
907 case DataType::OTHER:
908 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
909 break;
910 case DataType::OBJECT:
911 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
912 break;
913 case DataType::DISTINCT:
914 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
915 break;
916 case DataType::STRUCT:
917 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
918 break;
919 case DataType::ARRAY:
920 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
921 break;
922 case DataType::REF:
923 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
924 break;
926 bool bConvert = false;
927 switch(toType)
929 case DataType::BIT:
930 bConvert = (nValue & SQL_CVT_BIT) == SQL_CVT_BIT;
931 break;
932 case DataType::TINYINT:
933 bConvert = (nValue & SQL_CVT_TINYINT) == SQL_CVT_TINYINT;
934 break;
935 case DataType::SMALLINT:
936 bConvert = (nValue & SQL_CVT_SMALLINT) == SQL_CVT_SMALLINT;
937 break;
938 case DataType::INTEGER:
939 bConvert = (nValue & SQL_CVT_INTEGER) == SQL_CVT_INTEGER;
940 break;
941 case DataType::BIGINT:
942 bConvert = (nValue & SQL_CVT_BIGINT) == SQL_CVT_BIGINT;
943 break;
944 case DataType::FLOAT:
945 bConvert = (nValue & SQL_CVT_FLOAT) == SQL_CVT_FLOAT;
946 break;
947 case DataType::REAL:
948 bConvert = (nValue & SQL_CVT_REAL) == SQL_CVT_REAL;
949 break;
950 case DataType::DOUBLE:
951 bConvert = (nValue & SQL_CVT_DOUBLE) == SQL_CVT_DOUBLE;
952 break;
953 case DataType::NUMERIC:
954 bConvert = (nValue & SQL_CVT_NUMERIC) == SQL_CVT_NUMERIC;
955 break;
956 case DataType::DECIMAL:
957 bConvert = (nValue & SQL_CVT_DECIMAL) == SQL_CVT_DECIMAL;
958 break;
959 case DataType::CHAR:
960 bConvert = (nValue & SQL_CVT_CHAR) == SQL_CVT_CHAR;
961 break;
962 case DataType::VARCHAR:
963 bConvert = (nValue & SQL_CVT_VARCHAR) == SQL_CVT_VARCHAR;
964 break;
965 case DataType::LONGVARCHAR:
966 case DataType::CLOB:
967 bConvert = (nValue & SQL_CVT_LONGVARCHAR) == SQL_CVT_LONGVARCHAR;
968 break;
969 case DataType::DATE:
970 bConvert = (nValue & SQL_CVT_DATE) == SQL_CVT_DATE;
971 break;
972 case DataType::TIME:
973 bConvert = (nValue & SQL_CVT_TIME) == SQL_CVT_TIME;
974 break;
975 case DataType::TIMESTAMP:
976 bConvert = (nValue & SQL_CVT_TIMESTAMP) == SQL_CVT_TIMESTAMP;
977 break;
978 case DataType::BINARY:
979 bConvert = (nValue & SQL_CVT_BINARY) == SQL_CVT_BINARY;
980 break;
981 case DataType::VARBINARY:
982 bConvert = (nValue & SQL_CVT_VARBINARY) == SQL_CVT_VARBINARY;
983 break;
984 case DataType::LONGVARBINARY:
985 case DataType::BLOB:
986 bConvert = (nValue & SQL_CVT_LONGVARBINARY) == SQL_CVT_LONGVARBINARY;
987 break;
990 return bConvert;
993 sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( )
995 OUString aValue;
996 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_EXPRESSIONS_IN_ORDERBY,aValue,*this,m_pConnection->getTextEncoding());
997 return aValue.toChar() == 'Y';
1000 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( )
1002 SQLUSMALLINT nValue;
1003 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1004 return nValue != SQL_GB_NOT_SUPPORTED;
1007 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( )
1009 SQLUSMALLINT nValue;
1010 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1011 return nValue != SQL_GB_GROUP_BY_CONTAINS_SELECT;
1014 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( )
1016 SQLUSMALLINT nValue;
1017 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1018 return nValue == SQL_GB_NO_RELATION;
1021 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( )
1023 OUString aValue;
1024 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MULTIPLE_ACTIVE_TXN,aValue,*this,m_pConnection->getTextEncoding());
1025 return aValue.toChar() == 'Y';
1028 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( )
1030 OUString aValue;
1031 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MULT_RESULT_SETS,aValue,*this,m_pConnection->getTextEncoding());
1032 return aValue.toChar() == 'Y';
1035 sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( )
1037 OUString aValue;
1038 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_LIKE_ESCAPE_CLAUSE,aValue,*this,m_pConnection->getTextEncoding());
1039 return aValue.toChar() == 'Y';
1042 sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( )
1044 OUString aValue;
1045 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ORDER_BY_COLUMNS_IN_SELECT,aValue,*this,m_pConnection->getTextEncoding());
1046 return aValue.toChar() == 'N';
1049 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( )
1051 SQLUINTEGER nValue;
1052 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_UNION,nValue,*this);
1053 return (nValue & SQL_U_UNION) == SQL_U_UNION;
1056 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( )
1058 SQLUINTEGER nValue;
1059 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_UNION,nValue,*this);
1060 return (nValue & SQL_U_UNION_ALL) == SQL_U_UNION_ALL;
1063 sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( )
1065 SQLUSMALLINT nValue;
1066 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
1067 return nValue == SQL_IC_MIXED;
1070 bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
1072 SQLUSMALLINT nValue;
1073 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
1074 return nValue == SQL_IC_MIXED;
1077 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( )
1079 SQLUSMALLINT nValue;
1080 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1081 return nValue == SQL_NC_END;
1084 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( )
1086 SQLUSMALLINT nValue;
1087 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1088 return nValue == SQL_NC_START;
1091 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( )
1093 SQLUSMALLINT nValue;
1094 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1095 return nValue == SQL_NC_HIGH;
1098 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( )
1100 SQLUSMALLINT nValue;
1101 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1102 return nValue == SQL_NC_LOW;
1105 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( )
1107 SQLUINTEGER nValue;
1108 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
1109 return (nValue & SQL_SU_PROCEDURE_INVOCATION) == SQL_SU_PROCEDURE_INVOCATION;
1112 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( )
1114 SQLUINTEGER nValue;
1115 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
1116 return (nValue & SQL_SU_PRIVILEGE_DEFINITION) == SQL_SU_PRIVILEGE_DEFINITION;
1119 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( )
1121 SQLUINTEGER nValue=0;
1122 if(m_bUseCatalog)
1123 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
1124 return (nValue & SQL_CU_PROCEDURE_INVOCATION) == SQL_CU_PROCEDURE_INVOCATION;
1127 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( )
1129 SQLUINTEGER nValue=0;
1130 if(m_bUseCatalog)
1131 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
1132 return (nValue & SQL_CU_PRIVILEGE_DEFINITION) == SQL_CU_PRIVILEGE_DEFINITION;
1135 sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( )
1137 SQLUINTEGER nValue;
1138 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1139 return (nValue & SQL_SQ_CORRELATED_SUBQUERIES) == SQL_SQ_CORRELATED_SUBQUERIES;
1142 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( )
1144 SQLUINTEGER nValue;
1145 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1146 return (nValue & SQL_SQ_COMPARISON) == SQL_SQ_COMPARISON;
1149 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( )
1151 SQLUINTEGER nValue;
1152 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1153 return (nValue & SQL_SQ_EXISTS) == SQL_SQ_EXISTS;
1156 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( )
1158 SQLUINTEGER nValue;
1159 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1160 return (nValue & SQL_SQ_IN) == SQL_SQ_IN;
1163 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( )
1165 SQLUINTEGER nValue;
1166 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1167 return (nValue & SQL_SQ_QUANTIFIED) == SQL_SQ_QUANTIFIED;
1170 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( )
1172 SQLUINTEGER nValue;
1173 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
1174 return static_cast<bool>(nValue & SQL_SC_SQL92_INTERMEDIATE);
1177 OUString ODatabaseMetaData::getURLImpl()
1179 OUString aValue;
1180 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DATA_SOURCE_NAME,aValue,*this,m_pConnection->getTextEncoding());
1181 return aValue;
1184 OUString SAL_CALL ODatabaseMetaData::getURL( )
1186 OUString aValue = m_pConnection->getURL();
1187 if ( aValue.isEmpty() )
1189 aValue = "sdbc:odbc:" + getURLImpl();
1191 return aValue;
1194 OUString SAL_CALL ODatabaseMetaData::getUserName( )
1196 OUString aValue;
1197 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_USER_NAME,aValue,*this,m_pConnection->getTextEncoding());
1198 return aValue;
1201 OUString SAL_CALL ODatabaseMetaData::getDriverName( )
1203 OUString aValue;
1204 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_NAME,aValue,*this,m_pConnection->getTextEncoding());
1205 return aValue;
1208 OUString SAL_CALL ODatabaseMetaData::getDriverVersion()
1210 OUString aValue;
1211 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_ODBC_VER,aValue,*this,m_pConnection->getTextEncoding());
1212 return aValue;
1215 OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( )
1217 OUString aValue;
1218 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1219 return aValue;
1222 OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( )
1224 OUString aValue;
1225 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DBMS_NAME,aValue,*this,m_pConnection->getTextEncoding());
1226 return aValue;
1229 OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( )
1231 OUString aValue;
1232 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_PROCEDURE_TERM,aValue,*this,m_pConnection->getTextEncoding());
1233 return aValue;
1236 OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( )
1238 OUString aValue;
1239 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_TERM,aValue,*this,m_pConnection->getTextEncoding());
1240 return aValue;
1243 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) try
1245 OUString aValue;
1246 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1247 return aValue.copy(0,aValue.indexOf('.')).toInt32();
1249 catch (const SQLException &)
1251 return 0;
1254 sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( )
1256 SQLUINTEGER nValue;
1257 sal_Int32 nValueTranslated;
1258 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DEFAULT_TXN_ISOLATION,nValue,*this);
1259 switch(nValue)
1261 case SQL_TXN_READ_UNCOMMITTED:
1262 nValueTranslated = css::sdbc::TransactionIsolation::READ_UNCOMMITTED;
1263 break;
1264 case SQL_TXN_READ_COMMITTED:
1265 nValueTranslated = css::sdbc::TransactionIsolation::READ_COMMITTED;
1266 break;
1267 case SQL_TXN_REPEATABLE_READ:
1268 nValueTranslated = css::sdbc::TransactionIsolation::REPEATABLE_READ;
1269 break;
1270 case SQL_TXN_SERIALIZABLE:
1271 nValueTranslated = css::sdbc::TransactionIsolation::SERIALIZABLE;
1272 break;
1273 default:
1274 nValueTranslated = 0;
1276 return nValueTranslated;
1279 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) try
1281 OUString aValue;
1282 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1283 return aValue.copy(0,aValue.lastIndexOf('.')).toInt32();
1285 catch (const SQLException &)
1287 return 0;
1290 OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( )
1292 OUString aValue;
1293 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_KEYWORDS,aValue,*this,m_pConnection->getTextEncoding());
1294 return aValue;
1297 OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( )
1299 OUString aValue;
1300 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SEARCH_PATTERN_ESCAPE,aValue,*this,m_pConnection->getTextEncoding());
1301 return aValue;
1304 OUString SAL_CALL ODatabaseMetaData::getStringFunctions( )
1306 SQLUINTEGER nValue;
1307 OUStringBuffer aValue;
1308 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_STRING_FUNCTIONS,nValue,*this);
1309 if(nValue & SQL_FN_STR_ASCII)
1310 aValue.append("ASCII,");
1311 if(nValue & SQL_FN_STR_BIT_LENGTH)
1312 aValue.append("BIT_LENGTH,");
1313 if(nValue & SQL_FN_STR_CHAR)
1314 aValue.append("CHAR,");
1315 if(nValue & SQL_FN_STR_CHAR_LENGTH)
1316 aValue.append("CHAR_LENGTH,");
1317 if(nValue & SQL_FN_STR_CHARACTER_LENGTH)
1318 aValue.append("CHARACTER_LENGTH,");
1319 if(nValue & SQL_FN_STR_CONCAT)
1320 aValue.append("CONCAT,");
1321 if(nValue & SQL_FN_STR_DIFFERENCE)
1322 aValue.append("DIFFERENCE,");
1323 if(nValue & SQL_FN_STR_INSERT)
1324 aValue.append("INSERT,");
1325 if(nValue & SQL_FN_STR_LCASE)
1326 aValue.append("LCASE,");
1327 if(nValue & SQL_FN_STR_LEFT)
1328 aValue.append("LEFT,");
1329 if(nValue & SQL_FN_STR_LENGTH)
1330 aValue.append("LENGTH,");
1331 if(nValue & SQL_FN_STR_LOCATE)
1332 aValue.append("LOCATE,");
1333 if(nValue & SQL_FN_STR_LOCATE_2)
1334 aValue.append("LOCATE_2,");
1335 if(nValue & SQL_FN_STR_LTRIM)
1336 aValue.append("LTRIM,");
1337 if(nValue & SQL_FN_STR_OCTET_LENGTH)
1338 aValue.append("OCTET_LENGTH,");
1339 if(nValue & SQL_FN_STR_POSITION)
1340 aValue.append("POSITION,");
1341 if(nValue & SQL_FN_STR_REPEAT)
1342 aValue.append("REPEAT,");
1343 if(nValue & SQL_FN_STR_REPLACE)
1344 aValue.append("REPLACE,");
1345 if(nValue & SQL_FN_STR_RIGHT)
1346 aValue.append("RIGHT,");
1347 if(nValue & SQL_FN_STR_RTRIM)
1348 aValue.append("RTRIM,");
1349 if(nValue & SQL_FN_STR_SOUNDEX)
1350 aValue.append("SOUNDEX,");
1351 if(nValue & SQL_FN_STR_SPACE)
1352 aValue.append("SPACE,");
1353 if(nValue & SQL_FN_STR_SUBSTRING)
1354 aValue.append("SUBSTRING,");
1355 if(nValue & SQL_FN_STR_UCASE)
1356 aValue.append("UCASE,");
1359 if ( !aValue.isEmpty() )
1360 aValue.setLength(aValue.getLength()-1);
1362 return aValue.makeStringAndClear();
1365 OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( )
1367 SQLUINTEGER nValue;
1368 OUStringBuffer aValue;
1369 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TIMEDATE_FUNCTIONS,nValue,*this);
1371 if(nValue & SQL_FN_TD_CURRENT_DATE)
1372 aValue.append("CURRENT_DATE,");
1373 if(nValue & SQL_FN_TD_CURRENT_TIME)
1374 aValue.append("CURRENT_TIME,");
1375 if(nValue & SQL_FN_TD_CURRENT_TIMESTAMP)
1376 aValue.append("CURRENT_TIMESTAMP,");
1377 if(nValue & SQL_FN_TD_CURDATE)
1378 aValue.append("CURDATE,");
1379 if(nValue & SQL_FN_TD_CURTIME)
1380 aValue.append("CURTIME,");
1381 if(nValue & SQL_FN_TD_DAYNAME)
1382 aValue.append("DAYNAME,");
1383 if(nValue & SQL_FN_TD_DAYOFMONTH)
1384 aValue.append("DAYOFMONTH,");
1385 if(nValue & SQL_FN_TD_DAYOFWEEK)
1386 aValue.append("DAYOFWEEK,");
1387 if(nValue & SQL_FN_TD_DAYOFYEAR)
1388 aValue.append("DAYOFYEAR,");
1389 if(nValue & SQL_FN_TD_EXTRACT)
1390 aValue.append("EXTRACT,");
1391 if(nValue & SQL_FN_TD_HOUR)
1392 aValue.append("HOUR,");
1393 if(nValue & SQL_FN_TD_MINUTE)
1394 aValue.append("MINUTE,");
1395 if(nValue & SQL_FN_TD_MONTH)
1396 aValue.append("MONTH,");
1397 if(nValue & SQL_FN_TD_MONTHNAME)
1398 aValue.append("MONTHNAME,");
1399 if(nValue & SQL_FN_TD_NOW)
1400 aValue.append("NOW,");
1401 if(nValue & SQL_FN_TD_QUARTER)
1402 aValue.append("QUARTER,");
1403 if(nValue & SQL_FN_TD_SECOND)
1404 aValue.append("SECOND,");
1405 if(nValue & SQL_FN_TD_TIMESTAMPADD)
1406 aValue.append("TIMESTAMPADD,");
1407 if(nValue & SQL_FN_TD_TIMESTAMPDIFF)
1408 aValue.append("TIMESTAMPDIFF,");
1409 if(nValue & SQL_FN_TD_WEEK)
1410 aValue.append("WEEK,");
1411 if(nValue & SQL_FN_TD_YEAR)
1412 aValue.append("YEAR,");
1414 if ( !aValue.isEmpty() )
1415 aValue.setLength(aValue.getLength()-1);
1417 return aValue.makeStringAndClear();
1420 OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( )
1422 SQLUINTEGER nValue;
1423 OUStringBuffer aValue;
1424 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SYSTEM_FUNCTIONS,nValue,*this);
1426 if(nValue & SQL_FN_SYS_DBNAME)
1427 aValue.append("DBNAME,");
1428 if(nValue & SQL_FN_SYS_IFNULL)
1429 aValue.append("IFNULL,");
1430 if(nValue & SQL_FN_SYS_USERNAME)
1431 aValue.append("USERNAME,");
1433 if ( !aValue.isEmpty() )
1434 aValue.setLength(aValue.getLength()-1);
1436 return aValue.makeStringAndClear();
1439 OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( )
1441 SQLUINTEGER nValue;
1442 OUStringBuffer aValue;
1443 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NUMERIC_FUNCTIONS,nValue,*this);
1445 if(nValue & SQL_FN_NUM_ABS)
1446 aValue.append("ABS,");
1447 if(nValue & SQL_FN_NUM_ACOS)
1448 aValue.append("ACOS,");
1449 if(nValue & SQL_FN_NUM_ASIN)
1450 aValue.append("ASIN,");
1451 if(nValue & SQL_FN_NUM_ATAN)
1452 aValue.append("ATAN,");
1453 if(nValue & SQL_FN_NUM_ATAN2)
1454 aValue.append("ATAN2,");
1455 if(nValue & SQL_FN_NUM_CEILING)
1456 aValue.append("CEILING,");
1457 if(nValue & SQL_FN_NUM_COS)
1458 aValue.append("COS,");
1459 if(nValue & SQL_FN_NUM_COT)
1460 aValue.append("COT,");
1461 if(nValue & SQL_FN_NUM_DEGREES)
1462 aValue.append("DEGREES,");
1463 if(nValue & SQL_FN_NUM_EXP)
1464 aValue.append("EXP,");
1465 if(nValue & SQL_FN_NUM_FLOOR)
1466 aValue.append("FLOOR,");
1467 if(nValue & SQL_FN_NUM_LOG)
1468 aValue.append("LOGF,");
1469 if(nValue & SQL_FN_NUM_LOG10)
1470 aValue.append("LOG10,");
1471 if(nValue & SQL_FN_NUM_MOD)
1472 aValue.append("MOD,");
1473 if(nValue & SQL_FN_NUM_PI)
1474 aValue.append("PI,");
1475 if(nValue & SQL_FN_NUM_POWER)
1476 aValue.append("POWER,");
1477 if(nValue & SQL_FN_NUM_RADIANS)
1478 aValue.append("RADIANS,");
1479 if(nValue & SQL_FN_NUM_RAND)
1480 aValue.append("RAND,");
1481 if(nValue & SQL_FN_NUM_ROUND)
1482 aValue.append("ROUND,");
1483 if(nValue & SQL_FN_NUM_SIGN)
1484 aValue.append("SIGN,");
1485 if(nValue & SQL_FN_NUM_SIN)
1486 aValue.append("SIN,");
1487 if(nValue & SQL_FN_NUM_SQRT)
1488 aValue.append("SQRT,");
1489 if(nValue & SQL_FN_NUM_TAN)
1490 aValue.append("TAN,");
1491 if(nValue & SQL_FN_NUM_TRUNCATE)
1492 aValue.append("TRUNCATE,");
1494 if ( !aValue.isEmpty() )
1495 aValue.setLength(aValue.getLength()-1);
1497 return aValue.makeStringAndClear();
1500 sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( )
1502 SQLUINTEGER nValue;
1503 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1504 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1505 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1506 "connectivity.odbc",
1507 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1508 return nValue == SQL_OSC_EXTENDED;
1511 sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( )
1513 SQLUINTEGER nValue;
1514 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1515 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1516 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1517 "connectivity.odbc",
1518 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1519 return nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED;
1522 sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( )
1524 SQLUINTEGER nValue;
1525 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1526 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1527 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1528 "connectivity.odbc",
1529 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1530 return nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED;
1533 sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( )
1535 SQLUINTEGER nValue;
1536 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
1537 return (nValue & SQL_OJ_FULL) == SQL_OJ_FULL;
1540 sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( )
1542 return supportsFullOuterJoins( );
1545 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( )
1547 SQLUSMALLINT nValue;
1548 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_GROUP_BY,nValue,*this);
1549 return nValue;
1552 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( )
1554 SQLUSMALLINT nValue;
1555 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_ORDER_BY,nValue,*this);
1556 return nValue;
1559 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( )
1561 SQLUSMALLINT nValue;
1562 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_SELECT,nValue,*this);
1563 return nValue;
1566 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( )
1568 SQLUSMALLINT nValue;
1569 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_USER_NAME_LEN,nValue,*this);
1570 return nValue;
1573 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType )
1575 SQLUINTEGER nValue;
1576 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_SENSITIVITY,nValue,*this);
1577 return (nValue & static_cast<SQLUINTEGER>(setType)) == static_cast<SQLUINTEGER>(setType);
1580 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency )
1582 SQLUINTEGER nValue;
1583 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1584 switch(setType)
1586 default:
1587 case ResultSetType::FORWARD_ONLY:
1588 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1589 break;
1590 case ResultSetType::SCROLL_INSENSITIVE:
1591 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1592 break;
1593 case ResultSetType::SCROLL_SENSITIVE:
1594 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1595 break;
1598 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1599 bool bRet = false;
1600 switch(concurrency)
1602 case ResultSetConcurrency::READ_ONLY:
1603 bRet = (nValue & SQL_CA2_READ_ONLY_CONCURRENCY) == SQL_CA2_READ_ONLY_CONCURRENCY;
1604 break;
1605 case ResultSetConcurrency::UPDATABLE:
1606 bRet = (nValue & SQL_CA2_OPT_VALUES_CONCURRENCY) == SQL_CA2_OPT_VALUES_CONCURRENCY;
1607 break;
1609 return bRet;
1612 sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType )
1614 SQLUINTEGER nValue;
1615 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1616 switch(setType)
1618 default:
1619 case ResultSetType::FORWARD_ONLY:
1620 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1621 break;
1622 case ResultSetType::SCROLL_INSENSITIVE:
1623 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1624 break;
1625 case ResultSetType::SCROLL_SENSITIVE:
1626 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1627 break;
1630 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1631 return (nValue & SQL_CA2_SENSITIVITY_UPDATES) == SQL_CA2_SENSITIVITY_UPDATES;
1634 sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType )
1636 SQLUINTEGER nValue;
1637 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1638 switch(setType)
1640 default:
1641 case ResultSetType::FORWARD_ONLY:
1642 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1643 break;
1644 case ResultSetType::SCROLL_INSENSITIVE:
1645 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1646 break;
1647 case ResultSetType::SCROLL_SENSITIVE:
1648 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1649 break;
1652 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1653 return (nValue & SQL_CA2_SENSITIVITY_DELETIONS) != SQL_CA2_SENSITIVITY_DELETIONS;
1656 sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType )
1658 SQLUINTEGER nValue;
1659 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1660 switch(setType)
1662 default:
1663 case ResultSetType::FORWARD_ONLY:
1664 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1665 break;
1666 case ResultSetType::SCROLL_INSENSITIVE:
1667 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1668 break;
1669 case ResultSetType::SCROLL_SENSITIVE:
1670 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1671 break;
1674 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1675 return (nValue & SQL_CA2_SENSITIVITY_ADDITIONS) == SQL_CA2_SENSITIVITY_ADDITIONS;
1678 sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType )
1680 return ownUpdatesAreVisible(setType);
1683 sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType )
1685 return ownDeletesAreVisible(setType);
1688 sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType )
1690 return ownInsertsAreVisible(setType);
1693 sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ )
1695 return false;
1698 sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ )
1700 return false;
1703 sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ )
1705 return false;
1708 sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( )
1710 return false;
1713 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ )
1715 return nullptr;
1719 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */