Update ooo320-m1
[ooovba.git] / connectivity / source / drivers / ado / ADatabaseMetaData.cxx
blobcd4538d83493a21437f102a35396fdcc9abffe62
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ADatabaseMetaData.cxx,v $
10 * $Revision: 1.23 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
33 #include "ado/ADatabaseMetaData.hxx"
34 #include "ado/ADatabaseMetaDataResultSet.hxx"
35 #include <com/sun/star/sdbc/DataType.hpp>
36 #include <com/sun/star/sdbc/ResultSetType.hpp>
37 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
38 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
39 #include "ado/AConnection.hxx"
40 #include "ado/adoimp.hxx"
41 #include "FDatabaseMetaDataResultSet.hxx"
42 #include <comphelper/types.hxx>
43 #include <connectivity/dbexception.hxx>
45 using namespace ::comphelper;
47 using namespace connectivity;
48 using namespace connectivity::ado;
49 using namespace com::sun::star::uno;
50 using namespace com::sun::star::lang;
51 using namespace com::sun::star::beans;
52 using namespace com::sun::star::sdbc;
55 // using namespace connectivity;
57 ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon)
58 : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
59 ,m_pADOConnection(_pCon->getConnection())
60 ,m_pConnection(_pCon)
63 // -------------------------------------------------------------------------
64 sal_Int32 ODatabaseMetaData::getInt32Property(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
66 connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
67 // ADOS::ThrowException(*m_pADOConnection,*this);
68 OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
69 ADO_PROP(_aProperty);
70 sal_Int32 nValue(0);
71 if(!aVar.isNull() && !aVar.isEmpty())
72 nValue = aVar;
73 return nValue;
76 // -------------------------------------------------------------------------
77 sal_Bool ODatabaseMetaData::getBoolProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
79 connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
80 ADOS::ThrowException(*m_pADOConnection,*this);
81 OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
82 ADO_PROP(_aProperty);
83 return (!aVar.isNull() && !aVar.isEmpty() ? aVar.getBool() : sal_False);
85 // -------------------------------------------------------------------------
86 ::rtl::OUString ODatabaseMetaData::getStringProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
88 connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
89 ADOS::ThrowException(*m_pADOConnection,*this);
90 OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
92 ADO_PROP(_aProperty);
93 ::rtl::OUString aValue;
94 if(!aVar.isNull() && !aVar.isEmpty() && aVar.getType() == VT_BSTR)
95 aValue = aVar;
97 return aValue;
99 // -------------------------------------------------------------------------
100 Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
102 ADORecordset *pRecordset = m_pADOConnection->getTypeInfo();
103 // ADOS::ThrowException(*m_pADOConnection,*this);
105 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
106 pResult->setTypeInfoMap(ADOS::isJetEngine(m_pConnection->getEngineType()));
107 Reference< XResultSet > xRef = pResult;
108 return xRef;
110 // -------------------------------------------------------------------------
111 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException)
113 OLEVariant vtEmpty;
114 vtEmpty.setNoArg();
116 ADORecordset *pRecordset = NULL;
117 m_pADOConnection->OpenSchema(adSchemaCatalogs,vtEmpty,vtEmpty,&pRecordset);
118 ADOS::ThrowException(*m_pADOConnection,*this);
120 Reference< XResultSet > xRef;
122 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
123 pResult->setCatalogsMap();
124 xRef = pResult;
126 return xRef;
128 // -------------------------------------------------------------------------
129 ::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
131 return getLiteral(DBLITERAL_CATALOG_SEPARATOR);
133 // -------------------------------------------------------------------------
134 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException)
136 OLEVariant vtEmpty;
137 vtEmpty.setNoArg();
139 ADORecordset *pRecordset = NULL;
140 m_pADOConnection->OpenSchema(adSchemaSchemata,vtEmpty,vtEmpty,&pRecordset);
141 ADOS::ThrowException(*m_pADOConnection,*this);
143 Reference< XResultSet > xRef;
145 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
146 pResult->setSchemasMap();
147 xRef = pResult;
148 return xRef;
150 // -------------------------------------------------------------------------
151 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
152 const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
153 const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
155 ADORecordset *pRecordset = m_pADOConnection->getColumnPrivileges(catalog,schema,table,columnNamePattern);
156 ADOS::ThrowException(*m_pADOConnection,*this);
158 Reference< XResultSet > xRef;
160 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
161 pResult->setColumnPrivilegesMap();
162 xRef = pResult;
163 return xRef;
165 // -------------------------------------------------------------------------
166 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
167 const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern,
168 const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
170 ADORecordset *pRecordset = m_pADOConnection->getColumns(catalog,schemaPattern,tableNamePattern,columnNamePattern);
171 ADOS::ThrowException(*m_pADOConnection,*this);
173 Reference< XResultSet > xRef;
175 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
176 pResult->setColumnsMap();
177 xRef = pResult;
179 return xRef;
181 // -------------------------------------------------------------------------
182 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
183 const Any& catalog, const ::rtl::OUString& schemaPattern,
184 const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
186 ADORecordset *pRecordset = m_pADOConnection->getTables(catalog,schemaPattern,tableNamePattern,types);
187 ADOS::ThrowException(*m_pADOConnection,*this);
189 Reference< XResultSet > xRef;
191 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
192 pResult->setTablesMap();
193 xRef = pResult;
195 return xRef;
197 // -------------------------------------------------------------------------
198 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
199 const Any& catalog, const ::rtl::OUString& schemaPattern,
200 const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
202 ADORecordset *pRecordset = m_pADOConnection->getProcedureColumns(catalog,schemaPattern,procedureNamePattern,columnNamePattern);
203 ADOS::ThrowException(*m_pADOConnection,*this);
205 Reference< XResultSet > xRef;
207 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
208 pResult->setProcedureColumnsMap();
209 xRef = pResult;
211 return xRef;
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 // Create elements used in the array
219 ADORecordset *pRecordset = m_pADOConnection->getProcedures(catalog,schemaPattern,procedureNamePattern);
220 ADOS::ThrowException(*m_pADOConnection,*this);
222 Reference< XResultSet > xRef;
224 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
225 pResult->setProceduresMap();
226 xRef = pResult;
228 return xRef;
230 // -------------------------------------------------------------------------
231 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
233 return getMaxSize(DBLITERAL_BINARY_LITERAL);
235 // -------------------------------------------------------------------------
236 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
238 return getInt32Property(::rtl::OUString::createFromAscii("Maximum Row Size"));
240 // -------------------------------------------------------------------------
241 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
243 return getMaxSize(DBLITERAL_CATALOG_NAME);
245 // -------------------------------------------------------------------------
246 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
248 return getMaxSize(DBLITERAL_CHAR_LITERAL);
250 // -------------------------------------------------------------------------
251 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
253 return getMaxSize(DBLITERAL_COLUMN_NAME);
255 // -------------------------------------------------------------------------
256 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
258 // return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Index"));
259 return 0;
261 // -------------------------------------------------------------------------
262 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
264 return getMaxSize(DBLITERAL_CURSOR_NAME);
266 // -------------------------------------------------------------------------
267 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
269 return getInt32Property(::rtl::OUString::createFromAscii("Active Sessions"));
271 // -------------------------------------------------------------------------
272 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
274 return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Table"));
276 // -------------------------------------------------------------------------
277 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
279 return getMaxSize(DBLITERAL_TEXT_COMMAND);
281 // -------------------------------------------------------------------------
282 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
284 return getMaxSize(DBLITERAL_TABLE_NAME);
286 // -------------------------------------------------------------------------
287 sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
289 return getInt32Property(::rtl::OUString::createFromAscii("Maximum Tables in SELECT"));
291 // -------------------------------------------------------------------------
292 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
293 const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
295 ADORecordset *pRecordset = m_pADOConnection->getExportedKeys(catalog,schema,table);
296 ADOS::ThrowException(*m_pADOConnection,*this);
298 Reference< XResultSet > xRef;
299 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
300 pResult->setCrossReferenceMap();
301 xRef = pResult;
303 return xRef;
305 // -------------------------------------------------------------------------
306 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
307 const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
309 ADORecordset *pRecordset = m_pADOConnection->getImportedKeys(catalog,schema,table);
310 ADOS::ThrowException(*m_pADOConnection,*this);
312 Reference< XResultSet > xRef;
314 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
315 pResult->setCrossReferenceMap();
316 xRef = pResult;
318 return xRef;
320 // -------------------------------------------------------------------------
321 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
322 const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
324 ADORecordset *pRecordset = m_pADOConnection->getPrimaryKeys(catalog,schema,table);
325 ADOS::ThrowException(*m_pADOConnection,*this);
327 Reference< XResultSet > xRef;
329 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
330 pResult->setPrimaryKeysMap();
331 xRef = pResult;
333 return xRef;
335 // -------------------------------------------------------------------------
336 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
337 const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
338 sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException)
340 ADORecordset *pRecordset = m_pADOConnection->getIndexInfo(catalog,schema,table,unique,approximate);
341 ADOS::ThrowException(*m_pADOConnection,*this);
343 Reference< XResultSet > xRef;
345 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
346 pResult->setIndexInfoMap();
347 xRef = pResult;
349 return xRef;
351 // -------------------------------------------------------------------------
352 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
353 const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
355 Reference< XResultSet > xRef;
356 if(!ADOS::isJetEngine(m_pConnection->getEngineType()))
357 { // the jet provider doesn't support this method
358 // Create elements used in the array
360 ADORecordset *pRecordset = m_pADOConnection->getTablePrivileges(catalog,schemaPattern,tableNamePattern);
361 ADOS::ThrowException(*m_pADOConnection,*this);
363 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
364 pResult->setTablePrivilegesMap();
365 xRef = pResult;
367 else
369 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTablePrivileges);
370 xRef = pResult;
371 ::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
372 ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8);
373 aRows.reserve(8);
375 aRow[0] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
376 aRow[1] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
377 aRow[2] = new ::connectivity::ORowSetValueDecorator(tableNamePattern);
378 aRow[3] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
379 aRow[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
380 aRow[5] = new ::connectivity::ORowSetValueDecorator(getUserName());
381 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue();
382 aRow[7] = new ::connectivity::ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO"));
384 aRows.push_back(aRow);
385 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue();
386 aRows.push_back(aRow);
387 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDeleteValue();
388 aRows.push_back(aRow);
389 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getUpdateValue();
390 aRows.push_back(aRow);
391 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getCreateValue();
392 aRows.push_back(aRow);
393 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getReadValue();
394 aRows.push_back(aRow);
395 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getAlterValue();
396 aRows.push_back(aRow);
397 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDropValue();
398 aRows.push_back(aRow);
399 pResult->setRows(aRows);
402 return xRef;
404 // -------------------------------------------------------------------------
405 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
406 const Any& primaryCatalog, const ::rtl::OUString& primarySchema,
407 const ::rtl::OUString& primaryTable, const Any& foreignCatalog,
408 const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException)
410 ADORecordset *pRecordset = m_pADOConnection->getCrossReference(primaryCatalog,primarySchema,primaryTable,foreignCatalog,foreignSchema,foreignTable);
411 ADOS::ThrowException(*m_pADOConnection,*this);
413 Reference< XResultSet > xRef;
415 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
416 pResult->setCrossReferenceMap();
417 xRef = pResult;
419 return xRef;
421 // -------------------------------------------------------------------------
422 sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
424 return getBoolProperty(::rtl::OUString::createFromAscii("Maximum Row Size Includes BLOB"));
426 // -------------------------------------------------------------------------
427 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
429 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ;
431 // -------------------------------------------------------------------------
432 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
434 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ;
436 // -------------------------------------------------------------------------
437 sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
439 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ;
441 // -------------------------------------------------------------------------
442 sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
444 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ;
446 // -------------------------------------------------------------------------
447 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
449 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ;
451 // -------------------------------------------------------------------------
452 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
454 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ;
456 // -------------------------------------------------------------------------
457 sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
459 return sal_True;
461 // -------------------------------------------------------------------------
462 sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
464 return sal_True;
466 // -------------------------------------------------------------------------
467 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
469 return getInt32Property(::rtl::OUString::createFromAscii("Maximum Index Size"));
471 // -------------------------------------------------------------------------
472 sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
474 return getInt32Property(::rtl::OUString::createFromAscii("NULL Concatenation Behavior")) == DBPROPVAL_CB_NON_NULL;
476 // -------------------------------------------------------------------------
477 ::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
479 return getStringProperty(::rtl::OUString::createFromAscii("Catalog Term"));
481 // -------------------------------------------------------------------------
482 ::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
484 return getLiteral(DBLITERAL_QUOTE_PREFIX);
487 // -------------------------------------------------------------------------
488 ::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
490 // return getStringProperty(::rtl::OUString::createFromAscii("Special Characters"));
491 return ::rtl::OUString();
493 // -------------------------------------------------------------------------
494 sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
496 return isCapable(DBLITERAL_CORRELATION_NAME);
498 // -------------------------------------------------------------------------
499 sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
501 return getInt32Property(::rtl::OUString::createFromAscii("Catalog Location")) == DBPROPVAL_CL_START;
503 // -------------------------------------------------------------------------
504 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
506 return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DDL_IGNORE;
508 // -------------------------------------------------------------------------
509 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
511 return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DDL_COMMIT;
513 // -------------------------------------------------------------------------
514 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
516 return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DML;
518 // -------------------------------------------------------------------------
519 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
521 return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_ALL;
523 // -------------------------------------------------------------------------
524 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
526 return sal_True;
528 // -------------------------------------------------------------------------
529 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
531 return sal_True;
533 // -------------------------------------------------------------------------
534 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
536 return getInt32Property(::rtl::OUString::createFromAscii("Prepare Abort Behavior")) == DBPROPVAL_CB_PRESERVE;
538 // -------------------------------------------------------------------------
539 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
541 return getInt32Property(::rtl::OUString::createFromAscii("Prepare Commit Behavior")) == DBPROPVAL_CB_PRESERVE;
543 // -------------------------------------------------------------------------
544 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
546 return (getInt32Property(::rtl::OUString::createFromAscii("Isolation Retention")) & DBPROPVAL_TR_COMMIT) == DBPROPVAL_TR_COMMIT;
548 // -------------------------------------------------------------------------
549 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
551 return (getInt32Property(::rtl::OUString::createFromAscii("Isolation Retention")) & DBPROPVAL_TR_ABORT) == DBPROPVAL_TR_ABORT;
553 // -------------------------------------------------------------------------
554 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException)
556 sal_Bool bValue(sal_False);
558 sal_Int32 nTxn = getInt32Property(::rtl::OUString::createFromAscii("Isolation Levels"));
559 if(level == TransactionIsolation::NONE)
560 bValue = sal_True;
561 else if(level == TransactionIsolation::READ_UNCOMMITTED)
562 bValue = (nTxn & DBPROPVAL_TI_READUNCOMMITTED) == DBPROPVAL_TI_READUNCOMMITTED;
563 else if(level == TransactionIsolation::READ_COMMITTED)
564 bValue = (nTxn & DBPROPVAL_TI_READCOMMITTED) == DBPROPVAL_TI_READCOMMITTED;
565 else if(level == TransactionIsolation::REPEATABLE_READ)
566 bValue = (nTxn & DBPROPVAL_TI_REPEATABLEREAD) == DBPROPVAL_TI_REPEATABLEREAD;
567 else if(level == TransactionIsolation::SERIALIZABLE)
568 bValue = (nTxn & DBPROPVAL_TI_SERIALIZABLE) == DBPROPVAL_TI_SERIALIZABLE;
570 return bValue;
572 // -------------------------------------------------------------------------
573 sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
575 return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_DML_STATEMENTS) == DBPROPVAL_SU_DML_STATEMENTS;
577 // -------------------------------------------------------------------------
578 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
580 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
581 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_FULL) == DBPROPVAL_SQL_ANSI92_FULL);
583 // -------------------------------------------------------------------------
584 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
586 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
587 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_ENTRY) == DBPROPVAL_SQL_ANSI92_ENTRY);
589 // -------------------------------------------------------------------------
590 sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
592 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
593 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI89_IEF) == DBPROPVAL_SQL_ANSI89_IEF);
595 // -------------------------------------------------------------------------
596 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
598 return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_INDEX_DEFINITION) == DBPROPVAL_SU_INDEX_DEFINITION;
600 // -------------------------------------------------------------------------
601 sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
603 return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_TABLE_DEFINITION) == DBPROPVAL_SU_TABLE_DEFINITION;
605 // -------------------------------------------------------------------------
606 sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
608 // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_TABLE_DEFINITION) == DBPROPVAL_CU_TABLE_DEFINITION;
609 return sal_False;
611 // -------------------------------------------------------------------------
612 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
614 // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_INDEX_DEFINITION) == DBPROPVAL_CU_INDEX_DEFINITION;
615 return sal_False;
617 // -------------------------------------------------------------------------
618 sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
620 // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_DML_STATEMENTS) == DBPROPVAL_CU_DML_STATEMENTS;
621 return sal_False;
623 // -------------------------------------------------------------------------
624 sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
626 if ( ADOS::isJetEngine(m_pConnection->getEngineType()) )
627 return sal_True;
628 return getBoolProperty(::rtl::OUString::createFromAscii("Outer Join Capabilities"));
630 // -------------------------------------------------------------------------
631 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
633 return new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
635 // -------------------------------------------------------------------------
636 sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
638 return 0;
640 // -------------------------------------------------------------------------
641 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
643 return getMaxSize(DBLITERAL_PROCEDURE_NAME);
645 // -------------------------------------------------------------------------
646 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
648 return getMaxSize(DBLITERAL_SCHEMA_NAME);
650 // -------------------------------------------------------------------------
651 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
653 return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_NONE;
655 // -------------------------------------------------------------------------
656 sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
658 return sal_True;
660 // -------------------------------------------------------------------------
661 sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
663 return sal_True;
665 // -------------------------------------------------------------------------
666 sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
668 return sal_True;
670 // -------------------------------------------------------------------------
671 sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
673 return sal_True;
675 // -------------------------------------------------------------------------
676 sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
678 return getBoolProperty(::rtl::OUString::createFromAscii("Read-Only Data Source"));
680 // -------------------------------------------------------------------------
681 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
683 return sal_False;
685 // -------------------------------------------------------------------------
686 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
688 return sal_False;
690 // -------------------------------------------------------------------------
691 sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
693 return sal_True;
695 // -------------------------------------------------------------------------
696 sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
698 return getInt32Property(::rtl::OUString::createFromAscii("NULL Concatenation Behavior")) == DBPROPVAL_CB_NULL;
700 // -------------------------------------------------------------------------
701 sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
703 return isCapable(DBLITERAL_COLUMN_ALIAS);
705 // -------------------------------------------------------------------------
706 sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
708 return isCapable(DBLITERAL_CORRELATION_NAME);
710 // -------------------------------------------------------------------------
711 sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException)
713 return getBoolProperty(::rtl::OUString::createFromAscii("Rowset Conversions on Command"));
715 // -------------------------------------------------------------------------
716 sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
718 return getBoolProperty(::rtl::OUString::createFromAscii("ORDER BY Columns in Select List"));
720 // -------------------------------------------------------------------------
721 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
723 return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) != DBPROPVAL_GB_NOT_SUPPORTED;
725 // -------------------------------------------------------------------------
726 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
728 return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) != DBPROPVAL_GB_CONTAINS_SELECT;
730 // -------------------------------------------------------------------------
731 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
733 return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) == DBPROPVAL_GB_NO_RELATION;
735 // -------------------------------------------------------------------------
736 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
738 return sal_True;
740 // -------------------------------------------------------------------------
741 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
743 return sal_False;
745 // -------------------------------------------------------------------------
746 sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
748 return isCapable(DBLITERAL_ESCAPE_PERCENT);
750 // -------------------------------------------------------------------------
751 sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
753 return getBoolProperty(::rtl::OUString::createFromAscii("ORDER BY Columns in Select List"));
755 // -------------------------------------------------------------------------
756 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
758 return sal_True;
760 // -------------------------------------------------------------------------
761 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
763 return sal_True;
765 // -------------------------------------------------------------------------
766 sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
768 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED;
770 // -------------------------------------------------------------------------
771 sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
773 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED;
775 // -------------------------------------------------------------------------
776 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
778 return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_END) == DBPROPVAL_NC_END;
780 // -------------------------------------------------------------------------
781 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
783 return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_START) == DBPROPVAL_NC_START;
785 // -------------------------------------------------------------------------
786 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
788 return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_HIGH) == DBPROPVAL_NC_HIGH;
790 // -------------------------------------------------------------------------
791 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
793 return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_LOW) == DBPROPVAL_NC_LOW;
795 // -------------------------------------------------------------------------
796 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
798 return sal_False;
800 // -------------------------------------------------------------------------
801 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
803 return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_PRIVILEGE_DEFINITION) == DBPROPVAL_SU_PRIVILEGE_DEFINITION;
805 // -------------------------------------------------------------------------
806 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
808 return sal_False;
810 // -------------------------------------------------------------------------
811 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
813 // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_PRIVILEGE_DEFINITION) == DBPROPVAL_CU_PRIVILEGE_DEFINITION;
814 return sal_False;
816 // -------------------------------------------------------------------------
817 sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
819 return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_CORRELATEDSUBQUERIES) == DBPROPVAL_SQ_CORRELATEDSUBQUERIES;
821 // -------------------------------------------------------------------------
822 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
824 return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_COMPARISON) == DBPROPVAL_SQ_COMPARISON;
826 // -------------------------------------------------------------------------
827 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
829 return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_EXISTS) == DBPROPVAL_SQ_EXISTS;
831 // -------------------------------------------------------------------------
832 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
834 return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_IN) == DBPROPVAL_SQ_IN;
836 // -------------------------------------------------------------------------
837 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
839 return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_QUANTIFIED) == DBPROPVAL_SQ_QUANTIFIED;
841 // -------------------------------------------------------------------------
842 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
844 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
845 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_INTERMEDIATE) == DBPROPVAL_SQL_ANSI92_INTERMEDIATE);
847 // -------------------------------------------------------------------------
848 ::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
850 return ::rtl::OUString::createFromAscii("sdbc:ado:")+ m_pADOConnection->GetConnectionString();
852 // -------------------------------------------------------------------------
853 ::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
855 return getStringProperty(::rtl::OUString::createFromAscii("User Name"));
857 // -------------------------------------------------------------------------
858 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
860 return getStringProperty(::rtl::OUString::createFromAscii("Provider Friendly Name"));
862 // -------------------------------------------------------------------------
863 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException)
865 return getStringProperty(::rtl::OUString::createFromAscii("Provider Version"));
867 // -------------------------------------------------------------------------
868 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
870 return getStringProperty(::rtl::OUString::createFromAscii("DBMS Version"));
872 // -------------------------------------------------------------------------
873 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
875 return getStringProperty(::rtl::OUString::createFromAscii("DBMS Name"));
877 // -------------------------------------------------------------------------
878 ::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
880 return getStringProperty(::rtl::OUString::createFromAscii("Procedure Term"));
882 // -------------------------------------------------------------------------
883 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
885 return getStringProperty(::rtl::OUString::createFromAscii("Schema Term"));
887 // -------------------------------------------------------------------------
888 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
890 return 1;
892 // -------------------------------------------------------------------------
893 sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
895 sal_Int32 nRet = TransactionIsolation::NONE;
896 switch(m_pADOConnection->get_IsolationLevel())
898 case adXactReadCommitted:
899 nRet = TransactionIsolation::READ_COMMITTED;
900 break;
901 case adXactRepeatableRead:
902 nRet = TransactionIsolation::REPEATABLE_READ;
903 break;
904 case adXactSerializable:
905 nRet = TransactionIsolation::SERIALIZABLE;
906 break;
907 case adXactReadUncommitted:
908 nRet = TransactionIsolation::READ_UNCOMMITTED;
909 break;
910 default:
913 return nRet;
915 // -------------------------------------------------------------------------
916 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
918 return 0;
920 // -------------------------------------------------------------------------
921 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
923 ADORecordset *pRecordset = NULL;
924 OLEVariant vtEmpty;
925 vtEmpty.setNoArg();
926 m_pADOConnection->OpenSchema(adSchemaDBInfoKeywords,vtEmpty,vtEmpty,&pRecordset);
927 OSL_ENSURE(pRecordset,"getSQLKeywords: no resultset!");
928 ADOS::ThrowException(*m_pADOConnection,*this);
929 if ( pRecordset )
931 WpADORecordset aRecordset(pRecordset);
933 aRecordset.MoveFirst();
934 OLEVariant aValue;
935 ::rtl::OUString aRet,aComma = ::rtl::OUString::createFromAscii(",");
936 while(!aRecordset.IsAtEOF())
938 WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields());
939 WpADOField aField(aFields.GetItem(0));
940 aField.get_Value(aValue);
941 aRet = aRet + aValue + aComma;
942 aRecordset.MoveNext();
944 aRecordset.Close();
945 if ( aRet.getLength() )
946 return aRet.copy(0,aRet.lastIndexOf(','));
948 return ::rtl::OUString();
950 // -------------------------------------------------------------------------
951 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
953 return getLiteral(DBLITERAL_ESCAPE_PERCENT);
955 // -------------------------------------------------------------------------
956 ::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
958 ::rtl::OUString aValue;
959 return aValue.copy(0,aValue.lastIndexOf(','));
961 // -------------------------------------------------------------------------
962 ::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
964 ::rtl::OUString aValue;
965 return aValue;
967 // -------------------------------------------------------------------------
968 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
970 ::rtl::OUString aValue;
971 return aValue.copy(0,aValue.lastIndexOf(','));
973 // -------------------------------------------------------------------------
974 ::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
976 ::rtl::OUString aValue;
977 return aValue;
979 // -------------------------------------------------------------------------
980 sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
982 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
983 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_EXTENDED) == DBPROPVAL_SQL_ODBC_EXTENDED);
985 // -------------------------------------------------------------------------
986 sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
988 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
989 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_CORE) == DBPROPVAL_SQL_ODBC_CORE);
991 // -------------------------------------------------------------------------
992 sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
994 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
995 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_MINIMUM) == DBPROPVAL_SQL_ODBC_MINIMUM);
997 // -------------------------------------------------------------------------
998 sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
1000 if ( ADOS::isJetEngine(m_pConnection->getEngineType()) )
1001 return sal_True;
1002 return (getInt32Property(::rtl::OUString::createFromAscii("Outer Join Capabilities")) & 0x00000004L) == 0x00000004L;
1004 // -------------------------------------------------------------------------
1005 sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
1007 return supportsFullOuterJoins( );
1009 // -------------------------------------------------------------------------
1010 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
1012 return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in GROUP BY"));
1014 // -------------------------------------------------------------------------
1015 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
1017 return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in ORDER BY"));
1019 // -------------------------------------------------------------------------
1020 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
1022 return 0; // getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Select"));
1024 // -------------------------------------------------------------------------
1025 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
1027 return getMaxSize(DBLITERAL_USER_NAME);
1029 // -------------------------------------------------------------------------
1030 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
1032 return sal_True;
1034 // -------------------------------------------------------------------------
1035 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException)
1037 return sal_True;
1039 // -------------------------------------------------------------------------
1040 sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1042 return ResultSetType::FORWARD_ONLY != setType;
1044 // -------------------------------------------------------------------------
1045 sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1047 return ResultSetType::FORWARD_ONLY != setType;
1049 // -------------------------------------------------------------------------
1050 sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1052 return ResultSetType::FORWARD_ONLY != setType;
1054 // -------------------------------------------------------------------------
1055 sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1057 return ResultSetType::FORWARD_ONLY != setType;
1059 // -------------------------------------------------------------------------
1060 sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1062 return ResultSetType::FORWARD_ONLY != setType;
1064 // -------------------------------------------------------------------------
1065 sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1067 return ResultSetType::FORWARD_ONLY != setType;
1069 // -------------------------------------------------------------------------
1070 sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
1072 return ResultSetType::FORWARD_ONLY != setType;
1074 // -------------------------------------------------------------------------
1075 sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
1077 return ResultSetType::FORWARD_ONLY != setType;
1079 // -------------------------------------------------------------------------
1080 sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
1082 return ResultSetType::FORWARD_ONLY != setType;
1084 // -------------------------------------------------------------------------
1085 sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
1087 return sal_True;
1089 // -------------------------------------------------------------------------
1090 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)
1092 ::dbtools::throwFeatureNotImplementedException( "XDatabaseMetaData::getUDTs", *this );
1093 return Reference< XResultSet >();
1095 // -------------------------------------------------------------------------