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