1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_connectivity.hxx"
26 #include "ado/ADatabaseMetaData.hxx"
27 #include "ado/ADatabaseMetaDataResultSet.hxx"
28 #include <com/sun/star/sdbc/DataType.hpp>
29 #include <com/sun/star/sdbc/ResultSetType.hpp>
30 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
31 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
32 #include "ado/AConnection.hxx"
33 #include "ado/adoimp.hxx"
34 #include "FDatabaseMetaDataResultSet.hxx"
35 #include <comphelper/types.hxx>
36 #include <connectivity/dbexception.hxx>
37
38 using namespace ::comphelper;
39
40 using namespace connectivity;
41 using namespace connectivity::ado;
42 using namespace com::sun::star::uno;
43 using namespace com::sun::star::lang;
44 using namespace com::sun::star::beans;
45 using namespace com::sun::star::sdbc;
46
47
48 // using namespace connectivity;
49
ODatabaseMetaData(OConnection * _pCon)50 ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon)
51 : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
52 ,m_pADOConnection(_pCon->getConnection())
53 ,m_pConnection(_pCon)
54 {
55 }
56 // -------------------------------------------------------------------------
getInt32Property(const::rtl::OUString & _aProperty)57 sal_Int32 ODatabaseMetaData::getInt32Property(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
58 {
59 connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
60 // ADOS::ThrowException(*m_pADOConnection,*this);
61 OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
62 ADO_PROP(_aProperty);
63 sal_Int32 nValue(0);
64 if(!aVar.isNull() && !aVar.isEmpty())
65 nValue = aVar;
66 return nValue;
67 }
68
69 // -------------------------------------------------------------------------
getBoolProperty(const::rtl::OUString & _aProperty)70 sal_Bool ODatabaseMetaData::getBoolProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
71 {
72 connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
73 ADOS::ThrowException(*m_pADOConnection,*this);
74 OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
75 ADO_PROP(_aProperty);
76 return (!aVar.isNull() && !aVar.isEmpty() ? aVar.getBool() : sal_False);
77 }
78 // -------------------------------------------------------------------------
getStringProperty(const::rtl::OUString & _aProperty)79 ::rtl::OUString ODatabaseMetaData::getStringProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
80 {
81 connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties());
82 ADOS::ThrowException(*m_pADOConnection,*this);
83 OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
84
85 ADO_PROP(_aProperty);
86 ::rtl::OUString aValue;
87 if(!aVar.isNull() && !aVar.isEmpty() && aVar.getType() == VT_BSTR)
88 aValue = aVar;
89
90 return aValue;
91 }
92 // -------------------------------------------------------------------------
impl_getTypeInfo_throw()93 Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
94 {
95 ADORecordset *pRecordset = m_pADOConnection->getTypeInfo();
96 // ADOS::ThrowException(*m_pADOConnection,*this);
97
98 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
99 pResult->setTypeInfoMap(ADOS::isJetEngine(m_pConnection->getEngineType()));
100 Reference< XResultSet > xRef = pResult;
101 return xRef;
102 }
103 // -------------------------------------------------------------------------
getCatalogs()104 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException)
105 {
106 OLEVariant vtEmpty;
107 vtEmpty.setNoArg();
108
109 ADORecordset *pRecordset = NULL;
110 m_pADOConnection->OpenSchema(adSchemaCatalogs,vtEmpty,vtEmpty,&pRecordset);
111 ADOS::ThrowException(*m_pADOConnection,*this);
112
113 Reference< XResultSet > xRef;
114
115 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
116 pResult->setCatalogsMap();
117 xRef = pResult;
118
119 return xRef;
120 }
121 // -------------------------------------------------------------------------
impl_getCatalogSeparator_throw()122 ::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
123 {
124 return getLiteral(DBLITERAL_CATALOG_SEPARATOR);
125 }
126 // -------------------------------------------------------------------------
getSchemas()127 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException)
128 {
129 OLEVariant vtEmpty;
130 vtEmpty.setNoArg();
131
132 ADORecordset *pRecordset = NULL;
133 m_pADOConnection->OpenSchema(adSchemaSchemata,vtEmpty,vtEmpty,&pRecordset);
134 ADOS::ThrowException(*m_pADOConnection,*this);
135
136 Reference< XResultSet > xRef;
137
138 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
139 pResult->setSchemasMap();
140 xRef = pResult;
141 return xRef;
142 }
143 // -------------------------------------------------------------------------
getColumnPrivileges(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table,const::rtl::OUString & columnNamePattern)144 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
145 const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
146 const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
147 {
148 ADORecordset *pRecordset = m_pADOConnection->getColumnPrivileges(catalog,schema,table,columnNamePattern);
149 ADOS::ThrowException(*m_pADOConnection,*this);
150
151 Reference< XResultSet > xRef;
152
153 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
154 pResult->setColumnPrivilegesMap();
155 xRef = pResult;
156 return xRef;
157 }
158 // -------------------------------------------------------------------------
getColumns(const Any & catalog,const::rtl::OUString & schemaPattern,const::rtl::OUString & tableNamePattern,const::rtl::OUString & columnNamePattern)159 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
160 const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern,
161 const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
162 {
163 ADORecordset *pRecordset = m_pADOConnection->getColumns(catalog,schemaPattern,tableNamePattern,columnNamePattern);
164 ADOS::ThrowException(*m_pADOConnection,*this);
165
166 Reference< XResultSet > xRef;
167
168 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
169 pResult->setColumnsMap();
170 xRef = pResult;
171
172 return xRef;
173 }
174 // -------------------------------------------------------------------------
getTables(const Any & catalog,const::rtl::OUString & schemaPattern,const::rtl::OUString & tableNamePattern,const Sequence<::rtl::OUString> & types)175 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
176 const Any& catalog, const ::rtl::OUString& schemaPattern,
177 const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
178 {
179 ADORecordset *pRecordset = m_pADOConnection->getTables(catalog,schemaPattern,tableNamePattern,types);
180 ADOS::ThrowException(*m_pADOConnection,*this);
181
182 Reference< XResultSet > xRef;
183
184 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
185 pResult->setTablesMap();
186 xRef = pResult;
187
188 return xRef;
189 }
190 // -------------------------------------------------------------------------
getProcedureColumns(const Any & catalog,const::rtl::OUString & schemaPattern,const::rtl::OUString & procedureNamePattern,const::rtl::OUString & columnNamePattern)191 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
192 const Any& catalog, const ::rtl::OUString& schemaPattern,
193 const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
194 {
195 ADORecordset *pRecordset = m_pADOConnection->getProcedureColumns(catalog,schemaPattern,procedureNamePattern,columnNamePattern);
196 ADOS::ThrowException(*m_pADOConnection,*this);
197
198 Reference< XResultSet > xRef;
199
200 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
201 pResult->setProcedureColumnsMap();
202 xRef = pResult;
203
204 return xRef;
205 }
206 // -------------------------------------------------------------------------
getProcedures(const Any & catalog,const::rtl::OUString & schemaPattern,const::rtl::OUString & procedureNamePattern)207 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
208 const Any& catalog, const ::rtl::OUString& schemaPattern,
209 const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException)
210 {
211 // Create elements used in the array
212 ADORecordset *pRecordset = m_pADOConnection->getProcedures(catalog,schemaPattern,procedureNamePattern);
213 ADOS::ThrowException(*m_pADOConnection,*this);
214
215 Reference< XResultSet > xRef;
216
217 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
218 pResult->setProceduresMap();
219 xRef = pResult;
220
221 return xRef;
222 }
223 // -------------------------------------------------------------------------
getMaxBinaryLiteralLength()224 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
225 {
226 return getMaxSize(DBLITERAL_BINARY_LITERAL);
227 }
228 // -------------------------------------------------------------------------
getMaxRowSize()229 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
230 {
231 return getInt32Property(::rtl::OUString::createFromAscii("Maximum Row Size"));
232 }
233 // -------------------------------------------------------------------------
getMaxCatalogNameLength()234 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
235 {
236 return getMaxSize(DBLITERAL_CATALOG_NAME);
237 }
238 // -------------------------------------------------------------------------
getMaxCharLiteralLength()239 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
240 {
241 return getMaxSize(DBLITERAL_CHAR_LITERAL);
242 }
243 // -------------------------------------------------------------------------
getMaxColumnNameLength()244 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
245 {
246 return getMaxSize(DBLITERAL_COLUMN_NAME);
247 }
248 // -------------------------------------------------------------------------
getMaxColumnsInIndex()249 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
250 {
251 // return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Index"));
252 return 0;
253 }
254 // -------------------------------------------------------------------------
getMaxCursorNameLength()255 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
256 {
257 return getMaxSize(DBLITERAL_CURSOR_NAME);
258 }
259 // -------------------------------------------------------------------------
getMaxConnections()260 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
261 {
262 return getInt32Property(::rtl::OUString::createFromAscii("Active Sessions"));
263 }
264 // -------------------------------------------------------------------------
getMaxColumnsInTable()265 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
266 {
267 return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Table"));
268 }
269 // -------------------------------------------------------------------------
getMaxStatementLength()270 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
271 {
272 return getMaxSize(DBLITERAL_TEXT_COMMAND);
273 }
274 // -------------------------------------------------------------------------
getMaxTableNameLength()275 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
276 {
277 return getMaxSize(DBLITERAL_TABLE_NAME);
278 }
279 // -------------------------------------------------------------------------
impl_getMaxTablesInSelect_throw()280 sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
281 {
282 return getInt32Property(::rtl::OUString::createFromAscii("Maximum Tables in SELECT"));
283 }
284 // -------------------------------------------------------------------------
getExportedKeys(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table)285 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
286 const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
287 {
288 ADORecordset *pRecordset = m_pADOConnection->getExportedKeys(catalog,schema,table);
289 ADOS::ThrowException(*m_pADOConnection,*this);
290
291 Reference< XResultSet > xRef;
292 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
293 pResult->setCrossReferenceMap();
294 xRef = pResult;
295
296 return xRef;
297 }
298 // -------------------------------------------------------------------------
getImportedKeys(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table)299 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
300 const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
301 {
302 ADORecordset *pRecordset = m_pADOConnection->getImportedKeys(catalog,schema,table);
303 ADOS::ThrowException(*m_pADOConnection,*this);
304
305 Reference< XResultSet > xRef;
306
307 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
308 pResult->setCrossReferenceMap();
309 xRef = pResult;
310
311 return xRef;
312 }
313 // -------------------------------------------------------------------------
getPrimaryKeys(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table)314 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
315 const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
316 {
317 ADORecordset *pRecordset = m_pADOConnection->getPrimaryKeys(catalog,schema,table);
318 ADOS::ThrowException(*m_pADOConnection,*this);
319
320 Reference< XResultSet > xRef;
321
322 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
323 pResult->setPrimaryKeysMap();
324 xRef = pResult;
325
326 return xRef;
327 }
328 // -------------------------------------------------------------------------
getIndexInfo(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table,sal_Bool unique,sal_Bool approximate)329 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
330 const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
331 sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException)
332 {
333 ADORecordset *pRecordset = m_pADOConnection->getIndexInfo(catalog,schema,table,unique,approximate);
334 ADOS::ThrowException(*m_pADOConnection,*this);
335
336 Reference< XResultSet > xRef;
337
338 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
339 pResult->setIndexInfoMap();
340 xRef = pResult;
341
342 return xRef;
343 }
344 // -------------------------------------------------------------------------
getTablePrivileges(const Any & catalog,const::rtl::OUString & schemaPattern,const::rtl::OUString & tableNamePattern)345 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
346 const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
347 {
348 Reference< XResultSet > xRef;
349 if(!ADOS::isJetEngine(m_pConnection->getEngineType()))
350 { // the jet provider doesn't support this method
351 // Create elements used in the array
352
353 ADORecordset *pRecordset = m_pADOConnection->getTablePrivileges(catalog,schemaPattern,tableNamePattern);
354 ADOS::ThrowException(*m_pADOConnection,*this);
355
356 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
357 pResult->setTablePrivilegesMap();
358 xRef = pResult;
359 }
360 else
361 {
362 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTablePrivileges);
363 xRef = pResult;
364 ::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
365 ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8);
366 aRows.reserve(8);
367
368 aRow[0] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
369 aRow[1] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
370 aRow[2] = new ::connectivity::ORowSetValueDecorator(tableNamePattern);
371 aRow[3] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
372 aRow[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
373 aRow[5] = new ::connectivity::ORowSetValueDecorator(getUserName());
374 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue();
375 aRow[7] = new ::connectivity::ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO"));
376
377 aRows.push_back(aRow);
378 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue();
379 aRows.push_back(aRow);
380 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDeleteValue();
381 aRows.push_back(aRow);
382 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getUpdateValue();
383 aRows.push_back(aRow);
384 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getCreateValue();
385 aRows.push_back(aRow);
386 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getReadValue();
387 aRows.push_back(aRow);
388 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getAlterValue();
389 aRows.push_back(aRow);
390 aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDropValue();
391 aRows.push_back(aRow);
392 pResult->setRows(aRows);
393 }
394
395 return xRef;
396 }
397 // -------------------------------------------------------------------------
getCrossReference(const Any & primaryCatalog,const::rtl::OUString & primarySchema,const::rtl::OUString & primaryTable,const Any & foreignCatalog,const::rtl::OUString & foreignSchema,const::rtl::OUString & foreignTable)398 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
399 const Any& primaryCatalog, const ::rtl::OUString& primarySchema,
400 const ::rtl::OUString& primaryTable, const Any& foreignCatalog,
401 const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException)
402 {
403 ADORecordset *pRecordset = m_pADOConnection->getCrossReference(primaryCatalog,primarySchema,primaryTable,foreignCatalog,foreignSchema,foreignTable);
404 ADOS::ThrowException(*m_pADOConnection,*this);
405
406 Reference< XResultSet > xRef;
407
408 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
409 pResult->setCrossReferenceMap();
410 xRef = pResult;
411
412 return xRef;
413 }
414 // -------------------------------------------------------------------------
doesMaxRowSizeIncludeBlobs()415 sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
416 {
417 return getBoolProperty(::rtl::OUString::createFromAscii("Maximum Row Size Includes BLOB"));
418 }
419 // -------------------------------------------------------------------------
storesLowerCaseQuotedIdentifiers()420 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
421 {
422 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ;
423 }
424 // -------------------------------------------------------------------------
storesLowerCaseIdentifiers()425 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
426 {
427 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ;
428 }
429 // -------------------------------------------------------------------------
impl_storesMixedCaseQuotedIdentifiers_throw()430 sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
431 {
432 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ;
433 }
434 // -------------------------------------------------------------------------
storesMixedCaseIdentifiers()435 sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
436 {
437 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ;
438 }
439 // -------------------------------------------------------------------------
storesUpperCaseQuotedIdentifiers()440 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
441 {
442 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ;
443 }
444 // -------------------------------------------------------------------------
storesUpperCaseIdentifiers()445 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
446 {
447 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ;
448 }
449 // -------------------------------------------------------------------------
impl_supportsAlterTableWithAddColumn_throw()450 sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
451 {
452 return sal_True;
453 }
454 // -------------------------------------------------------------------------
impl_supportsAlterTableWithDropColumn_throw()455 sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
456 {
457 return sal_True;
458 }
459 // -------------------------------------------------------------------------
getMaxIndexLength()460 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
461 {
462 return getInt32Property(::rtl::OUString::createFromAscii("Maximum Index Size"));
463 }
464 // -------------------------------------------------------------------------
supportsNonNullableColumns()465 sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
466 {
467 return getInt32Property(::rtl::OUString::createFromAscii("NULL Concatenation Behavior")) == DBPROPVAL_CB_NON_NULL;
468 }
469 // -------------------------------------------------------------------------
getCatalogTerm()470 ::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
471 {
472 return getStringProperty(::rtl::OUString::createFromAscii("Catalog Term"));
473 }
474 // -------------------------------------------------------------------------
impl_getIdentifierQuoteString_throw()475 ::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
476 {
477 return getLiteral(DBLITERAL_QUOTE_PREFIX);
478
479 }
480 // -------------------------------------------------------------------------
getExtraNameCharacters()481 ::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
482 {
483 // return getStringProperty(::rtl::OUString::createFromAscii("Special Characters"));
484 return ::rtl::OUString();
485 }
486 // -------------------------------------------------------------------------
supportsDifferentTableCorrelationNames()487 sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
488 {
489 return isCapable(DBLITERAL_CORRELATION_NAME);
490 }
491 // -------------------------------------------------------------------------
impl_isCatalogAtStart_throw()492 sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
493 {
494 return getInt32Property(::rtl::OUString::createFromAscii("Catalog Location")) == DBPROPVAL_CL_START;
495 }
496 // -------------------------------------------------------------------------
dataDefinitionIgnoredInTransactions()497 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
498 {
499 return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DDL_IGNORE;
500 }
501 // -------------------------------------------------------------------------
dataDefinitionCausesTransactionCommit()502 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
503 {
504 return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DDL_COMMIT;
505 }
506 // -------------------------------------------------------------------------
supportsDataManipulationTransactionsOnly()507 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
508 {
509 return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DML;
510 }
511 // -------------------------------------------------------------------------
supportsDataDefinitionAndDataManipulationTransactions()512 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
513 {
514 return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_ALL;
515 }
516 // -------------------------------------------------------------------------
supportsPositionedDelete()517 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
518 {
519 return sal_True;
520 }
521 // -------------------------------------------------------------------------
supportsPositionedUpdate()522 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
523 {
524 return sal_True;
525 }
526 // -------------------------------------------------------------------------
supportsOpenStatementsAcrossRollback()527 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
528 {
529 return getInt32Property(::rtl::OUString::createFromAscii("Prepare Abort Behavior")) == DBPROPVAL_CB_PRESERVE;
530 }
531 // -------------------------------------------------------------------------
supportsOpenStatementsAcrossCommit()532 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
533 {
534 return getInt32Property(::rtl::OUString::createFromAscii("Prepare Commit Behavior")) == DBPROPVAL_CB_PRESERVE;
535 }
536 // -------------------------------------------------------------------------
supportsOpenCursorsAcrossCommit()537 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
538 {
539 return (getInt32Property(::rtl::OUString::createFromAscii("Isolation Retention")) & DBPROPVAL_TR_COMMIT) == DBPROPVAL_TR_COMMIT;
540 }
541 // -------------------------------------------------------------------------
supportsOpenCursorsAcrossRollback()542 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
543 {
544 return (getInt32Property(::rtl::OUString::createFromAscii("Isolation Retention")) & DBPROPVAL_TR_ABORT) == DBPROPVAL_TR_ABORT;
545 }
546 // -------------------------------------------------------------------------
supportsTransactionIsolationLevel(sal_Int32 level)547 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException)
548 {
549 sal_Bool bValue(sal_False);
550
551 sal_Int32 nTxn = getInt32Property(::rtl::OUString::createFromAscii("Isolation Levels"));
552 if(level == TransactionIsolation::NONE)
553 bValue = sal_True;
554 else if(level == TransactionIsolation::READ_UNCOMMITTED)
555 bValue = (nTxn & DBPROPVAL_TI_READUNCOMMITTED) == DBPROPVAL_TI_READUNCOMMITTED;
556 else if(level == TransactionIsolation::READ_COMMITTED)
557 bValue = (nTxn & DBPROPVAL_TI_READCOMMITTED) == DBPROPVAL_TI_READCOMMITTED;
558 else if(level == TransactionIsolation::REPEATABLE_READ)
559 bValue = (nTxn & DBPROPVAL_TI_REPEATABLEREAD) == DBPROPVAL_TI_REPEATABLEREAD;
560 else if(level == TransactionIsolation::SERIALIZABLE)
561 bValue = (nTxn & DBPROPVAL_TI_SERIALIZABLE) == DBPROPVAL_TI_SERIALIZABLE;
562
563 return bValue;
564 }
565 // -------------------------------------------------------------------------
impl_supportsSchemasInDataManipulation_throw()566 sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
567 {
568 return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_DML_STATEMENTS) == DBPROPVAL_SU_DML_STATEMENTS;
569 }
570 // -------------------------------------------------------------------------
supportsANSI92FullSQL()571 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
572 {
573 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
574 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_FULL) == DBPROPVAL_SQL_ANSI92_FULL);
575 }
576 // -------------------------------------------------------------------------
supportsANSI92EntryLevelSQL()577 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
578 {
579 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
580 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_ENTRY) == DBPROPVAL_SQL_ANSI92_ENTRY);
581 }
582 // -------------------------------------------------------------------------
supportsIntegrityEnhancementFacility()583 sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
584 {
585 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
586 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI89_IEF) == DBPROPVAL_SQL_ANSI89_IEF);
587 }
588 // -------------------------------------------------------------------------
supportsSchemasInIndexDefinitions()589 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
590 {
591 return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_INDEX_DEFINITION) == DBPROPVAL_SU_INDEX_DEFINITION;
592 }
593 // -------------------------------------------------------------------------
impl_supportsSchemasInTableDefinitions_throw()594 sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
595 {
596 return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_TABLE_DEFINITION) == DBPROPVAL_SU_TABLE_DEFINITION;
597 }
598 // -------------------------------------------------------------------------
impl_supportsCatalogsInTableDefinitions_throw()599 sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
600 {
601 // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_TABLE_DEFINITION) == DBPROPVAL_CU_TABLE_DEFINITION;
602 return sal_False;
603 }
604 // -------------------------------------------------------------------------
supportsCatalogsInIndexDefinitions()605 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
606 {
607 // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_INDEX_DEFINITION) == DBPROPVAL_CU_INDEX_DEFINITION;
608 return sal_False;
609 }
610 // -------------------------------------------------------------------------
impl_supportsCatalogsInDataManipulation_throw()611 sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
612 {
613 // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_DML_STATEMENTS) == DBPROPVAL_CU_DML_STATEMENTS;
614 return sal_False;
615 }
616 // -------------------------------------------------------------------------
supportsOuterJoins()617 sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
618 {
619 if ( ADOS::isJetEngine(m_pConnection->getEngineType()) )
620 return sal_True;
621 return getBoolProperty(::rtl::OUString::createFromAscii("Outer Join Capabilities"));
622 }
623 // -------------------------------------------------------------------------
getTableTypes()624 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
625 {
626 return new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
627 }
628 // -------------------------------------------------------------------------
impl_getMaxStatements_throw()629 sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
630 {
631 return 0;
632 }
633 // -------------------------------------------------------------------------
getMaxProcedureNameLength()634 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
635 {
636 return getMaxSize(DBLITERAL_PROCEDURE_NAME);
637 }
638 // -------------------------------------------------------------------------
getMaxSchemaNameLength()639 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
640 {
641 return getMaxSize(DBLITERAL_SCHEMA_NAME);
642 }
643 // -------------------------------------------------------------------------
supportsTransactions()644 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
645 {
646 return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_NONE;
647 }
648 // -------------------------------------------------------------------------
allProceduresAreCallable()649 sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
650 {
651 return sal_True;
652 }
653 // -------------------------------------------------------------------------
supportsStoredProcedures()654 sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
655 {
656 return sal_True;
657 }
658 // -------------------------------------------------------------------------
supportsSelectForUpdate()659 sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
660 {
661 return sal_True;
662 }
663 // -------------------------------------------------------------------------
allTablesAreSelectable()664 sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
665 {
666 return sal_True;
667 }
668 // -------------------------------------------------------------------------
isReadOnly()669 sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
670 {
671 return getBoolProperty(::rtl::OUString::createFromAscii("Read-Only Data Source"));
672 }
673 // -------------------------------------------------------------------------
usesLocalFiles()674 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
675 {
676 return sal_False;
677 }
678 // -------------------------------------------------------------------------
usesLocalFilePerTable()679 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
680 {
681 return sal_False;
682 }
683 // -------------------------------------------------------------------------
supportsTypeConversion()684 sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
685 {
686 return sal_True;
687 }
688 // -------------------------------------------------------------------------
nullPlusNonNullIsNull()689 sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
690 {
691 return getInt32Property(::rtl::OUString::createFromAscii("NULL Concatenation Behavior")) == DBPROPVAL_CB_NULL;
692 }
693 // -------------------------------------------------------------------------
supportsColumnAliasing()694 sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
695 {
696 return isCapable(DBLITERAL_COLUMN_ALIAS);
697 }
698 // -------------------------------------------------------------------------
supportsTableCorrelationNames()699 sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
700 {
701 return isCapable(DBLITERAL_CORRELATION_NAME);
702 }
703 // -------------------------------------------------------------------------
supportsConvert(sal_Int32,sal_Int32)704 sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException)
705 {
706 return getBoolProperty(::rtl::OUString::createFromAscii("Rowset Conversions on Command"));
707 }
708 // -------------------------------------------------------------------------
supportsExpressionsInOrderBy()709 sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
710 {
711 return getBoolProperty(::rtl::OUString::createFromAscii("ORDER BY Columns in Select List"));
712 }
713 // -------------------------------------------------------------------------
supportsGroupBy()714 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
715 {
716 return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) != DBPROPVAL_GB_NOT_SUPPORTED;
717 }
718 // -------------------------------------------------------------------------
supportsGroupByBeyondSelect()719 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
720 {
721 return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) != DBPROPVAL_GB_CONTAINS_SELECT;
722 }
723 // -------------------------------------------------------------------------
supportsGroupByUnrelated()724 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
725 {
726 return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) == DBPROPVAL_GB_NO_RELATION;
727 }
728 // -------------------------------------------------------------------------
supportsMultipleTransactions()729 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
730 {
731 return sal_True;
732 }
733 // -------------------------------------------------------------------------
supportsMultipleResultSets()734 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
735 {
736 return sal_False;
737 }
738 // -------------------------------------------------------------------------
supportsLikeEscapeClause()739 sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
740 {
741 return isCapable(DBLITERAL_ESCAPE_PERCENT);
742 }
743 // -------------------------------------------------------------------------
supportsOrderByUnrelated()744 sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
745 {
746 return getBoolProperty(::rtl::OUString::createFromAscii("ORDER BY Columns in Select List"));
747 }
748 // -------------------------------------------------------------------------
supportsUnion()749 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
750 {
751 return sal_True;
752 }
753 // -------------------------------------------------------------------------
supportsUnionAll()754 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
755 {
756 return sal_True;
757 }
758 // -------------------------------------------------------------------------
supportsMixedCaseIdentifiers()759 sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
760 {
761 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED;
762 }
763 // -------------------------------------------------------------------------
impl_supportsMixedCaseQuotedIdentifiers_throw()764 sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
765 {
766 return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED;
767 }
768 // -------------------------------------------------------------------------
nullsAreSortedAtEnd()769 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
770 {
771 return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_END) == DBPROPVAL_NC_END;
772 }
773 // -------------------------------------------------------------------------
nullsAreSortedAtStart()774 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
775 {
776 return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_START) == DBPROPVAL_NC_START;
777 }
778 // -------------------------------------------------------------------------
nullsAreSortedHigh()779 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
780 {
781 return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_HIGH) == DBPROPVAL_NC_HIGH;
782 }
783 // -------------------------------------------------------------------------
nullsAreSortedLow()784 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
785 {
786 return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_LOW) == DBPROPVAL_NC_LOW;
787 }
788 // -------------------------------------------------------------------------
supportsSchemasInProcedureCalls()789 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
790 {
791 return sal_False;
792 }
793 // -------------------------------------------------------------------------
supportsSchemasInPrivilegeDefinitions()794 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
795 {
796 return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_PRIVILEGE_DEFINITION) == DBPROPVAL_SU_PRIVILEGE_DEFINITION;
797 }
798 // -------------------------------------------------------------------------
supportsCatalogsInProcedureCalls()799 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
800 {
801 return sal_False;
802 }
803 // -------------------------------------------------------------------------
supportsCatalogsInPrivilegeDefinitions()804 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
805 {
806 // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_PRIVILEGE_DEFINITION) == DBPROPVAL_CU_PRIVILEGE_DEFINITION;
807 return sal_False;
808 }
809 // -------------------------------------------------------------------------
supportsCorrelatedSubqueries()810 sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
811 {
812 return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_CORRELATEDSUBQUERIES) == DBPROPVAL_SQ_CORRELATEDSUBQUERIES;
813 }
814 // -------------------------------------------------------------------------
supportsSubqueriesInComparisons()815 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
816 {
817 return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_COMPARISON) == DBPROPVAL_SQ_COMPARISON;
818 }
819 // -------------------------------------------------------------------------
supportsSubqueriesInExists()820 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
821 {
822 return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_EXISTS) == DBPROPVAL_SQ_EXISTS;
823 }
824 // -------------------------------------------------------------------------
supportsSubqueriesInIns()825 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
826 {
827 return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_IN) == DBPROPVAL_SQ_IN;
828 }
829 // -------------------------------------------------------------------------
supportsSubqueriesInQuantifieds()830 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
831 {
832 return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_QUANTIFIED) == DBPROPVAL_SQ_QUANTIFIED;
833 }
834 // -------------------------------------------------------------------------
supportsANSI92IntermediateSQL()835 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
836 {
837 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
838 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_INTERMEDIATE) == DBPROPVAL_SQL_ANSI92_INTERMEDIATE);
839 }
840 // -------------------------------------------------------------------------
getURL()841 ::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
842 {
843 return ::rtl::OUString::createFromAscii("sdbc:ado:")+ m_pADOConnection->GetConnectionString();
844 }
845 // -------------------------------------------------------------------------
getUserName()846 ::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
847 {
848 return getStringProperty(::rtl::OUString::createFromAscii("User Name"));
849 }
850 // -------------------------------------------------------------------------
getDriverName()851 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
852 {
853 return getStringProperty(::rtl::OUString::createFromAscii("Provider Friendly Name"));
854 }
855 // -------------------------------------------------------------------------
getDriverVersion()856 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException)
857 {
858 return getStringProperty(::rtl::OUString::createFromAscii("Provider Version"));
859 }
860 // -------------------------------------------------------------------------
getDatabaseProductVersion()861 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
862 {
863 return getStringProperty(::rtl::OUString::createFromAscii("DBMS Version"));
864 }
865 // -------------------------------------------------------------------------
getDatabaseProductName()866 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
867 {
868 return getStringProperty(::rtl::OUString::createFromAscii("DBMS Name"));
869 }
870 // -------------------------------------------------------------------------
getProcedureTerm()871 ::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
872 {
873 return getStringProperty(::rtl::OUString::createFromAscii("Procedure Term"));
874 }
875 // -------------------------------------------------------------------------
getSchemaTerm()876 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
877 {
878 return getStringProperty(::rtl::OUString::createFromAscii("Schema Term"));
879 }
880 // -------------------------------------------------------------------------
getDriverMajorVersion()881 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
882 {
883 return 1;
884 }
885 // -------------------------------------------------------------------------
getDefaultTransactionIsolation()886 sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
887 {
888 sal_Int32 nRet = TransactionIsolation::NONE;
889 switch(m_pADOConnection->get_IsolationLevel())
890 {
891 case adXactReadCommitted:
892 nRet = TransactionIsolation::READ_COMMITTED;
893 break;
894 case adXactRepeatableRead:
895 nRet = TransactionIsolation::REPEATABLE_READ;
896 break;
897 case adXactSerializable:
898 nRet = TransactionIsolation::SERIALIZABLE;
899 break;
900 case adXactReadUncommitted:
901 nRet = TransactionIsolation::READ_UNCOMMITTED;
902 break;
903 default:
904 ;
905 }
906 return nRet;
907 }
908 // -------------------------------------------------------------------------
getDriverMinorVersion()909 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
910 {
911 return 0;
912 }
913 // -------------------------------------------------------------------------
getSQLKeywords()914 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
915 {
916 ADORecordset *pRecordset = NULL;
917 OLEVariant vtEmpty;
918 vtEmpty.setNoArg();
919 m_pADOConnection->OpenSchema(adSchemaDBInfoKeywords,vtEmpty,vtEmpty,&pRecordset);
920 OSL_ENSURE(pRecordset,"getSQLKeywords: no resultset!");
921 ADOS::ThrowException(*m_pADOConnection,*this);
922 if ( pRecordset )
923 {
924 WpADORecordset aRecordset(pRecordset);
925
926 aRecordset.MoveFirst();
927 OLEVariant aValue;
928 ::rtl::OUString aRet,aComma = ::rtl::OUString::createFromAscii(",");
929 while(!aRecordset.IsAtEOF())
930 {
931 WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields());
932 WpADOField aField(aFields.GetItem(0));
933 aField.get_Value(aValue);
934 aRet = aRet + aValue + aComma;
935 aRecordset.MoveNext();
936 }
937 aRecordset.Close();
938 if ( aRet.getLength() )
939 return aRet.copy(0,aRet.lastIndexOf(','));
940 }
941 return ::rtl::OUString();
942 }
943 // -------------------------------------------------------------------------
getSearchStringEscape()944 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
945 {
946 return getLiteral(DBLITERAL_ESCAPE_PERCENT);
947 }
948 // -------------------------------------------------------------------------
getStringFunctions()949 ::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
950 {
951 ::rtl::OUString aValue;
952 return aValue.copy(0,aValue.lastIndexOf(','));
953 }
954 // -------------------------------------------------------------------------
getTimeDateFunctions()955 ::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
956 {
957 ::rtl::OUString aValue;
958 return aValue;
959 }
960 // -------------------------------------------------------------------------
getSystemFunctions()961 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
962 {
963 ::rtl::OUString aValue;
964 return aValue.copy(0,aValue.lastIndexOf(','));
965 }
966 // -------------------------------------------------------------------------
getNumericFunctions()967 ::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
968 {
969 ::rtl::OUString aValue;
970 return aValue;
971 }
972 // -------------------------------------------------------------------------
supportsExtendedSQLGrammar()973 sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
974 {
975 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
976 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_EXTENDED) == DBPROPVAL_SQL_ODBC_EXTENDED);
977 }
978 // -------------------------------------------------------------------------
supportsCoreSQLGrammar()979 sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
980 {
981 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
982 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_CORE) == DBPROPVAL_SQL_ODBC_CORE);
983 }
984 // -------------------------------------------------------------------------
supportsMinimumSQLGrammar()985 sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
986 {
987 sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support"));
988 return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_MINIMUM) == DBPROPVAL_SQL_ODBC_MINIMUM);
989 }
990 // -------------------------------------------------------------------------
supportsFullOuterJoins()991 sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
992 {
993 if ( ADOS::isJetEngine(m_pConnection->getEngineType()) )
994 return sal_True;
995 return (getInt32Property(::rtl::OUString::createFromAscii("Outer Join Capabilities")) & 0x00000004L) == 0x00000004L;
996 }
997 // -------------------------------------------------------------------------
supportsLimitedOuterJoins()998 sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
999 {
1000 return supportsFullOuterJoins( );
1001 }
1002 // -------------------------------------------------------------------------
getMaxColumnsInGroupBy()1003 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
1004 {
1005 return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in GROUP BY"));
1006 }
1007 // -------------------------------------------------------------------------
getMaxColumnsInOrderBy()1008 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
1009 {
1010 return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in ORDER BY"));
1011 }
1012 // -------------------------------------------------------------------------
getMaxColumnsInSelect()1013 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
1014 {
1015 return 0; // getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Select"));
1016 }
1017 // -------------------------------------------------------------------------
getMaxUserNameLength()1018 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
1019 {
1020 return getMaxSize(DBLITERAL_USER_NAME);
1021 }
1022 // -------------------------------------------------------------------------
supportsResultSetType(sal_Int32)1023 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
1024 {
1025 return sal_True;
1026 }
1027 // -------------------------------------------------------------------------
supportsResultSetConcurrency(sal_Int32,sal_Int32)1028 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException)
1029 {
1030 return sal_True;
1031 }
1032 // -------------------------------------------------------------------------
ownUpdatesAreVisible(sal_Int32 setType)1033 sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1034 {
1035 return ResultSetType::FORWARD_ONLY != setType;
1036 }
1037 // -------------------------------------------------------------------------
ownDeletesAreVisible(sal_Int32 setType)1038 sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1039 {
1040 return ResultSetType::FORWARD_ONLY != setType;
1041 }
1042 // -------------------------------------------------------------------------
ownInsertsAreVisible(sal_Int32 setType)1043 sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1044 {
1045 return ResultSetType::FORWARD_ONLY != setType;
1046 }
1047 // -------------------------------------------------------------------------
othersUpdatesAreVisible(sal_Int32 setType)1048 sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1049 {
1050 return ResultSetType::FORWARD_ONLY != setType;
1051 }
1052 // -------------------------------------------------------------------------
othersDeletesAreVisible(sal_Int32 setType)1053 sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1054 {
1055 return ResultSetType::FORWARD_ONLY != setType;
1056 }
1057 // -------------------------------------------------------------------------
othersInsertsAreVisible(sal_Int32 setType)1058 sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1059 {
1060 return ResultSetType::FORWARD_ONLY != setType;
1061 }
1062 // -------------------------------------------------------------------------
updatesAreDetected(sal_Int32 setType)1063 sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
1064 {
1065 return ResultSetType::FORWARD_ONLY != setType;
1066 }
1067 // -------------------------------------------------------------------------
deletesAreDetected(sal_Int32 setType)1068 sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
1069 {
1070 return ResultSetType::FORWARD_ONLY != setType;
1071 }
1072 // -------------------------------------------------------------------------
insertsAreDetected(sal_Int32 setType)1073 sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
1074 {
1075 return ResultSetType::FORWARD_ONLY != setType;
1076 }
1077 // -------------------------------------------------------------------------
supportsBatchUpdates()1078 sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
1079 {
1080 return sal_True;
1081 }
1082 // -------------------------------------------------------------------------
getUDTs(const Any &,const::rtl::OUString &,const::rtl::OUString &,const Sequence<sal_Int32> &)1083 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)
1084 {
1085 ::dbtools::throwFeatureNotImplementedException( "XDatabaseMetaData::getUDTs", *this );
1086 return Reference< XResultSet >();
1087 }
1088 // -------------------------------------------------------------------------
1089
1090