1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "odbc/ODatabaseMetaData.hxx"
30 #include "odbc/OTools.hxx"
31 #include "odbc/ODatabaseMetaDataResultSet.hxx"
32 #include "FDatabaseMetaDataResultSet.hxx"
33 #include <com/sun/star/sdbc/DataType.hpp>
34 #include <com/sun/star/sdbc/ResultSetType.hpp>
35 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
36 #include "odbc/OFunctiondefs.hxx"
38 #include "TPrivilegesResultSet.hxx"
39 #include <connectivity/dbexception.hxx>
40 #include <rtl/ustrbuf.hxx>
42 using namespace connectivity::odbc
;
43 using namespace com::sun::star::uno
;
44 using namespace com::sun::star::lang
;
45 using namespace com::sun::star::beans
;
46 using namespace com::sun::star::sdbc
;
48 ODatabaseMetaData::ODatabaseMetaData(const SQLHANDLE _pHandle
,OConnection
* _pCon
)
49 : ::connectivity::ODatabaseMetaDataBase(_pCon
,_pCon
->getConnectionInfo())
50 ,m_aConnectionHandle(_pHandle
)
52 ,m_bUseCatalog(sal_True
)
55 OSL_ENSURE(m_pConnection
,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
56 if(!m_pConnection
->isCatalogUsed())
58 osl_incrementInterlockedCount( &m_refCount
);
61 m_bUseCatalog
= !(usesLocalFiles() || usesLocalFilePerTable());
62 ::rtl::OUString sVersion
= getDriverVersion();
63 m_bOdbc3
= sVersion
!= ::rtl::OUString("02.50") && sVersion
!= ::rtl::OUString("02.00");
66 { // doesn't matter here
68 osl_decrementInterlockedCount( &m_refCount
);
71 // -------------------------------------------------------------------------
72 ODatabaseMetaData::~ODatabaseMetaData()
75 // -------------------------------------------------------------------------
76 Reference
< XResultSet
> ODatabaseMetaData::impl_getTypeInfo_throw( )
78 Reference
< XResultSet
> xRef
;
81 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
83 pResult
->openTypeInfo();
87 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo
);
92 // -------------------------------------------------------------------------
93 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getCatalogs( ) throw(SQLException
, RuntimeException
)
95 Reference
< XResultSet
> xRef
;
98 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs
);
104 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
106 pResult
->openCatalogs();
110 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs
);
116 // -------------------------------------------------------------------------
117 ::rtl::OUString
ODatabaseMetaData::impl_getCatalogSeparator_throw( )
119 ::rtl::OUString aVal
;
121 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CATALOG_NAME_SEPARATOR
,aVal
,*this,m_pConnection
->getTextEncoding());
125 // -------------------------------------------------------------------------
126 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getSchemas( ) throw(SQLException
, RuntimeException
)
128 Reference
< XResultSet
> xRef
;
131 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
133 pResult
->openSchemas();
137 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eSchemas
);
141 // -------------------------------------------------------------------------
142 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getColumnPrivileges(
143 const Any
& catalog
, const ::rtl::OUString
& schema
, const ::rtl::OUString
& table
,
144 const ::rtl::OUString
& columnNamePattern
) throw(SQLException
, RuntimeException
)
146 Reference
< XResultSet
> xRef
;
149 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
151 pResult
->openColumnPrivileges(m_bUseCatalog
? catalog
: Any(),schema
,table
,columnNamePattern
);
155 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumnPrivileges
);
159 // -------------------------------------------------------------------------
160 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getColumns(
161 const Any
& catalog
, const ::rtl::OUString
& schemaPattern
, const ::rtl::OUString
& tableNamePattern
,
162 const ::rtl::OUString
& columnNamePattern
) throw(SQLException
, RuntimeException
)
164 Reference
< XResultSet
> xRef
;
167 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
169 pResult
->openColumns(m_bUseCatalog
? catalog
: Any(),schemaPattern
,tableNamePattern
,columnNamePattern
);
173 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns
);
177 // -------------------------------------------------------------------------
178 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getTables(
179 const Any
& catalog
, const ::rtl::OUString
& schemaPattern
,
180 const ::rtl::OUString
& tableNamePattern
, const Sequence
< ::rtl::OUString
>& types
) throw(SQLException
, RuntimeException
)
182 Reference
< XResultSet
> xRef
;
185 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
187 pResult
->openTables(m_bUseCatalog
? catalog
: Any(),schemaPattern
,tableNamePattern
,types
);
191 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables
);
195 // -------------------------------------------------------------------------
196 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getProcedureColumns(
197 const Any
& catalog
, const ::rtl::OUString
& schemaPattern
,
198 const ::rtl::OUString
& procedureNamePattern
, const ::rtl::OUString
& columnNamePattern
) throw(SQLException
, RuntimeException
)
200 Reference
< XResultSet
> xRef
;
203 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
205 pResult
->openProcedureColumns(m_bUseCatalog
? catalog
: Any(),schemaPattern
,procedureNamePattern
,columnNamePattern
);
209 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedureColumns
);
213 // -------------------------------------------------------------------------
214 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getProcedures(
215 const Any
& catalog
, const ::rtl::OUString
& schemaPattern
,
216 const ::rtl::OUString
& procedureNamePattern
) throw(SQLException
, RuntimeException
)
218 Reference
< XResultSet
> xRef
;
221 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
223 pResult
->openProcedures(m_bUseCatalog
? catalog
: Any(),schemaPattern
,procedureNamePattern
);
227 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedures
);
231 // -------------------------------------------------------------------------
232 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getVersionColumns(
233 const Any
& catalog
, const ::rtl::OUString
& schema
, const ::rtl::OUString
& table
) throw(SQLException
, RuntimeException
)
235 Reference
< XResultSet
> xRef
;
236 bool bSuccess
= false;
239 if ( !m_pConnection
->preventGetVersionColumns() )
241 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
243 pResult
->openVersionColumns(m_bUseCatalog
? catalog
: Any(),schema
,table
);
253 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns
);
258 // -------------------------------------------------------------------------
259 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException
, RuntimeException
)
262 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_BINARY_LITERAL_LEN
,nValue
,*this);
265 // -------------------------------------------------------------------------
266 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxRowSize( ) throw(SQLException
, RuntimeException
)
269 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_ROW_SIZE
,nValue
,*this);
272 // -------------------------------------------------------------------------
273 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException
, RuntimeException
)
276 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_CATALOG_NAME_LEN
,nValue
,*this);
279 // -------------------------------------------------------------------------
280 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException
, RuntimeException
)
283 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_CHAR_LITERAL_LEN
,nValue
,*this);
286 // -------------------------------------------------------------------------
287 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException
, RuntimeException
)
290 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_COLUMN_NAME_LEN
,nValue
,*this);
293 // -------------------------------------------------------------------------
294 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException
, RuntimeException
)
297 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_COLUMNS_IN_INDEX
,nValue
,*this);
300 // -------------------------------------------------------------------------
301 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException
, RuntimeException
)
304 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_CURSOR_NAME_LEN
,nValue
,*this);
307 // -------------------------------------------------------------------------
308 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxConnections( ) throw(SQLException
, RuntimeException
)
311 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_DRIVER_CONNECTIONS
/*SQL_ACTIVE_CONNECTIONS*/,nValue
,*this);
314 // -------------------------------------------------------------------------
315 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException
, RuntimeException
)
318 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_COLUMNS_IN_TABLE
,nValue
,*this);
321 // -------------------------------------------------------------------------
322 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException
, RuntimeException
)
325 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_STATEMENT_LEN
,nValue
,*this);
328 // -------------------------------------------------------------------------
329 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException
, RuntimeException
)
332 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_TABLE_NAME_LEN
,nValue
,*this);
335 // -------------------------------------------------------------------------
336 sal_Int32
ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
339 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_TABLES_IN_SELECT
,nValue
,*this);
342 // -------------------------------------------------------------------------
343 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getExportedKeys(
344 const Any
& catalog
, const ::rtl::OUString
& schema
, const ::rtl::OUString
& table
) throw(SQLException
, RuntimeException
)
346 Reference
< XResultSet
> xRef
;
349 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
351 pResult
->openExportedKeys(m_bUseCatalog
? catalog
: Any(),schema
,table
);
355 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eExportedKeys
);
359 // -------------------------------------------------------------------------
360 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getImportedKeys(
361 const Any
& catalog
, const ::rtl::OUString
& schema
, const ::rtl::OUString
& table
) throw(SQLException
, RuntimeException
)
363 Reference
< XResultSet
> xRef
;
366 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
368 pResult
->openImportedKeys(m_bUseCatalog
? catalog
: Any(),schema
,table
);
372 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eImportedKeys
);
376 // -------------------------------------------------------------------------
377 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getPrimaryKeys(
378 const Any
& catalog
, const ::rtl::OUString
& schema
, const ::rtl::OUString
& table
) throw(SQLException
, RuntimeException
)
380 Reference
< XResultSet
> xRef
;
383 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
385 pResult
->openPrimaryKeys(m_bUseCatalog
? catalog
: Any(),schema
,table
);
389 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::ePrimaryKeys
);
393 // -------------------------------------------------------------------------
394 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getIndexInfo(
395 const Any
& catalog
, const ::rtl::OUString
& schema
, const ::rtl::OUString
& table
,
396 sal_Bool unique
, sal_Bool approximate
) throw(SQLException
, RuntimeException
)
398 Reference
< XResultSet
> xRef
;
401 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
403 pResult
->openIndexInfo(m_bUseCatalog
? catalog
: Any(),schema
,table
,unique
,approximate
);
407 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eIndexInfo
);
411 // -------------------------------------------------------------------------
412 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getBestRowIdentifier(
413 const Any
& catalog
, const ::rtl::OUString
& schema
, const ::rtl::OUString
& table
, sal_Int32 scope
,
414 sal_Bool nullable
) throw(SQLException
, RuntimeException
)
416 Reference
< XResultSet
> xRef
;
419 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
421 pResult
->openBestRowIdentifier(m_bUseCatalog
? catalog
: Any(),schema
,table
,scope
,nullable
);
425 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eBestRowIdentifier
);
429 // -------------------------------------------------------------------------
430 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getTablePrivileges(
431 const Any
& catalog
, const ::rtl::OUString
& schemaPattern
, const ::rtl::OUString
& tableNamePattern
) throw(SQLException
, RuntimeException
)
433 if ( m_pConnection
->isIgnoreDriverPrivilegesEnabled() )
435 return new OResultSetPrivileges(this,catalog
,schemaPattern
,tableNamePattern
);
437 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
438 Reference
< XResultSet
> xRef
= pResult
;
439 pResult
->openTablePrivileges(m_bUseCatalog
? catalog
: Any(),schemaPattern
,tableNamePattern
);
442 // -------------------------------------------------------------------------
443 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getCrossReference(
444 const Any
& primaryCatalog
, const ::rtl::OUString
& primarySchema
,
445 const ::rtl::OUString
& primaryTable
, const Any
& foreignCatalog
,
446 const ::rtl::OUString
& foreignSchema
, const ::rtl::OUString
& foreignTable
) throw(SQLException
, RuntimeException
)
448 Reference
< XResultSet
> xRef
;
451 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
453 pResult
->openForeignKeys(m_bUseCatalog
? primaryCatalog
: Any(),primarySchema
.toChar() == '%' ? &primarySchema
: NULL
,&primaryTable
,
454 m_bUseCatalog
? foreignCatalog
: Any(), foreignSchema
.toChar() == '%' ? &foreignSchema
: NULL
,&foreignTable
);
458 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCrossReference
);
462 // -------------------------------------------------------------------------
463 sal_Bool SAL_CALL
ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException
, RuntimeException
)
465 ::rtl::OUString aVal
;
466 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_ROW_SIZE_INCLUDES_LONG
,aVal
,*this,m_pConnection
->getTextEncoding());
467 return aVal
.toChar() == 'Y';
469 // -------------------------------------------------------------------------
470 sal_Bool SAL_CALL
ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException
, RuntimeException
)
473 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_QUOTED_IDENTIFIER_CASE
,nValue
,*this);
474 return nValue
== SQL_IC_LOWER
;
476 // -------------------------------------------------------------------------
477 sal_Bool SAL_CALL
ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException
, RuntimeException
)
480 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_IDENTIFIER_CASE
,nValue
,*this);
481 return nValue
== SQL_IC_LOWER
;
483 // -------------------------------------------------------------------------
484 sal_Bool
ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
487 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_QUOTED_IDENTIFIER_CASE
,nValue
,*this);
488 return nValue
== SQL_IC_MIXED
;
490 // -------------------------------------------------------------------------
491 sal_Bool SAL_CALL
ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException
, RuntimeException
)
494 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_IDENTIFIER_CASE
,nValue
,*this);
495 return nValue
== SQL_IC_MIXED
;
497 // -------------------------------------------------------------------------
498 sal_Bool SAL_CALL
ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException
, RuntimeException
)
501 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_QUOTED_IDENTIFIER_CASE
,nValue
,*this);
502 return nValue
== SQL_IC_UPPER
;
504 // -------------------------------------------------------------------------
505 sal_Bool SAL_CALL
ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException
, RuntimeException
)
508 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_IDENTIFIER_CASE
,nValue
,*this);
509 return nValue
== SQL_IC_UPPER
;
511 // -------------------------------------------------------------------------
512 sal_Bool
ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
515 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_ALTER_TABLE
,nValue
,*this);
516 return (nValue
& SQL_AT_ADD_COLUMN
) == SQL_AT_ADD_COLUMN
;
518 // -------------------------------------------------------------------------
519 sal_Bool
ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
522 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_ALTER_TABLE
,nValue
,*this);
523 return ((nValue
& SQL_AT_DROP_COLUMN
) == SQL_AT_DROP_COLUMN
) ||
524 ((nValue
& SQL_AT_DROP_COLUMN_CASCADE
) == SQL_AT_DROP_COLUMN_CASCADE
) ||
525 ((nValue
& SQL_AT_DROP_COLUMN_RESTRICT
) == SQL_AT_DROP_COLUMN_RESTRICT
);
527 // -------------------------------------------------------------------------
528 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException
, RuntimeException
)
531 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_INDEX_SIZE
,nValue
,*this);
534 // -------------------------------------------------------------------------
535 sal_Bool SAL_CALL
ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException
, RuntimeException
)
538 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_NON_NULLABLE_COLUMNS
,nValue
,*this);
539 return nValue
== SQL_NNC_NON_NULL
;
541 // -------------------------------------------------------------------------
542 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getCatalogTerm( ) throw(SQLException
, RuntimeException
)
544 ::rtl::OUString aVal
;
546 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CATALOG_TERM
,aVal
,*this,m_pConnection
->getTextEncoding());
549 // -------------------------------------------------------------------------
550 ::rtl::OUString
ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
552 ::rtl::OUString aVal
;
553 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_IDENTIFIER_QUOTE_CHAR
,aVal
,*this,m_pConnection
->getTextEncoding());
556 // -------------------------------------------------------------------------
557 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException
, RuntimeException
)
559 ::rtl::OUString aVal
;
560 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SPECIAL_CHARACTERS
,aVal
,*this,m_pConnection
->getTextEncoding());
563 // -------------------------------------------------------------------------
564 sal_Bool SAL_CALL
ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException
, RuntimeException
)
567 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CORRELATION_NAME
,nValue
,*this);
568 return nValue
!= SQL_CN_NONE
;
570 // -------------------------------------------------------------------------
571 sal_Bool
ODatabaseMetaData::impl_isCatalogAtStart_throw( )
573 SQLUSMALLINT nValue
=0;
575 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CATALOG_LOCATION
,nValue
,*this);
576 return nValue
== SQL_CL_START
;
578 // -------------------------------------------------------------------------
579 sal_Bool SAL_CALL
ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException
, RuntimeException
)
582 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_TXN_CAPABLE
,nValue
,*this);
583 return nValue
== SQL_TC_DDL_IGNORE
;
585 // -------------------------------------------------------------------------
586 sal_Bool SAL_CALL
ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException
, RuntimeException
)
589 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_TXN_CAPABLE
,nValue
,*this);
590 return nValue
== SQL_TC_DDL_COMMIT
;
592 // -------------------------------------------------------------------------
593 sal_Bool SAL_CALL
ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException
, RuntimeException
)
596 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_TXN_CAPABLE
,nValue
,*this);
597 return nValue
== SQL_TC_DML
;
599 // -------------------------------------------------------------------------
600 sal_Bool SAL_CALL
ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException
, RuntimeException
)
603 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_TXN_CAPABLE
,nValue
,*this);
604 return nValue
== SQL_TC_ALL
;
606 // -------------------------------------------------------------------------
607 sal_Bool SAL_CALL
ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException
, RuntimeException
)
610 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_DYNAMIC_CURSOR_ATTRIBUTES1
,nValue
,*this);
611 return (nValue
& SQL_CA1_POS_DELETE
) == SQL_CA1_POS_DELETE
;
613 // -------------------------------------------------------------------------
614 sal_Bool SAL_CALL
ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException
, RuntimeException
)
617 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_DYNAMIC_CURSOR_ATTRIBUTES1
,nValue
,*this);
618 return (nValue
& SQL_CA1_POS_UPDATE
) == SQL_CA1_POS_UPDATE
;
620 // -------------------------------------------------------------------------
621 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException
, RuntimeException
)
624 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CURSOR_ROLLBACK_BEHAVIOR
,nValue
,*this);
625 return nValue
== SQL_CB_PRESERVE
|| nValue
== SQL_CB_CLOSE
;
627 // -------------------------------------------------------------------------
628 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException
, RuntimeException
)
631 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CURSOR_COMMIT_BEHAVIOR
,nValue
,*this);
632 return nValue
== SQL_CB_PRESERVE
|| nValue
== SQL_CB_CLOSE
;
634 // -------------------------------------------------------------------------
635 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException
, RuntimeException
)
638 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CURSOR_COMMIT_BEHAVIOR
,nValue
,*this);
639 return nValue
== SQL_CB_PRESERVE
;
641 // -------------------------------------------------------------------------
642 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException
, RuntimeException
)
645 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CURSOR_ROLLBACK_BEHAVIOR
,nValue
,*this);
646 return nValue
== SQL_CB_PRESERVE
;
648 // -------------------------------------------------------------------------
649 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level
) throw(SQLException
, RuntimeException
)
652 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_TXN_ISOLATION_OPTION
,nValue
,*this);
653 return (nValue
& static_cast<SQLUINTEGER
>(level
)) == static_cast<SQLUINTEGER
>(level
);
655 // -------------------------------------------------------------------------
656 sal_Bool
ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
659 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SCHEMA_USAGE
,nValue
,*this);
660 return (nValue
& SQL_SU_DML_STATEMENTS
) == SQL_SU_DML_STATEMENTS
;
662 // -------------------------------------------------------------------------
663 sal_Bool SAL_CALL
ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException
, RuntimeException
)
666 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SQL_CONFORMANCE
,nValue
,*this);
667 return nValue
== SQL_SC_SQL92_FULL
;
669 // -------------------------------------------------------------------------
670 sal_Bool SAL_CALL
ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException
, RuntimeException
)
673 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SQL_CONFORMANCE
,nValue
,*this);
674 return nValue
== SQL_SC_SQL92_ENTRY
;
676 // -------------------------------------------------------------------------
677 sal_Bool SAL_CALL
ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException
, RuntimeException
)
679 ::rtl::OUString aStr
;
680 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_INTEGRITY
,aStr
,*this,m_pConnection
->getTextEncoding());
681 return aStr
.toChar() == 'Y';
683 // -------------------------------------------------------------------------
684 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException
, RuntimeException
)
687 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SCHEMA_USAGE
,nValue
,*this);
688 return (nValue
& SQL_SU_INDEX_DEFINITION
) == SQL_SU_INDEX_DEFINITION
;
690 // -------------------------------------------------------------------------
691 sal_Bool
ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
694 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SCHEMA_USAGE
,nValue
,*this);
695 return (nValue
& SQL_SU_TABLE_DEFINITION
) == SQL_SU_TABLE_DEFINITION
;
697 // -------------------------------------------------------------------------
698 sal_Bool
ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
700 SQLUINTEGER nValue
=0;
702 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CATALOG_USAGE
,nValue
,*this);
703 return (nValue
& SQL_CU_TABLE_DEFINITION
) == SQL_CU_TABLE_DEFINITION
;
705 // -------------------------------------------------------------------------
706 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException
, RuntimeException
)
708 SQLUINTEGER nValue
=0;
710 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CATALOG_USAGE
,nValue
,*this);
711 return (nValue
& SQL_CU_INDEX_DEFINITION
) == SQL_CU_INDEX_DEFINITION
;
713 // -------------------------------------------------------------------------
714 sal_Bool
ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
716 SQLUINTEGER nValue
=0;
718 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CATALOG_USAGE
,nValue
,*this);
719 return (nValue
& SQL_CU_DML_STATEMENTS
) == SQL_CU_DML_STATEMENTS
;
721 // -------------------------------------------------------------------------
722 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException
, RuntimeException
)
725 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_OJ_CAPABILITIES
,nValue
,*this);
726 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);
728 // -------------------------------------------------------------------------
729 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getTableTypes( ) throw(SQLException
, RuntimeException
)
731 Reference
< XResultSet
> xRef
;
734 ODatabaseMetaDataResultSet
* pResult
= new ODatabaseMetaDataResultSet(m_pConnection
);
736 pResult
->openTablesTypes();
740 xRef
= new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes
);
744 // -------------------------------------------------------------------------
745 sal_Int32
ODatabaseMetaData::impl_getMaxStatements_throw( )
748 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_CONCURRENT_ACTIVITIES
,nValue
,*this);
751 // -------------------------------------------------------------------------
752 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException
, RuntimeException
)
755 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_PROCEDURE_NAME_LEN
,nValue
,*this);
758 // -------------------------------------------------------------------------
759 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException
, RuntimeException
)
762 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_SCHEMA_NAME_LEN
,nValue
,*this);
765 // -------------------------------------------------------------------------
766 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTransactions( ) throw(SQLException
, RuntimeException
)
769 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_TXN_CAPABLE
,nValue
,*this);
770 return nValue
!= SQL_TC_NONE
;
772 // -------------------------------------------------------------------------
773 sal_Bool SAL_CALL
ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException
, RuntimeException
)
775 ::rtl::OUString aValue
;
776 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_ACCESSIBLE_PROCEDURES
,aValue
,*this,m_pConnection
->getTextEncoding());
777 return aValue
.toChar() == 'Y';
779 // -------------------------------------------------------------------------
780 sal_Bool SAL_CALL
ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException
, RuntimeException
)
782 ::rtl::OUString aValue
;
783 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_PROCEDURES
,aValue
,*this,m_pConnection
->getTextEncoding());
784 return aValue
.toChar() == 'Y';
786 // -------------------------------------------------------------------------
787 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException
, RuntimeException
)
790 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_DYNAMIC_CURSOR_ATTRIBUTES1
,nValue
,*this);
791 return (nValue
& SQL_CA1_POSITIONED_UPDATE
) == SQL_CA1_POSITIONED_UPDATE
;
793 // -------------------------------------------------------------------------
794 sal_Bool SAL_CALL
ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException
, RuntimeException
)
796 ::rtl::OUString aValue
;
797 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_ACCESSIBLE_TABLES
,aValue
,*this,m_pConnection
->getTextEncoding());
798 return aValue
.toChar() == 'Y';
800 // -------------------------------------------------------------------------
801 sal_Bool SAL_CALL
ODatabaseMetaData::isReadOnly( ) throw(SQLException
, RuntimeException
)
803 return m_pConnection
->isReadOnly();
805 // -------------------------------------------------------------------------
806 sal_Bool SAL_CALL
ODatabaseMetaData::usesLocalFiles( ) throw(SQLException
, RuntimeException
)
809 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_FILE_USAGE
,nValue
,*this);
810 return nValue
== SQL_FILE_CATALOG
;
812 // -------------------------------------------------------------------------
813 sal_Bool SAL_CALL
ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException
, RuntimeException
)
816 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_FILE_USAGE
,nValue
,*this);
817 return nValue
== SQL_FILE_TABLE
;
819 // -------------------------------------------------------------------------
820 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException
, RuntimeException
)
823 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_FUNCTIONS
,nValue
,*this);
824 return (nValue
& SQL_FN_CVT_CONVERT
) == SQL_FN_CVT_CONVERT
;
826 // -------------------------------------------------------------------------
827 sal_Bool SAL_CALL
ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException
, RuntimeException
)
830 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONCAT_NULL_BEHAVIOR
,nValue
,*this);
831 return nValue
== SQL_CB_NULL
;
833 // -------------------------------------------------------------------------
834 sal_Bool SAL_CALL
ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException
, RuntimeException
)
836 ::rtl::OUString aValue
;
837 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_COLUMN_ALIAS
,aValue
,*this,m_pConnection
->getTextEncoding());
838 return aValue
.toChar() == 'Y';
840 // -------------------------------------------------------------------------
841 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException
, RuntimeException
)
844 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CORRELATION_NAME
,nValue
,*this);
845 return nValue
!= SQL_CN_NONE
;
847 // -------------------------------------------------------------------------
848 sal_Bool SAL_CALL
ODatabaseMetaData::supportsConvert( sal_Int32 fromType
, sal_Int32 toType
) throw(SQLException
, RuntimeException
)
850 if(fromType
== toType
)
853 SQLUINTEGER nValue
=0;
857 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_BIT
,nValue
,*this);
859 case DataType::TINYINT
:
860 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_TINYINT
,nValue
,*this);
862 case DataType::SMALLINT
:
863 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_SMALLINT
,nValue
,*this);
865 case DataType::INTEGER
:
866 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_INTEGER
,nValue
,*this);
868 case DataType::BIGINT
:
869 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_BIGINT
,nValue
,*this);
871 case DataType::FLOAT
:
872 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_FLOAT
,nValue
,*this);
875 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_REAL
,nValue
,*this);
877 case DataType::DOUBLE
:
878 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_DOUBLE
,nValue
,*this);
880 case DataType::NUMERIC
:
881 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_NUMERIC
,nValue
,*this);
883 case DataType::DECIMAL
:
884 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_DECIMAL
,nValue
,*this);
887 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_CHAR
,nValue
,*this);
889 case DataType::VARCHAR
:
890 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_VARCHAR
,nValue
,*this);
892 case DataType::LONGVARCHAR
:
894 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_LONGVARCHAR
,nValue
,*this);
897 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_DATE
,nValue
,*this);
900 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_TIME
,nValue
,*this);
902 case DataType::TIMESTAMP
:
903 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_TIMESTAMP
,nValue
,*this);
905 case DataType::BINARY
:
906 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_BINARY
,nValue
,*this);
908 case DataType::VARBINARY
:
909 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_VARBINARY
,nValue
,*this);
911 case DataType::LONGVARBINARY
:
913 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CONVERT_LONGVARBINARY
,nValue
,*this);
915 case DataType::SQLNULL
:
916 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
918 case DataType::OTHER
:
919 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
921 case DataType::OBJECT
:
922 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
924 case DataType::DISTINCT
:
925 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
927 case DataType::STRUCT
:
928 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
930 case DataType::ARRAY
:
931 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
934 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
937 sal_Bool bConvert
= sal_False
;
941 bConvert
= (nValue
& SQL_CVT_BIT
) == SQL_CVT_BIT
;
943 case DataType::TINYINT
:
944 bConvert
= (nValue
& SQL_CVT_TINYINT
) == SQL_CVT_TINYINT
;
946 case DataType::SMALLINT
:
947 bConvert
= (nValue
& SQL_CVT_SMALLINT
) == SQL_CVT_SMALLINT
;
949 case DataType::INTEGER
:
950 bConvert
= (nValue
& SQL_CVT_INTEGER
) == SQL_CVT_INTEGER
;
952 case DataType::BIGINT
:
953 bConvert
= (nValue
& SQL_CVT_BIGINT
) == SQL_CVT_BIGINT
;
955 case DataType::FLOAT
:
956 bConvert
= (nValue
& SQL_CVT_FLOAT
) == SQL_CVT_FLOAT
;
959 bConvert
= (nValue
& SQL_CVT_REAL
) == SQL_CVT_REAL
;
961 case DataType::DOUBLE
:
962 bConvert
= (nValue
& SQL_CVT_DOUBLE
) == SQL_CVT_DOUBLE
;
964 case DataType::NUMERIC
:
965 bConvert
= (nValue
& SQL_CVT_NUMERIC
) == SQL_CVT_NUMERIC
;
967 case DataType::DECIMAL
:
968 bConvert
= (nValue
& SQL_CVT_DECIMAL
) == SQL_CVT_DECIMAL
;
971 bConvert
= (nValue
& SQL_CVT_CHAR
) == SQL_CVT_CHAR
;
973 case DataType::VARCHAR
:
974 bConvert
= (nValue
& SQL_CVT_VARCHAR
) == SQL_CVT_VARCHAR
;
976 case DataType::LONGVARCHAR
:
978 bConvert
= (nValue
& SQL_CVT_LONGVARCHAR
) == SQL_CVT_LONGVARCHAR
;
981 bConvert
= (nValue
& SQL_CVT_DATE
) == SQL_CVT_DATE
;
984 bConvert
= (nValue
& SQL_CVT_TIME
) == SQL_CVT_TIME
;
986 case DataType::TIMESTAMP
:
987 bConvert
= (nValue
& SQL_CVT_TIMESTAMP
) == SQL_CVT_TIMESTAMP
;
989 case DataType::BINARY
:
990 bConvert
= (nValue
& SQL_CVT_BINARY
) == SQL_CVT_BINARY
;
992 case DataType::VARBINARY
:
993 bConvert
= (nValue
& SQL_CVT_VARBINARY
) == SQL_CVT_VARBINARY
;
995 case DataType::LONGVARBINARY
:
997 bConvert
= (nValue
& SQL_CVT_LONGVARBINARY
) == SQL_CVT_LONGVARBINARY
;
1003 // -------------------------------------------------------------------------
1004 sal_Bool SAL_CALL
ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException
, RuntimeException
)
1006 ::rtl::OUString aValue
;
1007 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_EXPRESSIONS_IN_ORDERBY
,aValue
,*this,m_pConnection
->getTextEncoding());
1008 return aValue
.toChar() == 'Y';
1010 // -------------------------------------------------------------------------
1011 sal_Bool SAL_CALL
ODatabaseMetaData::supportsGroupBy( ) throw(SQLException
, RuntimeException
)
1013 SQLUSMALLINT nValue
;
1014 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_GROUP_BY
,nValue
,*this);
1015 return nValue
!= SQL_GB_NOT_SUPPORTED
;
1017 // -------------------------------------------------------------------------
1018 sal_Bool SAL_CALL
ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException
, RuntimeException
)
1020 SQLUSMALLINT nValue
;
1021 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_GROUP_BY
,nValue
,*this);
1022 return nValue
!= SQL_GB_GROUP_BY_CONTAINS_SELECT
;
1024 // -------------------------------------------------------------------------
1025 sal_Bool SAL_CALL
ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException
, RuntimeException
)
1027 SQLUSMALLINT nValue
;
1028 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_GROUP_BY
,nValue
,*this);
1029 return nValue
== SQL_GB_NO_RELATION
;
1031 // -------------------------------------------------------------------------
1032 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException
, RuntimeException
)
1034 ::rtl::OUString aValue
;
1035 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MULTIPLE_ACTIVE_TXN
,aValue
,*this,m_pConnection
->getTextEncoding());
1036 return aValue
.toChar() == 'Y';
1038 // -------------------------------------------------------------------------
1039 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException
, RuntimeException
)
1041 ::rtl::OUString aValue
;
1042 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MULT_RESULT_SETS
,aValue
,*this,m_pConnection
->getTextEncoding());
1043 return aValue
.toChar() == 'Y';
1045 // -------------------------------------------------------------------------
1046 sal_Bool SAL_CALL
ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException
, RuntimeException
)
1048 ::rtl::OUString aValue
;
1049 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_LIKE_ESCAPE_CLAUSE
,aValue
,*this,m_pConnection
->getTextEncoding());
1050 return aValue
.toChar() == 'Y';
1052 // -------------------------------------------------------------------------
1053 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException
, RuntimeException
)
1055 ::rtl::OUString aValue
;
1056 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_ORDER_BY_COLUMNS_IN_SELECT
,aValue
,*this,m_pConnection
->getTextEncoding());
1057 return aValue
.toChar() == 'N';
1059 // -------------------------------------------------------------------------
1060 sal_Bool SAL_CALL
ODatabaseMetaData::supportsUnion( ) throw(SQLException
, RuntimeException
)
1063 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_UNION
,nValue
,*this);
1064 return (nValue
& SQL_U_UNION
) == SQL_U_UNION
;
1066 // -------------------------------------------------------------------------
1067 sal_Bool SAL_CALL
ODatabaseMetaData::supportsUnionAll( ) throw(SQLException
, RuntimeException
)
1070 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_UNION
,nValue
,*this);
1071 return (nValue
& SQL_U_UNION_ALL
) == SQL_U_UNION_ALL
;
1073 // -------------------------------------------------------------------------
1074 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException
, RuntimeException
)
1076 SQLUSMALLINT nValue
;
1077 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_IDENTIFIER_CASE
,nValue
,*this);
1078 return nValue
== SQL_IC_MIXED
;
1080 // -------------------------------------------------------------------------
1081 sal_Bool
ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
1083 SQLUSMALLINT nValue
;
1084 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_QUOTED_IDENTIFIER_CASE
,nValue
,*this);
1085 return nValue
== SQL_IC_MIXED
;
1087 // -------------------------------------------------------------------------
1088 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException
, RuntimeException
)
1090 SQLUSMALLINT nValue
;
1091 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_NULL_COLLATION
,nValue
,*this);
1092 return nValue
== SQL_NC_END
;
1094 // -------------------------------------------------------------------------
1095 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException
, RuntimeException
)
1097 SQLUSMALLINT nValue
;
1098 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_NULL_COLLATION
,nValue
,*this);
1099 return nValue
== SQL_NC_START
;
1101 // -------------------------------------------------------------------------
1102 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException
, RuntimeException
)
1104 SQLUSMALLINT nValue
;
1105 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_NULL_COLLATION
,nValue
,*this);
1106 return nValue
== SQL_NC_HIGH
;
1108 // -------------------------------------------------------------------------
1109 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException
, RuntimeException
)
1111 SQLUSMALLINT nValue
;
1112 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_NULL_COLLATION
,nValue
,*this);
1113 return nValue
== SQL_NC_LOW
;
1115 // -------------------------------------------------------------------------
1116 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException
, RuntimeException
)
1119 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SCHEMA_USAGE
,nValue
,*this);
1120 return (nValue
& SQL_SU_PROCEDURE_INVOCATION
) == SQL_SU_PROCEDURE_INVOCATION
;
1122 // -------------------------------------------------------------------------
1123 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException
, RuntimeException
)
1126 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SCHEMA_USAGE
,nValue
,*this);
1127 return (nValue
& SQL_SU_PRIVILEGE_DEFINITION
) == SQL_SU_PRIVILEGE_DEFINITION
;
1129 // -------------------------------------------------------------------------
1130 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException
, RuntimeException
)
1132 SQLUINTEGER nValue
=0;
1134 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CATALOG_USAGE
,nValue
,*this);
1135 return (nValue
& SQL_CU_PROCEDURE_INVOCATION
) == SQL_CU_PROCEDURE_INVOCATION
;
1137 // -------------------------------------------------------------------------
1138 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException
, RuntimeException
)
1140 SQLUINTEGER nValue
=0;
1142 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CATALOG_USAGE
,nValue
,*this);
1143 return (nValue
& SQL_CU_PRIVILEGE_DEFINITION
) == SQL_CU_PRIVILEGE_DEFINITION
;
1145 // -------------------------------------------------------------------------
1146 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException
, RuntimeException
)
1149 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SUBQUERIES
,nValue
,*this);
1150 return (nValue
& SQL_SQ_CORRELATED_SUBQUERIES
) == SQL_SQ_CORRELATED_SUBQUERIES
;
1152 // -------------------------------------------------------------------------
1153 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException
, RuntimeException
)
1156 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SUBQUERIES
,nValue
,*this);
1157 return (nValue
& SQL_SQ_COMPARISON
) == SQL_SQ_COMPARISON
;
1159 // -------------------------------------------------------------------------
1160 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException
, RuntimeException
)
1163 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SUBQUERIES
,nValue
,*this);
1164 return (nValue
& SQL_SQ_EXISTS
) == SQL_SQ_EXISTS
;
1166 // -------------------------------------------------------------------------
1167 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException
, RuntimeException
)
1170 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SUBQUERIES
,nValue
,*this);
1171 return (nValue
& SQL_SQ_IN
) == SQL_SQ_IN
;
1173 // -------------------------------------------------------------------------
1174 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException
, RuntimeException
)
1177 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SUBQUERIES
,nValue
,*this);
1178 return (nValue
& SQL_SQ_QUANTIFIED
) == SQL_SQ_QUANTIFIED
;
1180 // -------------------------------------------------------------------------
1181 sal_Bool SAL_CALL
ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException
, RuntimeException
)
1184 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SQL_CONFORMANCE
,nValue
,*this);
1185 return nValue
== SQL_SC_SQL92_INTERMEDIATE
;
1187 // -----------------------------------------------------------------------------
1188 ::rtl::OUString
ODatabaseMetaData::getURLImpl()
1190 ::rtl::OUString aValue
;
1191 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_DATA_SOURCE_NAME
,aValue
,*this,m_pConnection
->getTextEncoding());
1194 // -------------------------------------------------------------------------
1195 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getURL( ) throw(SQLException
, RuntimeException
)
1197 ::rtl::OUString aValue
= m_pConnection
->getURL();
1198 if ( aValue
.isEmpty() )
1200 aValue
= ::rtl::OUString("sdbc:odbc:");
1201 aValue
+= getURLImpl();
1205 // -------------------------------------------------------------------------
1206 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getUserName( ) throw(SQLException
, RuntimeException
)
1208 ::rtl::OUString aValue
;
1209 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_USER_NAME
,aValue
,*this,m_pConnection
->getTextEncoding());
1212 // -------------------------------------------------------------------------
1213 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getDriverName( ) throw(SQLException
, RuntimeException
)
1215 ::rtl::OUString aValue
;
1216 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_DRIVER_NAME
,aValue
,*this,m_pConnection
->getTextEncoding());
1219 // -------------------------------------------------------------------------
1220 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getDriverVersion() throw(SQLException
, RuntimeException
)
1222 ::rtl::OUString aValue
;
1223 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_DRIVER_ODBC_VER
,aValue
,*this,m_pConnection
->getTextEncoding());
1226 // -------------------------------------------------------------------------
1227 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException
, RuntimeException
)
1229 ::rtl::OUString aValue
;
1230 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_DRIVER_VER
,aValue
,*this,m_pConnection
->getTextEncoding());
1233 // -------------------------------------------------------------------------
1234 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException
, RuntimeException
)
1236 ::rtl::OUString aValue
;
1237 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_DBMS_NAME
,aValue
,*this,m_pConnection
->getTextEncoding());
1240 // -------------------------------------------------------------------------
1241 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getProcedureTerm( ) throw(SQLException
, RuntimeException
)
1243 ::rtl::OUString aValue
;
1244 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_PROCEDURE_TERM
,aValue
,*this,m_pConnection
->getTextEncoding());
1247 // -------------------------------------------------------------------------
1248 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getSchemaTerm( ) throw(SQLException
, RuntimeException
)
1250 ::rtl::OUString aValue
;
1251 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SCHEMA_TERM
,aValue
,*this,m_pConnection
->getTextEncoding());
1254 // -------------------------------------------------------------------------
1255 sal_Int32 SAL_CALL
ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException
)
1257 ::rtl::OUString aValue
;
1258 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_DRIVER_VER
,aValue
,*this,m_pConnection
->getTextEncoding());
1259 return aValue
.copy(0,aValue
.indexOf('.')).toInt32();
1261 // -------------------------------------------------------------------------
1262 sal_Int32 SAL_CALL
ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException
, RuntimeException
)
1265 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SUBQUERIES
,nValue
,*this);
1268 // -------------------------------------------------------------------------
1269 sal_Int32 SAL_CALL
ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException
)
1271 ::rtl::OUString aValue
;
1272 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_DRIVER_VER
,aValue
,*this,m_pConnection
->getTextEncoding());
1273 return aValue
.copy(0,aValue
.lastIndexOf('.')).toInt32();
1275 // -------------------------------------------------------------------------
1276 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getSQLKeywords( ) throw(SQLException
, RuntimeException
)
1278 ::rtl::OUString aValue
;
1279 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_KEYWORDS
,aValue
,*this,m_pConnection
->getTextEncoding());
1282 // -------------------------------------------------------------------------
1283 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException
, RuntimeException
)
1285 ::rtl::OUString aValue
;
1286 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SEARCH_PATTERN_ESCAPE
,aValue
,*this,m_pConnection
->getTextEncoding());
1289 // -------------------------------------------------------------------------
1290 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getStringFunctions( ) throw(SQLException
, RuntimeException
)
1293 ::rtl::OUStringBuffer aValue
;
1294 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_STRING_FUNCTIONS
,nValue
,*this);
1295 if(nValue
& SQL_FN_STR_ASCII
)
1296 aValue
.appendAscii("ASCII,");
1297 if(nValue
& SQL_FN_STR_BIT_LENGTH
)
1298 aValue
.appendAscii("BIT_LENGTH,");
1299 if(nValue
& SQL_FN_STR_CHAR
)
1300 aValue
.appendAscii("CHAR,");
1301 if(nValue
& SQL_FN_STR_CHAR_LENGTH
)
1302 aValue
.appendAscii("CHAR_LENGTH,");
1303 if(nValue
& SQL_FN_STR_CHARACTER_LENGTH
)
1304 aValue
.appendAscii("CHARACTER_LENGTH,");
1305 if(nValue
& SQL_FN_STR_CONCAT
)
1306 aValue
.appendAscii("CONCAT,");
1307 if(nValue
& SQL_FN_STR_DIFFERENCE
)
1308 aValue
.appendAscii("DIFFERENCE,");
1309 if(nValue
& SQL_FN_STR_INSERT
)
1310 aValue
.appendAscii("INSERT,");
1311 if(nValue
& SQL_FN_STR_LCASE
)
1312 aValue
.appendAscii("LCASE,");
1313 if(nValue
& SQL_FN_STR_LEFT
)
1314 aValue
.appendAscii("LEFT,");
1315 if(nValue
& SQL_FN_STR_LENGTH
)
1316 aValue
.appendAscii("LENGTH,");
1317 if(nValue
& SQL_FN_STR_LOCATE
)
1318 aValue
.appendAscii("LOCATE,");
1319 if(nValue
& SQL_FN_STR_LOCATE_2
)
1320 aValue
.appendAscii("LOCATE_2,");
1321 if(nValue
& SQL_FN_STR_LTRIM
)
1322 aValue
.appendAscii("LTRIM,");
1323 if(nValue
& SQL_FN_STR_OCTET_LENGTH
)
1324 aValue
.appendAscii("OCTET_LENGTH,");
1325 if(nValue
& SQL_FN_STR_POSITION
)
1326 aValue
.appendAscii("POSITION,");
1327 if(nValue
& SQL_FN_STR_REPEAT
)
1328 aValue
.appendAscii("REPEAT,");
1329 if(nValue
& SQL_FN_STR_REPLACE
)
1330 aValue
.appendAscii("REPLACE,");
1331 if(nValue
& SQL_FN_STR_RIGHT
)
1332 aValue
.appendAscii("RIGHT,");
1333 if(nValue
& SQL_FN_STR_RTRIM
)
1334 aValue
.appendAscii("RTRIM,");
1335 if(nValue
& SQL_FN_STR_SOUNDEX
)
1336 aValue
.appendAscii("SOUNDEX,");
1337 if(nValue
& SQL_FN_STR_SPACE
)
1338 aValue
.appendAscii("SPACE,");
1339 if(nValue
& SQL_FN_STR_SUBSTRING
)
1340 aValue
.appendAscii("SUBSTRING,");
1341 if(nValue
& SQL_FN_STR_UCASE
)
1342 aValue
.appendAscii("UCASE,");
1345 if ( aValue
.getLength() )
1346 aValue
.setLength(aValue
.getLength()-1);
1348 return aValue
.makeStringAndClear();
1350 // -------------------------------------------------------------------------
1351 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException
, RuntimeException
)
1354 ::rtl::OUStringBuffer aValue
;
1355 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_TIMEDATE_FUNCTIONS
,nValue
,*this);
1357 if(nValue
& SQL_FN_TD_CURRENT_DATE
)
1358 aValue
.appendAscii("CURRENT_DATE,");
1359 if(nValue
& SQL_FN_TD_CURRENT_TIME
)
1360 aValue
.appendAscii("CURRENT_TIME,");
1361 if(nValue
& SQL_FN_TD_CURRENT_TIMESTAMP
)
1362 aValue
.appendAscii("CURRENT_TIMESTAMP,");
1363 if(nValue
& SQL_FN_TD_CURDATE
)
1364 aValue
.appendAscii("CURDATE,");
1365 if(nValue
& SQL_FN_TD_CURTIME
)
1366 aValue
.appendAscii("CURTIME,");
1367 if(nValue
& SQL_FN_TD_DAYNAME
)
1368 aValue
.appendAscii("DAYNAME,");
1369 if(nValue
& SQL_FN_TD_DAYOFMONTH
)
1370 aValue
.appendAscii("DAYOFMONTH,");
1371 if(nValue
& SQL_FN_TD_DAYOFWEEK
)
1372 aValue
.appendAscii("DAYOFWEEK,");
1373 if(nValue
& SQL_FN_TD_DAYOFYEAR
)
1374 aValue
.appendAscii("DAYOFYEAR,");
1375 if(nValue
& SQL_FN_TD_EXTRACT
)
1376 aValue
.appendAscii("EXTRACT,");
1377 if(nValue
& SQL_FN_TD_HOUR
)
1378 aValue
.appendAscii("HOUR,");
1379 if(nValue
& SQL_FN_TD_MINUTE
)
1380 aValue
.appendAscii("MINUTE,");
1381 if(nValue
& SQL_FN_TD_MONTH
)
1382 aValue
.appendAscii("MONTH,");
1383 if(nValue
& SQL_FN_TD_MONTHNAME
)
1384 aValue
.appendAscii("MONTHNAME,");
1385 if(nValue
& SQL_FN_TD_NOW
)
1386 aValue
.appendAscii("NOW,");
1387 if(nValue
& SQL_FN_TD_QUARTER
)
1388 aValue
.appendAscii("QUARTER,");
1389 if(nValue
& SQL_FN_TD_SECOND
)
1390 aValue
.appendAscii("SECOND,");
1391 if(nValue
& SQL_FN_TD_TIMESTAMPADD
)
1392 aValue
.appendAscii("TIMESTAMPADD,");
1393 if(nValue
& SQL_FN_TD_TIMESTAMPDIFF
)
1394 aValue
.appendAscii("TIMESTAMPDIFF,");
1395 if(nValue
& SQL_FN_TD_WEEK
)
1396 aValue
.appendAscii("WEEK,");
1397 if(nValue
& SQL_FN_TD_YEAR
)
1398 aValue
.appendAscii("YEAR,");
1400 if ( aValue
.getLength() )
1401 aValue
.setLength(aValue
.getLength()-1);
1403 return aValue
.makeStringAndClear();
1405 // -------------------------------------------------------------------------
1406 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getSystemFunctions( ) throw(SQLException
, RuntimeException
)
1409 ::rtl::OUStringBuffer aValue
;
1410 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_SYSTEM_FUNCTIONS
,nValue
,*this);
1412 if(nValue
& SQL_FN_SYS_DBNAME
)
1413 aValue
.appendAscii("DBNAME,");
1414 if(nValue
& SQL_FN_SYS_IFNULL
)
1415 aValue
.appendAscii("IFNULL,");
1416 if(nValue
& SQL_FN_SYS_USERNAME
)
1417 aValue
.appendAscii("USERNAME,");
1419 if ( aValue
.getLength() )
1420 aValue
.setLength(aValue
.getLength()-1);
1422 return aValue
.makeStringAndClear();
1424 // -------------------------------------------------------------------------
1425 ::rtl::OUString SAL_CALL
ODatabaseMetaData::getNumericFunctions( ) throw(SQLException
, RuntimeException
)
1428 ::rtl::OUStringBuffer aValue
;
1429 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_NUMERIC_FUNCTIONS
,nValue
,*this);
1431 if(nValue
& SQL_FN_NUM_ABS
)
1432 aValue
.appendAscii("ABS,");
1433 if(nValue
& SQL_FN_NUM_ACOS
)
1434 aValue
.appendAscii("ACOS,");
1435 if(nValue
& SQL_FN_NUM_ASIN
)
1436 aValue
.appendAscii("ASIN,");
1437 if(nValue
& SQL_FN_NUM_ATAN
)
1438 aValue
.appendAscii("ATAN,");
1439 if(nValue
& SQL_FN_NUM_ATAN2
)
1440 aValue
.appendAscii("ATAN2,");
1441 if(nValue
& SQL_FN_NUM_CEILING
)
1442 aValue
.appendAscii("CEILING,");
1443 if(nValue
& SQL_FN_NUM_COS
)
1444 aValue
.appendAscii("COS,");
1445 if(nValue
& SQL_FN_NUM_COT
)
1446 aValue
.appendAscii("COT,");
1447 if(nValue
& SQL_FN_NUM_DEGREES
)
1448 aValue
.appendAscii("DEGREES,");
1449 if(nValue
& SQL_FN_NUM_EXP
)
1450 aValue
.appendAscii("EXP,");
1451 if(nValue
& SQL_FN_NUM_FLOOR
)
1452 aValue
.appendAscii("FLOOR,");
1453 if(nValue
& SQL_FN_NUM_LOG
)
1454 aValue
.appendAscii("LOGF,");
1455 if(nValue
& SQL_FN_NUM_LOG10
)
1456 aValue
.appendAscii("LOG10,");
1457 if(nValue
& SQL_FN_NUM_MOD
)
1458 aValue
.appendAscii("MOD,");
1459 if(nValue
& SQL_FN_NUM_PI
)
1460 aValue
.appendAscii("PI,");
1461 if(nValue
& SQL_FN_NUM_POWER
)
1462 aValue
.appendAscii("POWER,");
1463 if(nValue
& SQL_FN_NUM_RADIANS
)
1464 aValue
.appendAscii("RADIANS,");
1465 if(nValue
& SQL_FN_NUM_RAND
)
1466 aValue
.appendAscii("RAND,");
1467 if(nValue
& SQL_FN_NUM_ROUND
)
1468 aValue
.appendAscii("ROUND,");
1469 if(nValue
& SQL_FN_NUM_SIGN
)
1470 aValue
.appendAscii("SIGN,");
1471 if(nValue
& SQL_FN_NUM_SIN
)
1472 aValue
.appendAscii("SIN,");
1473 if(nValue
& SQL_FN_NUM_SQRT
)
1474 aValue
.appendAscii("SQRT,");
1475 if(nValue
& SQL_FN_NUM_TAN
)
1476 aValue
.appendAscii("TAN,");
1477 if(nValue
& SQL_FN_NUM_TRUNCATE
)
1478 aValue
.appendAscii("TRUNCATE,");
1480 if ( aValue
.getLength() )
1481 aValue
.setLength(aValue
.getLength()-1);
1483 return aValue
.makeStringAndClear();
1485 // -------------------------------------------------------------------------
1486 sal_Bool SAL_CALL
ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException
, RuntimeException
)
1491 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_ODBC_INTERFACE_CONFORMANCE
,nValue
,*this);
1492 return nValue
== SQL_OIC_LEVEL2
;
1496 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_ODBC_INTERFACE_CONFORMANCE
,nValue
,*this);
1497 return nValue
== SQL_OAC_LEVEL2
;
1500 // -------------------------------------------------------------------------
1501 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException
, RuntimeException
)
1506 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_ODBC_INTERFACE_CONFORMANCE
,nValue
,*this);
1507 return nValue
== SQL_OIC_CORE
|| nValue
== SQL_OIC_LEVEL2
|| nValue
== SQL_OIC_LEVEL1
;
1511 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_ODBC_SQL_CONFORMANCE
,nValue
,*this);
1512 return nValue
== SQL_OSC_CORE
|| nValue
== SQL_OAC_LEVEL1
|| nValue
== SQL_OAC_LEVEL2
;
1515 // -------------------------------------------------------------------------
1516 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException
, RuntimeException
)
1521 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_ODBC_INTERFACE_CONFORMANCE
,nValue
,*this);
1522 return nValue
== SQL_OIC_LEVEL1
|| nValue
== SQL_OIC_LEVEL2
;
1526 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_ODBC_INTERFACE_CONFORMANCE
,nValue
,*this);
1527 return nValue
== SQL_OAC_LEVEL1
|| nValue
== SQL_OAC_LEVEL2
;
1530 // -------------------------------------------------------------------------
1531 sal_Bool SAL_CALL
ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException
, RuntimeException
)
1534 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_OJ_CAPABILITIES
,nValue
,*this);
1535 return (nValue
& SQL_OJ_FULL
) == SQL_OJ_FULL
;
1537 // -------------------------------------------------------------------------
1538 sal_Bool SAL_CALL
ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException
, RuntimeException
)
1540 return supportsFullOuterJoins( );
1542 // -------------------------------------------------------------------------
1543 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException
, RuntimeException
)
1545 SQLUSMALLINT nValue
;
1546 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_COLUMNS_IN_GROUP_BY
,nValue
,*this);
1549 // -------------------------------------------------------------------------
1550 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException
, RuntimeException
)
1552 SQLUSMALLINT nValue
;
1553 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_COLUMNS_IN_ORDER_BY
,nValue
,*this);
1556 // -------------------------------------------------------------------------
1557 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException
, RuntimeException
)
1559 SQLUSMALLINT nValue
;
1560 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_COLUMNS_IN_SELECT
,nValue
,*this);
1563 // -------------------------------------------------------------------------
1564 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException
, RuntimeException
)
1566 SQLUSMALLINT nValue
;
1567 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_MAX_USER_NAME_LEN
,nValue
,*this);
1570 // -------------------------------------------------------------------------
1571 sal_Bool SAL_CALL
ODatabaseMetaData::supportsResultSetType( sal_Int32 setType
) throw(SQLException
, RuntimeException
)
1574 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,SQL_CURSOR_SENSITIVITY
,nValue
,*this);
1575 return (nValue
& static_cast<SQLUINTEGER
>(setType
)) == static_cast<SQLUINTEGER
>(setType
);
1577 // -------------------------------------------------------------------------
1578 sal_Bool SAL_CALL
ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType
, sal_Int32 concurrency
) throw(SQLException
, RuntimeException
)
1581 SQLUSMALLINT
nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
);
1585 case ResultSetType::FORWARD_ONLY
:
1586 nAskFor
= SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
;
1588 case ResultSetType::SCROLL_INSENSITIVE
:
1589 nAskFor
= SQL_STATIC_CURSOR_ATTRIBUTES2
;
1591 case ResultSetType::SCROLL_SENSITIVE
:
1592 nAskFor
= SQL_DYNAMIC_CURSOR_ATTRIBUTES2
;
1596 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,nAskFor
,nValue
,*this);
1597 sal_Bool bRet
= sal_False
;
1600 case ResultSetConcurrency::READ_ONLY
:
1601 bRet
= (nValue
& SQL_CA2_READ_ONLY_CONCURRENCY
) == SQL_CA2_READ_ONLY_CONCURRENCY
;
1603 case ResultSetConcurrency::UPDATABLE
:
1604 bRet
= (nValue
& SQL_CA2_OPT_VALUES_CONCURRENCY
) == SQL_CA2_OPT_VALUES_CONCURRENCY
;
1609 // -------------------------------------------------------------------------
1610 sal_Bool SAL_CALL
ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType
) throw(SQLException
, RuntimeException
)
1613 SQLUSMALLINT
nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
);
1617 case ResultSetType::FORWARD_ONLY
:
1618 nAskFor
= SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
;
1620 case ResultSetType::SCROLL_INSENSITIVE
:
1621 nAskFor
= SQL_STATIC_CURSOR_ATTRIBUTES2
;
1623 case ResultSetType::SCROLL_SENSITIVE
:
1624 nAskFor
= SQL_DYNAMIC_CURSOR_ATTRIBUTES2
;
1628 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,nAskFor
,nValue
,*this);
1629 return (nValue
& SQL_CA2_SENSITIVITY_UPDATES
) == SQL_CA2_SENSITIVITY_UPDATES
;
1631 // -------------------------------------------------------------------------
1632 sal_Bool SAL_CALL
ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType
) throw(SQLException
, RuntimeException
)
1635 SQLUSMALLINT
nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
);
1639 case ResultSetType::FORWARD_ONLY
:
1640 nAskFor
= SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
;
1642 case ResultSetType::SCROLL_INSENSITIVE
:
1643 nAskFor
= SQL_STATIC_CURSOR_ATTRIBUTES2
;
1645 case ResultSetType::SCROLL_SENSITIVE
:
1646 nAskFor
= SQL_DYNAMIC_CURSOR_ATTRIBUTES2
;
1650 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,nAskFor
,nValue
,*this);
1651 return (nValue
& SQL_CA2_SENSITIVITY_DELETIONS
) != SQL_CA2_SENSITIVITY_DELETIONS
;
1653 // -------------------------------------------------------------------------
1654 sal_Bool SAL_CALL
ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType
) throw(SQLException
, RuntimeException
)
1657 SQLUSMALLINT
nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
);
1661 case ResultSetType::FORWARD_ONLY
:
1662 nAskFor
= SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
;
1664 case ResultSetType::SCROLL_INSENSITIVE
:
1665 nAskFor
= SQL_STATIC_CURSOR_ATTRIBUTES2
;
1667 case ResultSetType::SCROLL_SENSITIVE
:
1668 nAskFor
= SQL_DYNAMIC_CURSOR_ATTRIBUTES2
;
1672 OTools::GetInfo(m_pConnection
,m_aConnectionHandle
,nAskFor
,nValue
,*this);
1673 return (nValue
& SQL_CA2_SENSITIVITY_ADDITIONS
) == SQL_CA2_SENSITIVITY_ADDITIONS
;
1675 // -------------------------------------------------------------------------
1676 sal_Bool SAL_CALL
ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType
) throw(SQLException
, RuntimeException
)
1678 return ownUpdatesAreVisible(setType
);
1680 // -------------------------------------------------------------------------
1681 sal_Bool SAL_CALL
ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType
) throw(SQLException
, RuntimeException
)
1683 return ownDeletesAreVisible(setType
);
1685 // -------------------------------------------------------------------------
1686 sal_Bool SAL_CALL
ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType
) throw(SQLException
, RuntimeException
)
1688 return ownInsertsAreVisible(setType
);
1690 // -------------------------------------------------------------------------
1691 sal_Bool SAL_CALL
ODatabaseMetaData::updatesAreDetected( sal_Int32
/*setType*/ ) throw(SQLException
, RuntimeException
)
1695 // -------------------------------------------------------------------------
1696 sal_Bool SAL_CALL
ODatabaseMetaData::deletesAreDetected( sal_Int32
/*setType*/ ) throw(SQLException
, RuntimeException
)
1700 // -------------------------------------------------------------------------
1701 sal_Bool SAL_CALL
ODatabaseMetaData::insertsAreDetected( sal_Int32
/*setType*/ ) throw(SQLException
, RuntimeException
)
1705 // -------------------------------------------------------------------------
1706 sal_Bool SAL_CALL
ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException
, RuntimeException
)
1710 // -------------------------------------------------------------------------
1711 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getUDTs( const Any
& /*catalog*/, const ::rtl::OUString
& /*schemaPattern*/, const ::rtl::OUString
& /*typeNamePattern*/, const Sequence
< sal_Int32
>& /*types*/ ) throw(SQLException
, RuntimeException
)
1715 // -----------------------------------------------------------------------------
1717 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */