Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / odbc / ODatabaseMetaData.cxx
blob6a985441daefa7962896dad6df9a818486f89ae2
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 "odbc/OFunctiondefs.hxx"
29 #include "stdio.h"
30 #include "TPrivilegesResultSet.hxx"
31 #include <connectivity/dbexception.hxx>
32 #include <rtl/ustrbuf.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)
45 ,m_bOdbc3(true)
47 OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
48 if(!m_pConnection->isCatalogUsed())
50 osl_atomic_increment( &m_refCount );
51 try
53 m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
54 OUString sVersion = getDriverVersion();
55 m_bOdbc3 = sVersion != "02.50" && sVersion != "02.00";
57 catch(SQLException& )
58 { // doesn't matter here
60 osl_atomic_decrement( &m_refCount );
64 ODatabaseMetaData::~ODatabaseMetaData()
68 Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
70 Reference< XResultSet > xRef;
71 try
73 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
74 xRef = pResult;
75 pResult->openTypeInfo();
77 catch(SQLException&)
79 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
82 return xRef;
85 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException, std::exception)
87 Reference< XResultSet > xRef;
88 if(!m_bUseCatalog)
90 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
92 else
94 try
96 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
97 xRef = pResult;
98 pResult->openCatalogs();
100 catch(SQLException&)
102 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
106 return xRef;
109 OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
111 OUString aVal;
112 if ( m_bUseCatalog )
113 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_NAME_SEPARATOR,aVal,*this,m_pConnection->getTextEncoding());
115 return aVal;
118 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException, std::exception)
120 Reference< XResultSet > xRef;
123 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
124 xRef = pResult;
125 pResult->openSchemas();
127 catch(SQLException&)
129 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eSchemas);
131 return xRef;
134 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
135 const Any& catalog, const OUString& schema, const OUString& table,
136 const OUString& columnNamePattern ) throw(SQLException, RuntimeException, std::exception)
138 Reference< XResultSet > xRef;
141 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
142 xRef = pResult;
143 pResult->openColumnPrivileges(m_bUseCatalog ? catalog : Any(),schema,table,columnNamePattern);
145 catch(SQLException&)
147 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumnPrivileges);
149 return xRef;
152 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
153 const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern,
154 const OUString& columnNamePattern ) throw(SQLException, RuntimeException, std::exception)
156 Reference< XResultSet > xRef;
159 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
160 xRef = pResult;
161 pResult->openColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,columnNamePattern);
163 catch(SQLException&)
165 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
167 return xRef;
170 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
171 const Any& catalog, const OUString& schemaPattern,
172 const OUString& tableNamePattern, const Sequence< OUString >& types ) throw(SQLException, RuntimeException, std::exception)
174 Reference< XResultSet > xRef;
177 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
178 xRef = pResult;
179 pResult->openTables(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,types);
181 catch(SQLException&)
183 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
185 return xRef;
188 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
189 const Any& catalog, const OUString& schemaPattern,
190 const OUString& procedureNamePattern, const OUString& columnNamePattern ) throw(SQLException, RuntimeException, std::exception)
192 Reference< XResultSet > xRef;
195 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
196 xRef = pResult;
197 pResult->openProcedureColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern,columnNamePattern);
199 catch(SQLException&)
201 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedureColumns);
203 return xRef;
206 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
207 const Any& catalog, const OUString& schemaPattern,
208 const OUString& procedureNamePattern ) throw(SQLException, RuntimeException, std::exception)
210 Reference< XResultSet > xRef;
213 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
214 xRef = pResult;
215 pResult->openProcedures(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern);
217 catch(SQLException&)
219 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedures);
221 return xRef;
224 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
225 const Any& catalog, const OUString& schema, const OUString& table ) throw(SQLException, RuntimeException, std::exception)
227 Reference< XResultSet > xRef;
228 bool bSuccess = false;
231 if ( !m_pConnection->preventGetVersionColumns() )
233 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
234 xRef = pResult;
235 pResult->openVersionColumns(m_bUseCatalog ? catalog : Any(),schema,table);
236 bSuccess = true;
239 catch(SQLException&)
243 if ( !bSuccess )
245 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
248 return xRef;
251 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException, std::exception)
253 SQLUINTEGER nValue;
254 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_BINARY_LITERAL_LEN,nValue,*this);
255 return nValue;
258 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException, std::exception)
260 SQLUINTEGER nValue;
261 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_ROW_SIZE,nValue,*this);
262 return nValue;
265 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException, std::exception)
267 SQLUSMALLINT nValue;
268 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CATALOG_NAME_LEN,nValue,*this);
269 return nValue;
272 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException, std::exception)
274 SQLUINTEGER nValue;
275 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CHAR_LITERAL_LEN,nValue,*this);
276 return nValue;
279 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException, std::exception)
281 SQLUSMALLINT nValue;
282 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMN_NAME_LEN,nValue,*this);
283 return nValue;
286 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException, std::exception)
288 SQLUSMALLINT nValue;
289 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_INDEX,nValue,*this);
290 return nValue;
293 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException, std::exception)
295 SQLUSMALLINT nValue;
296 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CURSOR_NAME_LEN,nValue,*this);
297 return nValue;
300 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException, std::exception)
302 SQLUSMALLINT nValue;
303 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_DRIVER_CONNECTIONS/*SQL_ACTIVE_CONNECTIONS*/,nValue,*this);
304 return nValue;
307 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException, std::exception)
309 SQLUSMALLINT nValue;
310 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_TABLE,nValue,*this);
311 return nValue;
314 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException, std::exception)
316 SQLUINTEGER nValue;
317 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_STATEMENT_LEN,nValue,*this);
318 return nValue;
321 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException, std::exception)
323 SQLUSMALLINT nValue;
324 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLE_NAME_LEN,nValue,*this);
325 return nValue;
328 sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
330 SQLUSMALLINT nValue;
331 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLES_IN_SELECT,nValue,*this);
332 return nValue;
335 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
336 const Any& catalog, const OUString& schema, const OUString& table ) throw(SQLException, RuntimeException, std::exception)
338 Reference< XResultSet > xRef;
341 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
342 xRef = pResult;
343 pResult->openExportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
345 catch(SQLException&)
347 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eExportedKeys);
349 return xRef;
352 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
353 const Any& catalog, const OUString& schema, const OUString& table ) throw(SQLException, RuntimeException, std::exception)
355 Reference< XResultSet > xRef;
358 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
359 xRef = pResult;
360 pResult->openImportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
362 catch(SQLException&)
364 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eImportedKeys);
366 return xRef;
369 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
370 const Any& catalog, const OUString& schema, const OUString& table ) throw(SQLException, RuntimeException, std::exception)
372 Reference< XResultSet > xRef;
375 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
376 xRef = pResult;
377 pResult->openPrimaryKeys(m_bUseCatalog ? catalog : Any(),schema,table);
379 catch(SQLException&)
381 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::ePrimaryKeys);
383 return xRef;
386 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
387 const Any& catalog, const OUString& schema, const OUString& table,
388 sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException, std::exception)
390 Reference< XResultSet > xRef;
393 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
394 xRef = pResult;
395 pResult->openIndexInfo(m_bUseCatalog ? catalog : Any(),schema,table,unique,approximate);
397 catch(SQLException&)
399 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eIndexInfo);
401 return xRef;
404 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
405 const Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope,
406 sal_Bool nullable ) throw(SQLException, RuntimeException, std::exception)
408 Reference< XResultSet > xRef;
411 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
412 xRef = pResult;
413 pResult->openBestRowIdentifier(m_bUseCatalog ? catalog : Any(),schema,table,scope,nullable);
415 catch(SQLException&)
417 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eBestRowIdentifier);
419 return xRef;
422 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
423 const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) throw(SQLException, RuntimeException, std::exception)
425 if ( m_pConnection->isIgnoreDriverPrivilegesEnabled() )
427 return new OResultSetPrivileges(this,catalog,schemaPattern,tableNamePattern);
429 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
430 Reference< XResultSet > xRef = pResult;
431 pResult->openTablePrivileges(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern);
432 return xRef;
435 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
436 const Any& primaryCatalog, const OUString& primarySchema,
437 const OUString& primaryTable, const Any& foreignCatalog,
438 const OUString& foreignSchema, const OUString& foreignTable ) throw(SQLException, RuntimeException, std::exception)
440 Reference< XResultSet > xRef;
443 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
444 xRef = pResult;
445 pResult->openForeignKeys(m_bUseCatalog ? primaryCatalog : Any(),primarySchema.toChar() == '%' ? &primarySchema : NULL,&primaryTable,
446 m_bUseCatalog ? foreignCatalog : Any(), foreignSchema.toChar() == '%' ? &foreignSchema : NULL,&foreignTable);
448 catch(SQLException&)
450 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCrossReference);
452 return xRef;
455 sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException, std::exception)
457 OUString aVal;
458 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_ROW_SIZE_INCLUDES_LONG,aVal,*this,m_pConnection->getTextEncoding());
459 return aVal.toChar() == 'Y';
462 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
464 SQLUSMALLINT nValue;
465 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
466 return nValue == SQL_IC_LOWER;
469 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
471 SQLUSMALLINT nValue;
472 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
473 return nValue == SQL_IC_LOWER;
476 bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
478 SQLUSMALLINT nValue;
479 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
480 return nValue == SQL_IC_MIXED;
483 sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
485 SQLUSMALLINT nValue;
486 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
487 return nValue == SQL_IC_MIXED;
490 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
492 SQLUSMALLINT nValue;
493 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
494 return nValue == SQL_IC_UPPER;
497 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
499 SQLUSMALLINT nValue;
500 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
501 return nValue == SQL_IC_UPPER;
504 bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
506 SQLUINTEGER nValue;
507 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this);
508 return (nValue & SQL_AT_ADD_COLUMN) == SQL_AT_ADD_COLUMN;
511 bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
513 SQLUINTEGER nValue;
514 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this);
515 return ((nValue & SQL_AT_DROP_COLUMN) == SQL_AT_DROP_COLUMN) ||
516 ((nValue & SQL_AT_DROP_COLUMN_CASCADE) == SQL_AT_DROP_COLUMN_CASCADE) ||
517 ((nValue & SQL_AT_DROP_COLUMN_RESTRICT) == SQL_AT_DROP_COLUMN_RESTRICT);
520 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException, std::exception)
522 SQLUINTEGER nValue;
523 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_INDEX_SIZE,nValue,*this);
524 return nValue;
527 sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException, std::exception)
529 SQLUSMALLINT nValue;
530 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NON_NULLABLE_COLUMNS,nValue,*this);
531 return nValue == SQL_NNC_NON_NULL;
534 OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException, std::exception)
536 OUString aVal;
537 if(m_bUseCatalog)
538 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_TERM,aVal,*this,m_pConnection->getTextEncoding());
539 return aVal;
542 OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
544 OUString aVal;
545 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_QUOTE_CHAR,aVal,*this,m_pConnection->getTextEncoding());
546 return aVal;
549 OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException, std::exception)
551 OUString aVal;
552 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SPECIAL_CHARACTERS,aVal,*this,m_pConnection->getTextEncoding());
553 return aVal;
556 sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException, std::exception)
558 SQLUSMALLINT nValue;
559 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
560 return nValue != SQL_CN_NONE;
563 bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
565 SQLUSMALLINT nValue=0;
566 if ( m_bUseCatalog )
567 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_LOCATION,nValue,*this);
568 return nValue == SQL_CL_START;
571 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException, std::exception)
573 SQLUSMALLINT nValue;
574 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
575 return nValue == SQL_TC_DDL_IGNORE;
578 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException, std::exception)
580 SQLUSMALLINT nValue;
581 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
582 return nValue == SQL_TC_DDL_COMMIT;
585 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException, std::exception)
587 SQLUSMALLINT nValue;
588 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
589 return nValue == SQL_TC_DML;
592 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException, std::exception)
594 SQLUSMALLINT nValue;
595 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
596 return nValue == SQL_TC_ALL;
599 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException, std::exception)
601 SQLUINTEGER nValue;
602 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
603 return (nValue & SQL_CA1_POS_DELETE) == SQL_CA1_POS_DELETE;
606 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException, std::exception)
608 SQLUINTEGER nValue;
609 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
610 return (nValue & SQL_CA1_POS_UPDATE) == SQL_CA1_POS_UPDATE;
613 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException, std::exception)
615 SQLUSMALLINT nValue;
616 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
617 return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
620 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException, std::exception)
622 SQLUSMALLINT nValue;
623 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
624 return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
627 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException, std::exception)
629 SQLUSMALLINT nValue;
630 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
631 return nValue == SQL_CB_PRESERVE;
634 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException, std::exception)
636 SQLUSMALLINT nValue;
637 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
638 return nValue == SQL_CB_PRESERVE;
641 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException, std::exception)
643 SQLUINTEGER nValue;
644 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_ISOLATION_OPTION,nValue,*this);
645 return (nValue & static_cast<SQLUINTEGER>(level)) == static_cast<SQLUINTEGER>(level);
648 bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
650 SQLUINTEGER nValue;
651 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
652 return (nValue & SQL_SU_DML_STATEMENTS) == SQL_SU_DML_STATEMENTS;
655 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException, std::exception)
657 SQLUINTEGER nValue;
658 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
659 return static_cast<bool>(nValue & SQL_SC_SQL92_FULL);
662 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException, std::exception)
664 SQLUINTEGER nValue;
665 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
666 return static_cast<bool>(nValue &SQL_SC_SQL92_ENTRY);
669 sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException, std::exception)
671 OUString aStr;
672 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_INTEGRITY,aStr,*this,m_pConnection->getTextEncoding());
673 return aStr.toChar() == 'Y';
676 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException, std::exception)
678 SQLUINTEGER nValue;
679 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
680 return (nValue & SQL_SU_INDEX_DEFINITION) == SQL_SU_INDEX_DEFINITION;
683 bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
685 SQLUINTEGER nValue;
686 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
687 return (nValue & SQL_SU_TABLE_DEFINITION) == SQL_SU_TABLE_DEFINITION;
690 bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
692 SQLUINTEGER nValue=0;
693 if(m_bUseCatalog)
694 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
695 return (nValue & SQL_CU_TABLE_DEFINITION) == SQL_CU_TABLE_DEFINITION;
698 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException, std::exception)
700 SQLUINTEGER nValue=0;
701 if(m_bUseCatalog)
702 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
703 return (nValue & SQL_CU_INDEX_DEFINITION) == SQL_CU_INDEX_DEFINITION;
706 bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
708 SQLUINTEGER nValue=0;
709 if(m_bUseCatalog)
710 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
711 return (nValue & SQL_CU_DML_STATEMENTS) == SQL_CU_DML_STATEMENTS;
714 sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
716 SQLUINTEGER nValue;
717 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
718 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);
721 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException, std::exception)
723 Reference< XResultSet > xRef;
726 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
727 xRef = pResult;
728 pResult->openTablesTypes();
730 catch(SQLException&)
732 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
734 return xRef;
737 sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
739 SQLUSMALLINT nValue;
740 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CONCURRENT_ACTIVITIES,nValue,*this);
741 return nValue;
744 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException, std::exception)
746 SQLUSMALLINT nValue;
747 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_PROCEDURE_NAME_LEN,nValue,*this);
748 return nValue;
751 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException, std::exception)
753 SQLUSMALLINT nValue;
754 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_SCHEMA_NAME_LEN,nValue,*this);
755 return nValue;
758 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException, std::exception)
760 SQLUSMALLINT nValue;
761 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
762 return nValue != SQL_TC_NONE;
765 sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException, std::exception)
767 OUString aValue;
768 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ACCESSIBLE_PROCEDURES,aValue,*this,m_pConnection->getTextEncoding());
769 return aValue.toChar() == 'Y';
772 sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException, std::exception)
774 OUString aValue;
775 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_PROCEDURES,aValue,*this,m_pConnection->getTextEncoding());
776 return aValue.toChar() == 'Y';
779 sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException, std::exception)
781 SQLUINTEGER nValue;
782 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
783 return (nValue & SQL_CA1_POSITIONED_UPDATE) == SQL_CA1_POSITIONED_UPDATE;
786 sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException, std::exception)
788 OUString aValue;
789 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ACCESSIBLE_TABLES,aValue,*this,m_pConnection->getTextEncoding());
790 return aValue.toChar() == 'Y';
793 sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException, std::exception)
795 return m_pConnection->isReadOnly();
798 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException, std::exception)
800 SQLUSMALLINT nValue;
801 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this);
802 return nValue == SQL_FILE_CATALOG;
805 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException, std::exception)
807 SQLUSMALLINT nValue;
808 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this);
809 return nValue == SQL_FILE_TABLE;
812 sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException, std::exception)
814 SQLUINTEGER nValue;
815 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_FUNCTIONS,nValue,*this);
816 return (nValue & SQL_FN_CVT_CONVERT) == SQL_FN_CVT_CONVERT;
819 sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException, std::exception)
821 SQLUSMALLINT nValue;
822 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONCAT_NULL_BEHAVIOR,nValue,*this);
823 return nValue == SQL_CB_NULL;
826 sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException, std::exception)
828 OUString aValue;
829 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_COLUMN_ALIAS,aValue,*this,m_pConnection->getTextEncoding());
830 return aValue.toChar() == 'Y';
833 sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException, std::exception)
835 SQLUSMALLINT nValue;
836 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
837 return nValue != SQL_CN_NONE;
840 sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException, std::exception)
842 if(fromType == toType)
843 return sal_True;
845 SQLUINTEGER nValue=0;
846 switch(fromType)
848 case DataType::BIT:
849 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BIT,nValue,*this);
850 break;
851 case DataType::TINYINT:
852 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TINYINT,nValue,*this);
853 break;
854 case DataType::SMALLINT:
855 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_SMALLINT,nValue,*this);
856 break;
857 case DataType::INTEGER:
858 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_INTEGER,nValue,*this);
859 break;
860 case DataType::BIGINT:
861 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BIGINT,nValue,*this);
862 break;
863 case DataType::FLOAT:
864 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_FLOAT,nValue,*this);
865 break;
866 case DataType::REAL:
867 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_REAL,nValue,*this);
868 break;
869 case DataType::DOUBLE:
870 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DOUBLE,nValue,*this);
871 break;
872 case DataType::NUMERIC:
873 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_NUMERIC,nValue,*this);
874 break;
875 case DataType::DECIMAL:
876 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DECIMAL,nValue,*this);
877 break;
878 case DataType::CHAR:
879 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_CHAR,nValue,*this);
880 break;
881 case DataType::VARCHAR:
882 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARCHAR,nValue,*this);
883 break;
884 case DataType::LONGVARCHAR:
885 case DataType::CLOB:
886 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARCHAR,nValue,*this);
887 break;
888 case DataType::DATE:
889 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DATE,nValue,*this);
890 break;
891 case DataType::TIME:
892 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TIME,nValue,*this);
893 break;
894 case DataType::TIMESTAMP:
895 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TIMESTAMP,nValue,*this);
896 break;
897 case DataType::BINARY:
898 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BINARY,nValue,*this);
899 break;
900 case DataType::VARBINARY:
901 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARBINARY,nValue,*this);
902 break;
903 case DataType::LONGVARBINARY:
904 case DataType::BLOB:
905 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARBINARY,nValue,*this);
906 break;
907 case DataType::SQLNULL:
908 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
909 break;
910 case DataType::OTHER:
911 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
912 break;
913 case DataType::OBJECT:
914 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
915 break;
916 case DataType::DISTINCT:
917 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
918 break;
919 case DataType::STRUCT:
920 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
921 break;
922 case DataType::ARRAY:
923 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
924 break;
925 case DataType::REF:
926 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
927 break;
929 bool bConvert = false;
930 switch(toType)
932 case DataType::BIT:
933 bConvert = (nValue & SQL_CVT_BIT) == SQL_CVT_BIT;
934 break;
935 case DataType::TINYINT:
936 bConvert = (nValue & SQL_CVT_TINYINT) == SQL_CVT_TINYINT;
937 break;
938 case DataType::SMALLINT:
939 bConvert = (nValue & SQL_CVT_SMALLINT) == SQL_CVT_SMALLINT;
940 break;
941 case DataType::INTEGER:
942 bConvert = (nValue & SQL_CVT_INTEGER) == SQL_CVT_INTEGER;
943 break;
944 case DataType::BIGINT:
945 bConvert = (nValue & SQL_CVT_BIGINT) == SQL_CVT_BIGINT;
946 break;
947 case DataType::FLOAT:
948 bConvert = (nValue & SQL_CVT_FLOAT) == SQL_CVT_FLOAT;
949 break;
950 case DataType::REAL:
951 bConvert = (nValue & SQL_CVT_REAL) == SQL_CVT_REAL;
952 break;
953 case DataType::DOUBLE:
954 bConvert = (nValue & SQL_CVT_DOUBLE) == SQL_CVT_DOUBLE;
955 break;
956 case DataType::NUMERIC:
957 bConvert = (nValue & SQL_CVT_NUMERIC) == SQL_CVT_NUMERIC;
958 break;
959 case DataType::DECIMAL:
960 bConvert = (nValue & SQL_CVT_DECIMAL) == SQL_CVT_DECIMAL;
961 break;
962 case DataType::CHAR:
963 bConvert = (nValue & SQL_CVT_CHAR) == SQL_CVT_CHAR;
964 break;
965 case DataType::VARCHAR:
966 bConvert = (nValue & SQL_CVT_VARCHAR) == SQL_CVT_VARCHAR;
967 break;
968 case DataType::LONGVARCHAR:
969 case DataType::CLOB:
970 bConvert = (nValue & SQL_CVT_LONGVARCHAR) == SQL_CVT_LONGVARCHAR;
971 break;
972 case DataType::DATE:
973 bConvert = (nValue & SQL_CVT_DATE) == SQL_CVT_DATE;
974 break;
975 case DataType::TIME:
976 bConvert = (nValue & SQL_CVT_TIME) == SQL_CVT_TIME;
977 break;
978 case DataType::TIMESTAMP:
979 bConvert = (nValue & SQL_CVT_TIMESTAMP) == SQL_CVT_TIMESTAMP;
980 break;
981 case DataType::BINARY:
982 bConvert = (nValue & SQL_CVT_BINARY) == SQL_CVT_BINARY;
983 break;
984 case DataType::VARBINARY:
985 bConvert = (nValue & SQL_CVT_VARBINARY) == SQL_CVT_VARBINARY;
986 break;
987 case DataType::LONGVARBINARY:
988 case DataType::BLOB:
989 bConvert = (nValue & SQL_CVT_LONGVARBINARY) == SQL_CVT_LONGVARBINARY;
990 break;
993 return bConvert;
996 sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException, std::exception)
998 OUString aValue;
999 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_EXPRESSIONS_IN_ORDERBY,aValue,*this,m_pConnection->getTextEncoding());
1000 return aValue.toChar() == 'Y';
1003 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException, std::exception)
1005 SQLUSMALLINT nValue;
1006 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1007 return nValue != SQL_GB_NOT_SUPPORTED;
1010 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException, std::exception)
1012 SQLUSMALLINT nValue;
1013 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1014 return nValue != SQL_GB_GROUP_BY_CONTAINS_SELECT;
1017 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException, std::exception)
1019 SQLUSMALLINT nValue;
1020 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1021 return nValue == SQL_GB_NO_RELATION;
1024 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException, std::exception)
1026 OUString aValue;
1027 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MULTIPLE_ACTIVE_TXN,aValue,*this,m_pConnection->getTextEncoding());
1028 return aValue.toChar() == 'Y';
1031 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException, std::exception)
1033 OUString aValue;
1034 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MULT_RESULT_SETS,aValue,*this,m_pConnection->getTextEncoding());
1035 return aValue.toChar() == 'Y';
1038 sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException, std::exception)
1040 OUString aValue;
1041 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_LIKE_ESCAPE_CLAUSE,aValue,*this,m_pConnection->getTextEncoding());
1042 return aValue.toChar() == 'Y';
1045 sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException, std::exception)
1047 OUString aValue;
1048 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ORDER_BY_COLUMNS_IN_SELECT,aValue,*this,m_pConnection->getTextEncoding());
1049 return aValue.toChar() == 'N';
1052 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException, std::exception)
1054 SQLUINTEGER nValue;
1055 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_UNION,nValue,*this);
1056 return (nValue & SQL_U_UNION) == SQL_U_UNION;
1059 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException, std::exception)
1061 SQLUINTEGER nValue;
1062 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_UNION,nValue,*this);
1063 return (nValue & SQL_U_UNION_ALL) == SQL_U_UNION_ALL;
1066 sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
1068 SQLUSMALLINT nValue;
1069 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
1070 return nValue == SQL_IC_MIXED;
1073 bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
1075 SQLUSMALLINT nValue;
1076 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
1077 return nValue == SQL_IC_MIXED;
1080 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException, std::exception)
1082 SQLUSMALLINT nValue;
1083 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1084 return nValue == SQL_NC_END;
1087 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException, std::exception)
1089 SQLUSMALLINT nValue;
1090 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1091 return nValue == SQL_NC_START;
1094 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException, std::exception)
1096 SQLUSMALLINT nValue;
1097 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1098 return nValue == SQL_NC_HIGH;
1101 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException, std::exception)
1103 SQLUSMALLINT nValue;
1104 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1105 return nValue == SQL_NC_LOW;
1108 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException, std::exception)
1110 SQLUINTEGER nValue;
1111 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
1112 return (nValue & SQL_SU_PROCEDURE_INVOCATION) == SQL_SU_PROCEDURE_INVOCATION;
1115 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException, std::exception)
1117 SQLUINTEGER nValue;
1118 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
1119 return (nValue & SQL_SU_PRIVILEGE_DEFINITION) == SQL_SU_PRIVILEGE_DEFINITION;
1122 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException, std::exception)
1124 SQLUINTEGER nValue=0;
1125 if(m_bUseCatalog)
1126 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
1127 return (nValue & SQL_CU_PROCEDURE_INVOCATION) == SQL_CU_PROCEDURE_INVOCATION;
1130 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException, std::exception)
1132 SQLUINTEGER nValue=0;
1133 if(m_bUseCatalog)
1134 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
1135 return (nValue & SQL_CU_PRIVILEGE_DEFINITION) == SQL_CU_PRIVILEGE_DEFINITION;
1138 sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException, std::exception)
1140 SQLUINTEGER nValue;
1141 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1142 return (nValue & SQL_SQ_CORRELATED_SUBQUERIES) == SQL_SQ_CORRELATED_SUBQUERIES;
1145 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException, std::exception)
1147 SQLUINTEGER nValue;
1148 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1149 return (nValue & SQL_SQ_COMPARISON) == SQL_SQ_COMPARISON;
1152 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException, std::exception)
1154 SQLUINTEGER nValue;
1155 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1156 return (nValue & SQL_SQ_EXISTS) == SQL_SQ_EXISTS;
1159 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException, std::exception)
1161 SQLUINTEGER nValue;
1162 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1163 return (nValue & SQL_SQ_IN) == SQL_SQ_IN;
1166 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException, std::exception)
1168 SQLUINTEGER nValue;
1169 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1170 return (nValue & SQL_SQ_QUANTIFIED) == SQL_SQ_QUANTIFIED;
1173 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException, std::exception)
1175 SQLUINTEGER nValue;
1176 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
1177 return static_cast<bool>(nValue & SQL_SC_SQL92_INTERMEDIATE);
1180 OUString ODatabaseMetaData::getURLImpl()
1182 OUString aValue;
1183 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DATA_SOURCE_NAME,aValue,*this,m_pConnection->getTextEncoding());
1184 return aValue;
1187 OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException, std::exception)
1189 OUString aValue = m_pConnection->getURL();
1190 if ( aValue.isEmpty() )
1192 aValue = "sdbc:odbc:" + getURLImpl();
1194 return aValue;
1197 OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException, std::exception)
1199 OUString aValue;
1200 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_USER_NAME,aValue,*this,m_pConnection->getTextEncoding());
1201 return aValue;
1204 OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException, std::exception)
1206 OUString aValue;
1207 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_NAME,aValue,*this,m_pConnection->getTextEncoding());
1208 return aValue;
1211 OUString SAL_CALL ODatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException, std::exception)
1213 OUString aValue;
1214 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_ODBC_VER,aValue,*this,m_pConnection->getTextEncoding());
1215 return aValue;
1218 OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException, std::exception)
1220 OUString aValue;
1221 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1222 return aValue;
1225 OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException, std::exception)
1227 OUString aValue;
1228 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DBMS_NAME,aValue,*this,m_pConnection->getTextEncoding());
1229 return aValue;
1232 OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException, std::exception)
1234 OUString aValue;
1235 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_PROCEDURE_TERM,aValue,*this,m_pConnection->getTextEncoding());
1236 return aValue;
1239 OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException, std::exception)
1241 OUString aValue;
1242 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_TERM,aValue,*this,m_pConnection->getTextEncoding());
1243 return aValue;
1246 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException, std::exception)
1248 OUString aValue;
1249 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1250 return aValue.copy(0,aValue.indexOf('.')).toInt32();
1253 sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException, std::exception)
1255 SQLUINTEGER nValue;
1256 sal_Int32 nValueTranslated;
1257 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DEFAULT_TXN_ISOLATION,nValue,*this);
1258 switch(nValue)
1260 case SQL_TXN_READ_UNCOMMITTED:
1261 nValueTranslated = com::sun::star::sdbc::TransactionIsolation::READ_UNCOMMITTED;
1262 break;
1263 case SQL_TXN_READ_COMMITTED:
1264 nValueTranslated = com::sun::star::sdbc::TransactionIsolation::READ_COMMITTED;
1265 break;
1266 case SQL_TXN_REPEATABLE_READ:
1267 nValueTranslated = com::sun::star::sdbc::TransactionIsolation::REPEATABLE_READ;
1268 break;
1269 case SQL_TXN_SERIALIZABLE:
1270 nValueTranslated = com::sun::star::sdbc::TransactionIsolation::SERIALIZABLE;
1271 break;
1272 default:
1273 nValueTranslated = 0;
1275 return nValueTranslated;
1278 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException, std::exception)
1280 OUString aValue;
1281 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1282 return aValue.copy(0,aValue.lastIndexOf('.')).toInt32();
1285 OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException, std::exception)
1287 OUString aValue;
1288 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_KEYWORDS,aValue,*this,m_pConnection->getTextEncoding());
1289 return aValue;
1292 OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException, std::exception)
1294 OUString aValue;
1295 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SEARCH_PATTERN_ESCAPE,aValue,*this,m_pConnection->getTextEncoding());
1296 return aValue;
1299 OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException, std::exception)
1301 SQLUINTEGER nValue;
1302 OUStringBuffer aValue;
1303 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_STRING_FUNCTIONS,nValue,*this);
1304 if(nValue & SQL_FN_STR_ASCII)
1305 aValue.appendAscii("ASCII,");
1306 if(nValue & SQL_FN_STR_BIT_LENGTH)
1307 aValue.appendAscii("BIT_LENGTH,");
1308 if(nValue & SQL_FN_STR_CHAR)
1309 aValue.appendAscii("CHAR,");
1310 if(nValue & SQL_FN_STR_CHAR_LENGTH)
1311 aValue.appendAscii("CHAR_LENGTH,");
1312 if(nValue & SQL_FN_STR_CHARACTER_LENGTH)
1313 aValue.appendAscii("CHARACTER_LENGTH,");
1314 if(nValue & SQL_FN_STR_CONCAT)
1315 aValue.appendAscii("CONCAT,");
1316 if(nValue & SQL_FN_STR_DIFFERENCE)
1317 aValue.appendAscii("DIFFERENCE,");
1318 if(nValue & SQL_FN_STR_INSERT)
1319 aValue.appendAscii("INSERT,");
1320 if(nValue & SQL_FN_STR_LCASE)
1321 aValue.appendAscii("LCASE,");
1322 if(nValue & SQL_FN_STR_LEFT)
1323 aValue.appendAscii("LEFT,");
1324 if(nValue & SQL_FN_STR_LENGTH)
1325 aValue.appendAscii("LENGTH,");
1326 if(nValue & SQL_FN_STR_LOCATE)
1327 aValue.appendAscii("LOCATE,");
1328 if(nValue & SQL_FN_STR_LOCATE_2)
1329 aValue.appendAscii("LOCATE_2,");
1330 if(nValue & SQL_FN_STR_LTRIM)
1331 aValue.appendAscii("LTRIM,");
1332 if(nValue & SQL_FN_STR_OCTET_LENGTH)
1333 aValue.appendAscii("OCTET_LENGTH,");
1334 if(nValue & SQL_FN_STR_POSITION)
1335 aValue.appendAscii("POSITION,");
1336 if(nValue & SQL_FN_STR_REPEAT)
1337 aValue.appendAscii("REPEAT,");
1338 if(nValue & SQL_FN_STR_REPLACE)
1339 aValue.appendAscii("REPLACE,");
1340 if(nValue & SQL_FN_STR_RIGHT)
1341 aValue.appendAscii("RIGHT,");
1342 if(nValue & SQL_FN_STR_RTRIM)
1343 aValue.appendAscii("RTRIM,");
1344 if(nValue & SQL_FN_STR_SOUNDEX)
1345 aValue.appendAscii("SOUNDEX,");
1346 if(nValue & SQL_FN_STR_SPACE)
1347 aValue.appendAscii("SPACE,");
1348 if(nValue & SQL_FN_STR_SUBSTRING)
1349 aValue.appendAscii("SUBSTRING,");
1350 if(nValue & SQL_FN_STR_UCASE)
1351 aValue.appendAscii("UCASE,");
1354 if ( !aValue.isEmpty() )
1355 aValue.setLength(aValue.getLength()-1);
1357 return aValue.makeStringAndClear();
1360 OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException, std::exception)
1362 SQLUINTEGER nValue;
1363 OUStringBuffer aValue;
1364 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TIMEDATE_FUNCTIONS,nValue,*this);
1366 if(nValue & SQL_FN_TD_CURRENT_DATE)
1367 aValue.appendAscii("CURRENT_DATE,");
1368 if(nValue & SQL_FN_TD_CURRENT_TIME)
1369 aValue.appendAscii("CURRENT_TIME,");
1370 if(nValue & SQL_FN_TD_CURRENT_TIMESTAMP)
1371 aValue.appendAscii("CURRENT_TIMESTAMP,");
1372 if(nValue & SQL_FN_TD_CURDATE)
1373 aValue.appendAscii("CURDATE,");
1374 if(nValue & SQL_FN_TD_CURTIME)
1375 aValue.appendAscii("CURTIME,");
1376 if(nValue & SQL_FN_TD_DAYNAME)
1377 aValue.appendAscii("DAYNAME,");
1378 if(nValue & SQL_FN_TD_DAYOFMONTH)
1379 aValue.appendAscii("DAYOFMONTH,");
1380 if(nValue & SQL_FN_TD_DAYOFWEEK)
1381 aValue.appendAscii("DAYOFWEEK,");
1382 if(nValue & SQL_FN_TD_DAYOFYEAR)
1383 aValue.appendAscii("DAYOFYEAR,");
1384 if(nValue & SQL_FN_TD_EXTRACT)
1385 aValue.appendAscii("EXTRACT,");
1386 if(nValue & SQL_FN_TD_HOUR)
1387 aValue.appendAscii("HOUR,");
1388 if(nValue & SQL_FN_TD_MINUTE)
1389 aValue.appendAscii("MINUTE,");
1390 if(nValue & SQL_FN_TD_MONTH)
1391 aValue.appendAscii("MONTH,");
1392 if(nValue & SQL_FN_TD_MONTHNAME)
1393 aValue.appendAscii("MONTHNAME,");
1394 if(nValue & SQL_FN_TD_NOW)
1395 aValue.appendAscii("NOW,");
1396 if(nValue & SQL_FN_TD_QUARTER)
1397 aValue.appendAscii("QUARTER,");
1398 if(nValue & SQL_FN_TD_SECOND)
1399 aValue.appendAscii("SECOND,");
1400 if(nValue & SQL_FN_TD_TIMESTAMPADD)
1401 aValue.appendAscii("TIMESTAMPADD,");
1402 if(nValue & SQL_FN_TD_TIMESTAMPDIFF)
1403 aValue.appendAscii("TIMESTAMPDIFF,");
1404 if(nValue & SQL_FN_TD_WEEK)
1405 aValue.appendAscii("WEEK,");
1406 if(nValue & SQL_FN_TD_YEAR)
1407 aValue.appendAscii("YEAR,");
1409 if ( !aValue.isEmpty() )
1410 aValue.setLength(aValue.getLength()-1);
1412 return aValue.makeStringAndClear();
1415 OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException, std::exception)
1417 SQLUINTEGER nValue;
1418 OUStringBuffer aValue;
1419 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SYSTEM_FUNCTIONS,nValue,*this);
1421 if(nValue & SQL_FN_SYS_DBNAME)
1422 aValue.appendAscii("DBNAME,");
1423 if(nValue & SQL_FN_SYS_IFNULL)
1424 aValue.appendAscii("IFNULL,");
1425 if(nValue & SQL_FN_SYS_USERNAME)
1426 aValue.appendAscii("USERNAME,");
1428 if ( !aValue.isEmpty() )
1429 aValue.setLength(aValue.getLength()-1);
1431 return aValue.makeStringAndClear();
1434 OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException, std::exception)
1436 SQLUINTEGER nValue;
1437 OUStringBuffer aValue;
1438 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NUMERIC_FUNCTIONS,nValue,*this);
1440 if(nValue & SQL_FN_NUM_ABS)
1441 aValue.appendAscii("ABS,");
1442 if(nValue & SQL_FN_NUM_ACOS)
1443 aValue.appendAscii("ACOS,");
1444 if(nValue & SQL_FN_NUM_ASIN)
1445 aValue.appendAscii("ASIN,");
1446 if(nValue & SQL_FN_NUM_ATAN)
1447 aValue.appendAscii("ATAN,");
1448 if(nValue & SQL_FN_NUM_ATAN2)
1449 aValue.appendAscii("ATAN2,");
1450 if(nValue & SQL_FN_NUM_CEILING)
1451 aValue.appendAscii("CEILING,");
1452 if(nValue & SQL_FN_NUM_COS)
1453 aValue.appendAscii("COS,");
1454 if(nValue & SQL_FN_NUM_COT)
1455 aValue.appendAscii("COT,");
1456 if(nValue & SQL_FN_NUM_DEGREES)
1457 aValue.appendAscii("DEGREES,");
1458 if(nValue & SQL_FN_NUM_EXP)
1459 aValue.appendAscii("EXP,");
1460 if(nValue & SQL_FN_NUM_FLOOR)
1461 aValue.appendAscii("FLOOR,");
1462 if(nValue & SQL_FN_NUM_LOG)
1463 aValue.appendAscii("LOGF,");
1464 if(nValue & SQL_FN_NUM_LOG10)
1465 aValue.appendAscii("LOG10,");
1466 if(nValue & SQL_FN_NUM_MOD)
1467 aValue.appendAscii("MOD,");
1468 if(nValue & SQL_FN_NUM_PI)
1469 aValue.appendAscii("PI,");
1470 if(nValue & SQL_FN_NUM_POWER)
1471 aValue.appendAscii("POWER,");
1472 if(nValue & SQL_FN_NUM_RADIANS)
1473 aValue.appendAscii("RADIANS,");
1474 if(nValue & SQL_FN_NUM_RAND)
1475 aValue.appendAscii("RAND,");
1476 if(nValue & SQL_FN_NUM_ROUND)
1477 aValue.appendAscii("ROUND,");
1478 if(nValue & SQL_FN_NUM_SIGN)
1479 aValue.appendAscii("SIGN,");
1480 if(nValue & SQL_FN_NUM_SIN)
1481 aValue.appendAscii("SIN,");
1482 if(nValue & SQL_FN_NUM_SQRT)
1483 aValue.appendAscii("SQRT,");
1484 if(nValue & SQL_FN_NUM_TAN)
1485 aValue.appendAscii("TAN,");
1486 if(nValue & SQL_FN_NUM_TRUNCATE)
1487 aValue.appendAscii("TRUNCATE,");
1489 if ( !aValue.isEmpty() )
1490 aValue.setLength(aValue.getLength()-1);
1492 return aValue.makeStringAndClear();
1495 sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
1497 SQLUINTEGER nValue;
1498 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1499 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1500 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1501 "connectivity.odbc",
1502 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1503 return nValue == SQL_OSC_EXTENDED;
1506 sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
1508 SQLUINTEGER nValue;
1509 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1510 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1511 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1512 "connectivity.odbc",
1513 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1514 return nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED;
1517 sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
1519 SQLUINTEGER nValue;
1520 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1521 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1522 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1523 "connectivity.odbc",
1524 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1525 return nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED;
1528 sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
1530 SQLUINTEGER nValue;
1531 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
1532 return (nValue & SQL_OJ_FULL) == SQL_OJ_FULL;
1535 sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
1537 return supportsFullOuterJoins( );
1540 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException, std::exception)
1542 SQLUSMALLINT nValue;
1543 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_GROUP_BY,nValue,*this);
1544 return nValue;
1547 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException, std::exception)
1549 SQLUSMALLINT nValue;
1550 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_ORDER_BY,nValue,*this);
1551 return nValue;
1554 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException, std::exception)
1556 SQLUSMALLINT nValue;
1557 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_SELECT,nValue,*this);
1558 return nValue;
1561 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException, std::exception)
1563 SQLUSMALLINT nValue;
1564 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_USER_NAME_LEN,nValue,*this);
1565 return nValue;
1568 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException, std::exception)
1570 SQLUINTEGER nValue;
1571 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_SENSITIVITY,nValue,*this);
1572 return (nValue & static_cast<SQLUINTEGER>(setType)) == static_cast<SQLUINTEGER>(setType);
1575 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException, std::exception)
1577 SQLUINTEGER nValue;
1578 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1579 switch(setType)
1581 default:
1582 case ResultSetType::FORWARD_ONLY:
1583 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1584 break;
1585 case ResultSetType::SCROLL_INSENSITIVE:
1586 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1587 break;
1588 case ResultSetType::SCROLL_SENSITIVE:
1589 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1590 break;
1593 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1594 bool bRet = false;
1595 switch(concurrency)
1597 case ResultSetConcurrency::READ_ONLY:
1598 bRet = (nValue & SQL_CA2_READ_ONLY_CONCURRENCY) == SQL_CA2_READ_ONLY_CONCURRENCY;
1599 break;
1600 case ResultSetConcurrency::UPDATABLE:
1601 bRet = (nValue & SQL_CA2_OPT_VALUES_CONCURRENCY) == SQL_CA2_OPT_VALUES_CONCURRENCY;
1602 break;
1604 return bRet;
1607 sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException, std::exception)
1609 SQLUINTEGER nValue;
1610 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1611 switch(setType)
1613 default:
1614 case ResultSetType::FORWARD_ONLY:
1615 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1616 break;
1617 case ResultSetType::SCROLL_INSENSITIVE:
1618 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1619 break;
1620 case ResultSetType::SCROLL_SENSITIVE:
1621 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1622 break;
1625 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1626 return (nValue & SQL_CA2_SENSITIVITY_UPDATES) == SQL_CA2_SENSITIVITY_UPDATES;
1629 sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException, std::exception)
1631 SQLUINTEGER nValue;
1632 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1633 switch(setType)
1635 default:
1636 case ResultSetType::FORWARD_ONLY:
1637 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1638 break;
1639 case ResultSetType::SCROLL_INSENSITIVE:
1640 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1641 break;
1642 case ResultSetType::SCROLL_SENSITIVE:
1643 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1644 break;
1647 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1648 return (nValue & SQL_CA2_SENSITIVITY_DELETIONS) != SQL_CA2_SENSITIVITY_DELETIONS;
1651 sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException, std::exception)
1653 SQLUINTEGER nValue;
1654 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1655 switch(setType)
1657 default:
1658 case ResultSetType::FORWARD_ONLY:
1659 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1660 break;
1661 case ResultSetType::SCROLL_INSENSITIVE:
1662 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1663 break;
1664 case ResultSetType::SCROLL_SENSITIVE:
1665 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1666 break;
1669 OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1670 return (nValue & SQL_CA2_SENSITIVITY_ADDITIONS) == SQL_CA2_SENSITIVITY_ADDITIONS;
1673 sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException, std::exception)
1675 return ownUpdatesAreVisible(setType);
1678 sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException, std::exception)
1680 return ownDeletesAreVisible(setType);
1683 sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException, std::exception)
1685 return ownInsertsAreVisible(setType);
1688 sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1690 return sal_False;
1693 sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1695 return sal_False;
1698 sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException, std::exception)
1700 return sal_False;
1703 sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException, std::exception)
1705 return sal_False;
1708 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException, std::exception)
1710 return NULL;
1714 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */