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 "odbc/ODatabaseMetaData.hxx"
27 #include "odbc/OTools.hxx"
28 #ifndef _CONNECTIVITY_ODBC_ORESULTSET_HXX_
29 #include "odbc/ODatabaseMetaDataResultSet.hxx"
30 #endif
31 #include "FDatabaseMetaDataResultSet.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 "odbc/OFunctiondefs.hxx"
36 #include "stdio.h"
37 #include "TPrivilegesResultSet.hxx"
38 #include <connectivity/dbexception.hxx>
39 #include <rtl/ustrbuf.hxx>
40 
41 using namespace connectivity::odbc;
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 
ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection * _pCon)47 ODatabaseMetaData::ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon)
48 						: ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
49 						,m_aConnectionHandle(_pHandle)
50 						,m_pConnection(_pCon)
51 						,m_bUseCatalog(sal_True)
52 						,m_bOdbc3(sal_True)
53 {
54 	OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
55 	if(!m_pConnection->isCatalogUsed())
56 	{
57 		osl_incrementInterlockedCount( &m_refCount );
58 		try
59 		{
60 			m_bUseCatalog	= !(usesLocalFiles() || usesLocalFilePerTable());
61 			::rtl::OUString sVersion = getDriverVersion();
62 			m_bOdbc3		=  sVersion != ::rtl::OUString::createFromAscii("02.50") && sVersion != ::rtl::OUString::createFromAscii("02.00");
63 		}
64 		catch(SQLException& )
65 		{ // doesn't matter here
66 		}
67 		osl_decrementInterlockedCount( &m_refCount );
68 	}
69 }
70 // -------------------------------------------------------------------------
~ODatabaseMetaData()71 ODatabaseMetaData::~ODatabaseMetaData()
72 {
73 }
74 // -------------------------------------------------------------------------
impl_getTypeInfo_throw()75 Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw(  )
76 {
77 	Reference< XResultSet > xRef;
78 	try
79 	{
80 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
81 		xRef = pResult;
82 		pResult->openTypeInfo();
83 	}
84 	catch(SQLException&)
85 	{
86         xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
87 	}
88 
89 	return xRef;
90 }
91 // -------------------------------------------------------------------------
getCatalogs()92 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs(  ) throw(SQLException, RuntimeException)
93 {
94 	Reference< XResultSet > xRef;
95 	if(!m_bUseCatalog)
96 	{
97         xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
98 	}
99 	else
100 	{
101 		try
102 		{
103 			ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
104 			xRef = pResult;
105 			pResult->openCatalogs();
106 		}
107 		catch(SQLException&)
108 		{
109 			xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
110 		}
111 	}
112 
113 	return xRef;
114 }
115 // -------------------------------------------------------------------------
impl_getCatalogSeparator_throw()116 ::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw(  )
117 {
118     ::rtl::OUString aVal;
119 	if ( m_bUseCatalog )
120 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_NAME_SEPARATOR,aVal,*this,m_pConnection->getTextEncoding());
121 
122 	return aVal;
123 }
124 // -------------------------------------------------------------------------
getSchemas()125 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas(  ) throw(SQLException, RuntimeException)
126 {
127 	Reference< XResultSet > xRef;
128 	try
129 	{
130 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
131 		xRef = pResult;
132 		pResult->openSchemas();
133 	}
134 	catch(SQLException&)
135 	{
136 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eSchemas);
137 	}
138 	return xRef;
139 }
140 // -------------------------------------------------------------------------
getColumnPrivileges(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table,const::rtl::OUString & columnNamePattern)141 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
142 	const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
143 	const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
144 {
145 	Reference< XResultSet > xRef;
146 	try
147 	{
148 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
149 		xRef = pResult;
150 		pResult->openColumnPrivileges(m_bUseCatalog ? catalog : Any(),schema,table,columnNamePattern);
151 	}
152 	catch(SQLException&)
153 	{
154 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumnPrivileges);
155 	}
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 	Reference< XResultSet > xRef;
164 	try
165 	{
166 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
167 		xRef = pResult;
168 		pResult->openColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,columnNamePattern);
169 	}
170 	catch(SQLException&)
171 	{
172 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
173 	}
174 	return xRef;
175 }
176 // -------------------------------------------------------------------------
getTables(const Any & catalog,const::rtl::OUString & schemaPattern,const::rtl::OUString & tableNamePattern,const Sequence<::rtl::OUString> & types)177 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
178 	const Any& catalog, const ::rtl::OUString& schemaPattern,
179 	const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
180 {
181 	Reference< XResultSet > xRef;
182 	try
183 	{
184 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
185 		xRef = pResult;
186 		pResult->openTables(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,types);
187 	}
188 	catch(SQLException&)
189 	{
190 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
191 	}
192 	return xRef;
193 }
194 // -------------------------------------------------------------------------
getProcedureColumns(const Any & catalog,const::rtl::OUString & schemaPattern,const::rtl::OUString & procedureNamePattern,const::rtl::OUString & columnNamePattern)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 	Reference< XResultSet > xRef;
200 	try
201 	{
202 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
203 		xRef = pResult;
204 		pResult->openProcedureColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern,columnNamePattern);
205 	}
206 	catch(SQLException&)
207 	{
208 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedureColumns);
209 	}
210 	return xRef;
211 }
212 // -------------------------------------------------------------------------
getProcedures(const Any & catalog,const::rtl::OUString & schemaPattern,const::rtl::OUString & procedureNamePattern)213 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
214 	const Any& catalog, const ::rtl::OUString& schemaPattern,
215 	const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException)
216 {
217 	Reference< XResultSet > xRef;
218 	try
219 	{
220 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
221 		xRef = pResult;
222 		pResult->openProcedures(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern);
223 	}
224 	catch(SQLException&)
225 	{
226 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedures);
227 	}
228 	return xRef;
229 }
230 // -------------------------------------------------------------------------
getVersionColumns(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table)231 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
232 	const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
233 {
234 	Reference< XResultSet > xRef;
235     bool bSuccess = false;
236 	try
237 	{
238         if ( !m_pConnection->preventGetVersionColumns() )
239         {
240 		    ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
241 		    xRef = pResult;
242 		    pResult->openVersionColumns(m_bUseCatalog ? catalog : Any(),schema,table);
243             bSuccess = true;
244         }
245 	}
246 	catch(SQLException&)
247 	{
248 	}
249 
250     if ( !bSuccess )
251     {
252 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
253     }
254 
255     return xRef;
256 }
257 // -------------------------------------------------------------------------
getMaxBinaryLiteralLength()258 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength(  ) throw(SQLException, RuntimeException)
259 {
260 	SQLUINTEGER nValue;
261 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_BINARY_LITERAL_LEN,nValue,*this);
262 	return nValue;
263 }
264 // -------------------------------------------------------------------------
getMaxRowSize()265 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize(  ) throw(SQLException, RuntimeException)
266 {
267 	SQLUINTEGER nValue;
268 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_ROW_SIZE,nValue,*this);
269 	return nValue;
270 }
271 // -------------------------------------------------------------------------
getMaxCatalogNameLength()272 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength(  ) throw(SQLException, RuntimeException)
273 {
274 	SQLUSMALLINT nValue;
275 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CATALOG_NAME_LEN,nValue,*this);
276 	return nValue;
277 }
278 // -------------------------------------------------------------------------
getMaxCharLiteralLength()279 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength(  ) throw(SQLException, RuntimeException)
280 {
281 	SQLUINTEGER nValue;
282 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CHAR_LITERAL_LEN,nValue,*this);
283 	return nValue;
284 }
285 // -------------------------------------------------------------------------
getMaxColumnNameLength()286 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength(  ) throw(SQLException, RuntimeException)
287 {
288 	SQLUSMALLINT nValue;
289 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMN_NAME_LEN,nValue,*this);
290 	return nValue;
291 }
292 // -------------------------------------------------------------------------
getMaxColumnsInIndex()293 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex(  ) throw(SQLException, RuntimeException)
294 {
295 	SQLUSMALLINT nValue;
296 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_INDEX,nValue,*this);
297 	return nValue;
298 }
299 // -------------------------------------------------------------------------
getMaxCursorNameLength()300 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength(  ) throw(SQLException, RuntimeException)
301 {
302 	SQLUSMALLINT nValue;
303 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CURSOR_NAME_LEN,nValue,*this);
304 	return nValue;
305 }
306 // -------------------------------------------------------------------------
getMaxConnections()307 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections(  ) throw(SQLException, RuntimeException)
308 {
309 	SQLUSMALLINT nValue;
310 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_DRIVER_CONNECTIONS/*SQL_ACTIVE_CONNECTIONS*/,nValue,*this);
311 	return nValue;
312 }
313 // -------------------------------------------------------------------------
getMaxColumnsInTable()314 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable(  ) throw(SQLException, RuntimeException)
315 {
316 	SQLUSMALLINT nValue;
317 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_TABLE,nValue,*this);
318 	return nValue;
319 }
320 // -------------------------------------------------------------------------
getMaxStatementLength()321 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength(  ) throw(SQLException, RuntimeException)
322 {
323 	SQLUINTEGER nValue;
324 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_STATEMENT_LEN,nValue,*this);
325 	return nValue;
326 }
327 // -------------------------------------------------------------------------
getMaxTableNameLength()328 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength(  ) throw(SQLException, RuntimeException)
329 {
330 	SQLUSMALLINT nValue;
331 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLE_NAME_LEN,nValue,*this);
332 	return nValue;
333 }
334 // -------------------------------------------------------------------------
impl_getMaxTablesInSelect_throw()335 sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw(  )
336 {
337 	SQLUSMALLINT nValue;
338 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLES_IN_SELECT,nValue,*this);
339 	return nValue;
340 }
341 // -------------------------------------------------------------------------
getExportedKeys(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table)342 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
343 	const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
344 {
345 	Reference< XResultSet > xRef;
346 	try
347 	{
348 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
349 		xRef = pResult;
350 		pResult->openExportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
351 	}
352 	catch(SQLException&)
353 	{
354 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eExportedKeys);
355 	}
356 	return xRef;
357 }
358 // -------------------------------------------------------------------------
getImportedKeys(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table)359 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
360 	const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
361 {
362 	Reference< XResultSet > xRef;
363 	try
364 	{
365 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
366 		xRef = pResult;
367 		pResult->openImportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
368 	}
369 	catch(SQLException&)
370 	{
371 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eImportedKeys);
372 	}
373 	return xRef;
374 }
375 // -------------------------------------------------------------------------
getPrimaryKeys(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table)376 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
377 	const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
378 {
379 	Reference< XResultSet > xRef;
380 	try
381 	{
382 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
383 		xRef = pResult;
384 		pResult->openPrimaryKeys(m_bUseCatalog ? catalog : Any(),schema,table);
385 	}
386 	catch(SQLException&)
387 	{
388 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::ePrimaryKeys);
389 	}
390 	return xRef;
391 }
392 // -------------------------------------------------------------------------
getIndexInfo(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table,sal_Bool unique,sal_Bool approximate)393 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
394 	const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
395 	sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException)
396 {
397 	Reference< XResultSet > xRef;
398 	try
399 	{
400 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
401 		xRef = pResult;
402 		pResult->openIndexInfo(m_bUseCatalog ? catalog : Any(),schema,table,unique,approximate);
403 	}
404 	catch(SQLException&)
405 	{
406 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eIndexInfo);
407 	}
408 	return xRef;
409 }
410 // -------------------------------------------------------------------------
getBestRowIdentifier(const Any & catalog,const::rtl::OUString & schema,const::rtl::OUString & table,sal_Int32 scope,sal_Bool nullable)411 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
412 	const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope,
413 	sal_Bool nullable ) throw(SQLException, RuntimeException)
414 {
415 	Reference< XResultSet > xRef;
416 	try
417 	{
418 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
419 		xRef = pResult;
420 		pResult->openBestRowIdentifier(m_bUseCatalog ? catalog : Any(),schema,table,scope,nullable);
421 	}
422 	catch(SQLException&)
423 	{
424 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eBestRowIdentifier);
425 	}
426 	return xRef;
427 }
428 // -------------------------------------------------------------------------
getTablePrivileges(const Any & catalog,const::rtl::OUString & schemaPattern,const::rtl::OUString & tableNamePattern)429 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
430 	const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
431 {
432 	if ( m_pConnection->isIgnoreDriverPrivilegesEnabled() )
433 	{
434 		return new OResultSetPrivileges(this,catalog,schemaPattern,tableNamePattern);
435 	}
436 	ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
437 	Reference< XResultSet > xRef = pResult;
438 	pResult->openTablePrivileges(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern);
439 	return xRef;
440 }
441 // -------------------------------------------------------------------------
getCrossReference(const Any & primaryCatalog,const::rtl::OUString & primarySchema,const::rtl::OUString & primaryTable,const Any & foreignCatalog,const::rtl::OUString & foreignSchema,const::rtl::OUString & foreignTable)442 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
443 	const Any& primaryCatalog, const ::rtl::OUString& primarySchema,
444 	const ::rtl::OUString& primaryTable, const Any& foreignCatalog,
445 	const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException)
446 {
447 	Reference< XResultSet > xRef;
448 	try
449 	{
450 		ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
451 		xRef = pResult;
452 		pResult->openForeignKeys(m_bUseCatalog ? primaryCatalog : Any(),primarySchema.toChar() == '%' ? &primarySchema : NULL,&primaryTable,
453 			m_bUseCatalog ? foreignCatalog : Any(), foreignSchema.toChar() == '%' ? &foreignSchema : NULL,&foreignTable);
454 	}
455 	catch(SQLException&)
456 	{
457 		xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCrossReference);
458 	}
459 	return xRef;
460 }
461 // -------------------------------------------------------------------------
doesMaxRowSizeIncludeBlobs()462 sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs(  ) throw(SQLException, RuntimeException)
463 {
464 	::rtl::OUString aVal;
465 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_ROW_SIZE_INCLUDES_LONG,aVal,*this,m_pConnection->getTextEncoding());
466 	return aVal.toChar() == 'Y';
467 }
468 // -------------------------------------------------------------------------
storesLowerCaseQuotedIdentifiers()469 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
470 {
471 	SQLUSMALLINT nValue;
472 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
473 	return nValue == SQL_IC_LOWER;
474 }
475 // -------------------------------------------------------------------------
storesLowerCaseIdentifiers()476 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers(  ) throw(SQLException, RuntimeException)
477 {
478 	SQLUSMALLINT nValue;
479 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
480 	return nValue == SQL_IC_LOWER;
481 }
482 // -------------------------------------------------------------------------
impl_storesMixedCaseQuotedIdentifiers_throw()483 sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw(  )
484 {
485 	SQLUSMALLINT nValue;
486 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
487 	return nValue == SQL_IC_MIXED;
488 }
489 // -------------------------------------------------------------------------
storesMixedCaseIdentifiers()490 sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers(  ) throw(SQLException, RuntimeException)
491 {
492 	SQLUSMALLINT nValue;
493 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
494 	return nValue == SQL_IC_MIXED;
495 }
496 // -------------------------------------------------------------------------
storesUpperCaseQuotedIdentifiers()497 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
498 {
499 	SQLUSMALLINT nValue;
500 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
501 	return nValue == SQL_IC_UPPER;
502 }
503 // -------------------------------------------------------------------------
storesUpperCaseIdentifiers()504 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers(  ) throw(SQLException, RuntimeException)
505 {
506 	SQLUSMALLINT nValue;
507 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
508 	return nValue == SQL_IC_UPPER;
509 }
510 // -------------------------------------------------------------------------
impl_supportsAlterTableWithAddColumn_throw()511 sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw(  )
512 {
513 	SQLUINTEGER nValue;
514 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this);
515 	return (nValue & SQL_AT_ADD_COLUMN) == SQL_AT_ADD_COLUMN;
516 }
517 // -------------------------------------------------------------------------
impl_supportsAlterTableWithDropColumn_throw()518 sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw(  )
519 {
520 	SQLUINTEGER nValue;
521 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this);
522 	return	((nValue & SQL_AT_DROP_COLUMN)			== SQL_AT_DROP_COLUMN)			||
523 			((nValue & SQL_AT_DROP_COLUMN_CASCADE)	== SQL_AT_DROP_COLUMN_CASCADE)	||
524 			((nValue & SQL_AT_DROP_COLUMN_RESTRICT) == SQL_AT_DROP_COLUMN_RESTRICT);
525 }
526 // -------------------------------------------------------------------------
getMaxIndexLength()527 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength(  ) throw(SQLException, RuntimeException)
528 {
529 	SQLUINTEGER nValue;
530 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_INDEX_SIZE,nValue,*this);
531 	return nValue;
532 }
533 // -------------------------------------------------------------------------
supportsNonNullableColumns()534 sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns(  ) throw(SQLException, RuntimeException)
535 {
536 	SQLUSMALLINT nValue;
537 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NON_NULLABLE_COLUMNS,nValue,*this);
538 	return nValue == SQL_NNC_NON_NULL;
539 }
540 // -------------------------------------------------------------------------
getCatalogTerm()541 ::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm(  ) throw(SQLException, RuntimeException)
542 {
543 	::rtl::OUString aVal;
544 	if(m_bUseCatalog)
545 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_TERM,aVal,*this,m_pConnection->getTextEncoding());
546 	return aVal;
547 }
548 // -------------------------------------------------------------------------
impl_getIdentifierQuoteString_throw()549 ::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw(  )
550 {
551 	::rtl::OUString aVal;
552 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_QUOTE_CHAR,aVal,*this,m_pConnection->getTextEncoding());
553 	return aVal;
554 }
555 // -------------------------------------------------------------------------
getExtraNameCharacters()556 ::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters(  ) throw(SQLException, RuntimeException)
557 {
558 	::rtl::OUString aVal;
559 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SPECIAL_CHARACTERS,aVal,*this,m_pConnection->getTextEncoding());
560 	return aVal;
561 }
562 // -------------------------------------------------------------------------
supportsDifferentTableCorrelationNames()563 sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames(  ) throw(SQLException, RuntimeException)
564 {
565 	SQLUSMALLINT nValue;
566 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
567 	return nValue != SQL_CN_NONE;
568 }
569 // -------------------------------------------------------------------------
impl_isCatalogAtStart_throw()570 sal_Bool        ODatabaseMetaData::impl_isCatalogAtStart_throw(  )
571 {
572 	SQLUSMALLINT nValue=0;
573 	if ( m_bUseCatalog )
574 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_LOCATION,nValue,*this);
575 	return nValue == SQL_CL_START;
576 }
577 // -------------------------------------------------------------------------
dataDefinitionIgnoredInTransactions()578 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions(  ) throw(SQLException, RuntimeException)
579 {
580 	SQLUSMALLINT nValue;
581 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
582 	return nValue == SQL_TC_DDL_IGNORE;
583 }
584 // -------------------------------------------------------------------------
dataDefinitionCausesTransactionCommit()585 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit(  ) throw(SQLException, RuntimeException)
586 {
587 	SQLUSMALLINT nValue;
588 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
589 	return nValue == SQL_TC_DDL_COMMIT;
590 }
591 // -------------------------------------------------------------------------
supportsDataManipulationTransactionsOnly()592 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly(  ) throw(SQLException, RuntimeException)
593 {
594 	SQLUSMALLINT nValue;
595 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
596 	return nValue == SQL_TC_DML;
597 }
598 // -------------------------------------------------------------------------
supportsDataDefinitionAndDataManipulationTransactions()599 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions(  ) throw(SQLException, RuntimeException)
600 {
601 	SQLUSMALLINT nValue;
602 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
603 	return nValue == SQL_TC_ALL;
604 }
605 // -------------------------------------------------------------------------
supportsPositionedDelete()606 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete(  ) throw(SQLException, RuntimeException)
607 {
608 	SQLUINTEGER nValue;
609 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
610 	return (nValue & SQL_CA1_POS_DELETE) == SQL_CA1_POS_DELETE;
611 }
612 // -------------------------------------------------------------------------
supportsPositionedUpdate()613 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate(  ) throw(SQLException, RuntimeException)
614 {
615 	SQLUINTEGER nValue;
616 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
617 	return (nValue & SQL_CA1_POS_UPDATE) == SQL_CA1_POS_UPDATE;
618 }
619 // -------------------------------------------------------------------------
supportsOpenStatementsAcrossRollback()620 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback(  ) throw(SQLException, RuntimeException)
621 {
622 	SQLUSMALLINT nValue;
623 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
624 	return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
625 }
626 // -------------------------------------------------------------------------
supportsOpenStatementsAcrossCommit()627 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit(  ) throw(SQLException, RuntimeException)
628 {
629 	SQLUSMALLINT nValue;
630 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
631 	return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
632 }
633 // -------------------------------------------------------------------------
supportsOpenCursorsAcrossCommit()634 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit(  ) throw(SQLException, RuntimeException)
635 {
636 	SQLUSMALLINT nValue;
637 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
638 	return nValue == SQL_CB_PRESERVE;
639 }
640 // -------------------------------------------------------------------------
supportsOpenCursorsAcrossRollback()641 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback(  ) throw(SQLException, RuntimeException)
642 {
643 	SQLUSMALLINT nValue;
644 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
645 	return nValue == SQL_CB_PRESERVE;
646 }
647 // -------------------------------------------------------------------------
supportsTransactionIsolationLevel(sal_Int32 level)648 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException)
649 {
650 	SQLUINTEGER nValue;
651 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_ISOLATION_OPTION,nValue,*this);
652 	return (nValue & static_cast<SQLUINTEGER>(level)) == static_cast<SQLUINTEGER>(level);
653 }
654 // -------------------------------------------------------------------------
impl_supportsSchemasInDataManipulation_throw()655 sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw(  )
656 {
657 	SQLUINTEGER nValue;
658 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
659 	return (nValue & SQL_SU_DML_STATEMENTS) == SQL_SU_DML_STATEMENTS;
660 }
661 // -------------------------------------------------------------------------
supportsANSI92FullSQL()662 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL(  ) throw(SQLException, RuntimeException)
663 {
664 	SQLUINTEGER nValue;
665 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
666 	return nValue == SQL_SC_SQL92_FULL;
667 }
668 // -------------------------------------------------------------------------
supportsANSI92EntryLevelSQL()669 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL(  ) throw(SQLException, RuntimeException)
670 {
671 	SQLUINTEGER nValue;
672 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
673 	return nValue == SQL_SC_SQL92_ENTRY;
674 }
675 // -------------------------------------------------------------------------
supportsIntegrityEnhancementFacility()676 sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility(  ) throw(SQLException, RuntimeException)
677 {
678 	::rtl::OUString aStr;
679 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_INTEGRITY,aStr,*this,m_pConnection->getTextEncoding());
680 	return aStr.toChar() == 'Y';
681 }
682 // -------------------------------------------------------------------------
supportsSchemasInIndexDefinitions()683 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions(  ) throw(SQLException, RuntimeException)
684 {
685 	SQLUINTEGER nValue;
686 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
687 	return (nValue & SQL_SU_INDEX_DEFINITION) == SQL_SU_INDEX_DEFINITION;
688 }
689 // -------------------------------------------------------------------------
impl_supportsSchemasInTableDefinitions_throw()690 sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw(  )
691 {
692 	SQLUINTEGER nValue;
693 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
694 	return (nValue & SQL_SU_TABLE_DEFINITION) == SQL_SU_TABLE_DEFINITION;
695 }
696 // -------------------------------------------------------------------------
impl_supportsCatalogsInTableDefinitions_throw()697 sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw(  )
698 {
699 	SQLUINTEGER nValue=0;
700 	if(m_bUseCatalog)
701 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
702 	return (nValue & SQL_CU_TABLE_DEFINITION) == SQL_CU_TABLE_DEFINITION;
703 }
704 // -------------------------------------------------------------------------
supportsCatalogsInIndexDefinitions()705 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions(  ) throw(SQLException, RuntimeException)
706 {
707 	SQLUINTEGER nValue=0;
708 	if(m_bUseCatalog)
709 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
710 	return (nValue & SQL_CU_INDEX_DEFINITION) == SQL_CU_INDEX_DEFINITION;
711 }
712 // -------------------------------------------------------------------------
impl_supportsCatalogsInDataManipulation_throw()713 sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw(  )
714 {
715 	SQLUINTEGER nValue=0;
716 	if(m_bUseCatalog)
717 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
718 	return (nValue & SQL_CU_DML_STATEMENTS) == SQL_CU_DML_STATEMENTS;
719 }
720 // -------------------------------------------------------------------------
supportsOuterJoins()721 sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins(  ) throw(SQLException, RuntimeException)
722 {
723 	SQLUINTEGER nValue;
724 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
725 	return ((nValue & (SQL_OJ_FULL|SQL_OJ_LEFT|SQL_OJ_RIGHT|SQL_OJ_NESTED|SQL_OJ_NOT_ORDERED|SQL_OJ_ALL_COMPARISON_OPS|SQL_OJ_INNER)) != 0);
726 }
727 // -------------------------------------------------------------------------
getTableTypes()728 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes(  ) throw(SQLException, RuntimeException)
729 {
730 
731 	// there exists no possibility to get table types so we have to check
732 	static ::rtl::OUString sTableTypes[] =
733 	{
734 		::rtl::OUString::createFromAscii("TABLE"),
735 		::rtl::OUString::createFromAscii("VIEW"),
736 		::rtl::OUString::createFromAscii("SYSTEM TABLE"),
737 		::rtl::OUString::createFromAscii("GLOBAL TEMPORARY"),
738 		::rtl::OUString::createFromAscii("LOCAL TEMPORARY"),
739 		::rtl::OUString::createFromAscii("ALIAS"),
740 		::rtl::OUString::createFromAscii("SYNONYM")
741 	};
742 	sal_Int32  nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString);
743 	::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
744     Reference< XResultSet > xRef = pResult;
745 	SQLUINTEGER nValue = 0;
746 	try
747 	{
748 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CREATE_VIEW,nValue,*this);
749 	}
750 	catch(const Exception&)
751 	{
752 	}
753 	sal_Bool bViewsSupported = (nValue & SQL_CV_CREATE_VIEW) == SQL_CV_CREATE_VIEW;
754 
755 	::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
756 	for(sal_Int32 i=0;i < nSize;++i)
757 	{
758 		if( !bViewsSupported && i == 1)
759 			continue; // no views supported
760 		::connectivity::ODatabaseMetaDataResultSet::ORow aRow;
761 		aRow.push_back(::connectivity::ODatabaseMetaDataResultSet::getEmptyValue());
762 		aRow.push_back(new ::connectivity::ORowSetValueDecorator(sTableTypes[i]));
763 		aRows.push_back(aRow);
764 	}
765 	pResult->setRows(aRows);
766 	 return xRef;
767 }
768 // -------------------------------------------------------------------------
impl_getMaxStatements_throw()769 sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw(  )
770 {
771 	SQLUSMALLINT nValue;
772 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CONCURRENT_ACTIVITIES,nValue,*this);
773 	return nValue;
774 }
775 // -------------------------------------------------------------------------
getMaxProcedureNameLength()776 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength(  ) throw(SQLException, RuntimeException)
777 {
778 	SQLUSMALLINT nValue;
779 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_PROCEDURE_NAME_LEN,nValue,*this);
780 	return nValue;
781 }
782 // -------------------------------------------------------------------------
getMaxSchemaNameLength()783 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength(  ) throw(SQLException, RuntimeException)
784 {
785 	SQLUSMALLINT nValue;
786 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_SCHEMA_NAME_LEN,nValue,*this);
787 	return nValue;
788 }
789 // -------------------------------------------------------------------------
supportsTransactions()790 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions(  ) throw(SQLException, RuntimeException)
791 {
792 	SQLUSMALLINT nValue;
793 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this);
794 	return nValue != SQL_TC_NONE;
795 }
796 // -------------------------------------------------------------------------
allProceduresAreCallable()797 sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable(  ) throw(SQLException, RuntimeException)
798 {
799 	::rtl::OUString aValue;
800 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ACCESSIBLE_PROCEDURES,aValue,*this,m_pConnection->getTextEncoding());
801 	return aValue.toChar() == 'Y';
802 }
803 // -------------------------------------------------------------------------
supportsStoredProcedures()804 sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures(  ) throw(SQLException, RuntimeException)
805 {
806 	::rtl::OUString aValue;
807 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_PROCEDURES,aValue,*this,m_pConnection->getTextEncoding());
808 	return aValue.toChar() == 'Y';
809 }
810 // -------------------------------------------------------------------------
supportsSelectForUpdate()811 sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate(  ) throw(SQLException, RuntimeException)
812 {
813 	SQLUINTEGER nValue;
814 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
815 	return (nValue & SQL_CA1_POSITIONED_UPDATE) == SQL_CA1_POSITIONED_UPDATE;
816 }
817 // -------------------------------------------------------------------------
allTablesAreSelectable()818 sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable(  ) throw(SQLException, RuntimeException)
819 {
820 	::rtl::OUString aValue;
821 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ACCESSIBLE_TABLES,aValue,*this,m_pConnection->getTextEncoding());
822 	return aValue.toChar() == 'Y';
823 }
824 // -------------------------------------------------------------------------
isReadOnly()825 sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly(  ) throw(SQLException, RuntimeException)
826 {
827 	return m_pConnection->isReadOnly();
828 }
829 // -------------------------------------------------------------------------
usesLocalFiles()830 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles(  ) throw(SQLException, RuntimeException)
831 {
832 	SQLUSMALLINT nValue;
833 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this);
834 	return nValue == SQL_FILE_CATALOG;
835 }
836 // -------------------------------------------------------------------------
usesLocalFilePerTable()837 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable(  ) throw(SQLException, RuntimeException)
838 {
839 	SQLUSMALLINT nValue;
840 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this);
841 	return nValue == SQL_FILE_TABLE;
842 }
843 // -------------------------------------------------------------------------
supportsTypeConversion()844 sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion(  ) throw(SQLException, RuntimeException)
845 {
846 	SQLUINTEGER nValue;
847 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_FUNCTIONS,nValue,*this);
848 	return (nValue & SQL_FN_CVT_CONVERT) == SQL_FN_CVT_CONVERT;
849 }
850 // -------------------------------------------------------------------------
nullPlusNonNullIsNull()851 sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull(  ) throw(SQLException, RuntimeException)
852 {
853 	SQLUSMALLINT nValue;
854 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONCAT_NULL_BEHAVIOR,nValue,*this);
855 	return nValue == SQL_CB_NULL;
856 }
857 // -------------------------------------------------------------------------
supportsColumnAliasing()858 sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing(  ) throw(SQLException, RuntimeException)
859 {
860 	::rtl::OUString aValue;
861 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_COLUMN_ALIAS,aValue,*this,m_pConnection->getTextEncoding());
862 	return aValue.toChar() == 'Y';
863 }
864 // -------------------------------------------------------------------------
supportsTableCorrelationNames()865 sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames(  ) throw(SQLException, RuntimeException)
866 {
867 	SQLUSMALLINT nValue;
868 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
869 	return nValue != SQL_CN_NONE;
870 }
871 // -------------------------------------------------------------------------
supportsConvert(sal_Int32 fromType,sal_Int32 toType)872 sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException)
873 {
874 	if(fromType == toType)
875 		return sal_True;
876 
877 	SQLUINTEGER nValue=0;
878 	switch(fromType)
879 	{
880 		case DataType::BIT:
881 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BIT,nValue,*this);
882 			break;
883 		case DataType::TINYINT:
884 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TINYINT,nValue,*this);
885 			break;
886 		case DataType::SMALLINT:
887 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_SMALLINT,nValue,*this);
888 			break;
889 		case DataType::INTEGER:
890 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_INTEGER,nValue,*this);
891 			break;
892 		case DataType::BIGINT:
893 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BIGINT,nValue,*this);
894 			break;
895 		case DataType::FLOAT:
896 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_FLOAT,nValue,*this);
897 			break;
898 		case DataType::REAL:
899 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_REAL,nValue,*this);
900 			break;
901 		case DataType::DOUBLE:
902 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DOUBLE,nValue,*this);
903 			break;
904 		case DataType::NUMERIC:
905 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_NUMERIC,nValue,*this);
906 			break;
907 		case DataType::DECIMAL:
908 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DECIMAL,nValue,*this);
909 			break;
910 		case DataType::CHAR:
911 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_CHAR,nValue,*this);
912 			break;
913 		case DataType::VARCHAR:
914 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARCHAR,nValue,*this);
915 			break;
916 		case DataType::LONGVARCHAR:
917 		case DataType::CLOB:
918 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARCHAR,nValue,*this);
919 			break;
920 		case DataType::DATE:
921 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DATE,nValue,*this);
922 			break;
923 		case DataType::TIME:
924 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TIME,nValue,*this);
925 			break;
926 		case DataType::TIMESTAMP:
927 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TIMESTAMP,nValue,*this);
928 			break;
929 		case DataType::BINARY:
930 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_BINARY,nValue,*this);
931 			break;
932 		case DataType::VARBINARY:
933 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARBINARY,nValue,*this);
934 			break;
935 		case DataType::LONGVARBINARY:
936 		case DataType::BLOB:
937 			OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARBINARY,nValue,*this);
938 			break;
939 		case DataType::SQLNULL:
940 			//	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
941 			break;
942 		case DataType::OTHER:
943 			//	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
944 			break;
945 		case DataType::OBJECT:
946 			//	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
947 			break;
948 		case DataType::DISTINCT:
949 			//	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
950 			break;
951 		case DataType::STRUCT:
952 			//	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
953 			break;
954 		case DataType::ARRAY:
955 			//	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
956 			break;
957 		case DataType::REF:
958 			//	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
959 			break;
960 	}
961 	sal_Bool bConvert = sal_False;
962 	switch(toType)
963 	{
964 		case DataType::BIT:
965 			bConvert = (nValue & SQL_CVT_BIT) == SQL_CVT_BIT;
966 			break;
967 		case DataType::TINYINT:
968 			bConvert = (nValue & SQL_CVT_TINYINT) == SQL_CVT_TINYINT;
969 			break;
970 		case DataType::SMALLINT:
971 			bConvert = (nValue & SQL_CVT_SMALLINT) == SQL_CVT_SMALLINT;
972 			break;
973 		case DataType::INTEGER:
974 			bConvert = (nValue & SQL_CVT_INTEGER) == SQL_CVT_INTEGER;
975 			break;
976 		case DataType::BIGINT:
977 			bConvert = (nValue & SQL_CVT_BIGINT) == SQL_CVT_BIGINT;
978 			break;
979 		case DataType::FLOAT:
980 			bConvert = (nValue & SQL_CVT_FLOAT) == SQL_CVT_FLOAT;
981 			break;
982 		case DataType::REAL:
983 			bConvert = (nValue & SQL_CVT_REAL) == SQL_CVT_REAL;
984 			break;
985 		case DataType::DOUBLE:
986 			bConvert = (nValue & SQL_CVT_DOUBLE) == SQL_CVT_DOUBLE;
987 			break;
988 		case DataType::NUMERIC:
989 			bConvert = (nValue & SQL_CVT_NUMERIC) == SQL_CVT_NUMERIC;
990 			break;
991 		case DataType::DECIMAL:
992 			bConvert = (nValue & SQL_CVT_DECIMAL) == SQL_CVT_DECIMAL;
993 			break;
994 		case DataType::CHAR:
995 			bConvert = (nValue & SQL_CVT_CHAR) == SQL_CVT_CHAR;
996 			break;
997 		case DataType::VARCHAR:
998 			bConvert = (nValue & SQL_CVT_VARCHAR) == SQL_CVT_VARCHAR;
999 			break;
1000 		case DataType::LONGVARCHAR:
1001 		case DataType::CLOB:
1002 			bConvert = (nValue & SQL_CVT_LONGVARCHAR) == SQL_CVT_LONGVARCHAR;
1003 			break;
1004 		case DataType::DATE:
1005 			bConvert = (nValue & SQL_CVT_DATE) == SQL_CVT_DATE;
1006 			break;
1007 		case DataType::TIME:
1008 			bConvert = (nValue & SQL_CVT_TIME) == SQL_CVT_TIME;
1009 			break;
1010 		case DataType::TIMESTAMP:
1011 			bConvert = (nValue & SQL_CVT_TIMESTAMP) == SQL_CVT_TIMESTAMP;
1012 			break;
1013 		case DataType::BINARY:
1014 			bConvert = (nValue & SQL_CVT_BINARY) == SQL_CVT_BINARY;
1015 			break;
1016 		case DataType::VARBINARY:
1017 			bConvert = (nValue & SQL_CVT_VARBINARY) == SQL_CVT_VARBINARY;
1018 			break;
1019 		case DataType::LONGVARBINARY:
1020 		case DataType::BLOB:
1021 			bConvert = (nValue & SQL_CVT_LONGVARBINARY) == SQL_CVT_LONGVARBINARY;
1022 			break;
1023 	}
1024 
1025 	return bConvert;
1026 }
1027 // -------------------------------------------------------------------------
supportsExpressionsInOrderBy()1028 sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy(  ) throw(SQLException, RuntimeException)
1029 {
1030 	::rtl::OUString aValue;
1031 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_EXPRESSIONS_IN_ORDERBY,aValue,*this,m_pConnection->getTextEncoding());
1032 	return aValue.toChar() == 'Y';
1033 }
1034 // -------------------------------------------------------------------------
supportsGroupBy()1035 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy(  ) throw(SQLException, RuntimeException)
1036 {
1037 	SQLUSMALLINT nValue;
1038 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1039 	return nValue != SQL_GB_NOT_SUPPORTED;
1040 }
1041 // -------------------------------------------------------------------------
supportsGroupByBeyondSelect()1042 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect(  ) throw(SQLException, RuntimeException)
1043 {
1044 	SQLUSMALLINT nValue;
1045 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1046 	return nValue != SQL_GB_GROUP_BY_CONTAINS_SELECT;
1047 }
1048 // -------------------------------------------------------------------------
supportsGroupByUnrelated()1049 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated(  ) throw(SQLException, RuntimeException)
1050 {
1051 	SQLUSMALLINT nValue;
1052 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_GROUP_BY,nValue,*this);
1053 	return nValue == SQL_GB_NO_RELATION;
1054 }
1055 // -------------------------------------------------------------------------
supportsMultipleTransactions()1056 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions(  ) throw(SQLException, RuntimeException)
1057 {
1058 	::rtl::OUString aValue;
1059 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MULTIPLE_ACTIVE_TXN,aValue,*this,m_pConnection->getTextEncoding());
1060 	return aValue.toChar() == 'Y';
1061 }
1062 // -------------------------------------------------------------------------
supportsMultipleResultSets()1063 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets(  ) throw(SQLException, RuntimeException)
1064 {
1065 	::rtl::OUString aValue;
1066 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MULT_RESULT_SETS,aValue,*this,m_pConnection->getTextEncoding());
1067 	return aValue.toChar() == 'Y';
1068 }
1069 // -------------------------------------------------------------------------
supportsLikeEscapeClause()1070 sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause(  ) throw(SQLException, RuntimeException)
1071 {
1072 	::rtl::OUString aValue;
1073 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_LIKE_ESCAPE_CLAUSE,aValue,*this,m_pConnection->getTextEncoding());
1074 	return aValue.toChar() == 'Y';
1075 }
1076 // -------------------------------------------------------------------------
supportsOrderByUnrelated()1077 sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated(  ) throw(SQLException, RuntimeException)
1078 {
1079 	::rtl::OUString aValue;
1080 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ORDER_BY_COLUMNS_IN_SELECT,aValue,*this,m_pConnection->getTextEncoding());
1081 	return aValue.toChar() == 'N';
1082 }
1083 // -------------------------------------------------------------------------
supportsUnion()1084 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion(  ) throw(SQLException, RuntimeException)
1085 {
1086 	SQLUINTEGER nValue;
1087 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_UNION,nValue,*this);
1088 	return (nValue & SQL_U_UNION) == SQL_U_UNION;
1089 }
1090 // -------------------------------------------------------------------------
supportsUnionAll()1091 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll(  ) throw(SQLException, RuntimeException)
1092 {
1093 	SQLUINTEGER nValue;
1094 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_UNION,nValue,*this);
1095 	return (nValue & SQL_U_UNION_ALL) == SQL_U_UNION_ALL;
1096 }
1097 // -------------------------------------------------------------------------
supportsMixedCaseIdentifiers()1098 sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers(  ) throw(SQLException, RuntimeException)
1099 {
1100 	SQLUSMALLINT nValue;
1101 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
1102 	return nValue == SQL_IC_MIXED;
1103 }
1104 // -------------------------------------------------------------------------
impl_supportsMixedCaseQuotedIdentifiers_throw()1105 sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw(  )
1106 {
1107 	SQLUSMALLINT nValue;
1108 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
1109 	return nValue == SQL_IC_MIXED;
1110 }
1111 // -------------------------------------------------------------------------
nullsAreSortedAtEnd()1112 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd(  ) throw(SQLException, RuntimeException)
1113 {
1114 	SQLUSMALLINT nValue;
1115 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1116 	return nValue == SQL_NC_END;
1117 }
1118 // -------------------------------------------------------------------------
nullsAreSortedAtStart()1119 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart(  ) throw(SQLException, RuntimeException)
1120 {
1121 	SQLUSMALLINT nValue;
1122 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1123 	return nValue == SQL_NC_START;
1124 }
1125 // -------------------------------------------------------------------------
nullsAreSortedHigh()1126 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh(  ) throw(SQLException, RuntimeException)
1127 {
1128 	SQLUSMALLINT nValue;
1129 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1130 	return nValue == SQL_NC_HIGH;
1131 }
1132 // -------------------------------------------------------------------------
nullsAreSortedLow()1133 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow(  ) throw(SQLException, RuntimeException)
1134 {
1135 	SQLUSMALLINT nValue;
1136 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1137 	return nValue == SQL_NC_LOW;
1138 }
1139 // -------------------------------------------------------------------------
supportsSchemasInProcedureCalls()1140 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls(  ) throw(SQLException, RuntimeException)
1141 {
1142 	SQLUINTEGER nValue;
1143 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
1144 	return (nValue & SQL_SU_PROCEDURE_INVOCATION) == SQL_SU_PROCEDURE_INVOCATION;
1145 }
1146 // -------------------------------------------------------------------------
supportsSchemasInPrivilegeDefinitions()1147 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions(  ) throw(SQLException, RuntimeException)
1148 {
1149 	SQLUINTEGER nValue;
1150 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this);
1151 	return (nValue & SQL_SU_PRIVILEGE_DEFINITION) == SQL_SU_PRIVILEGE_DEFINITION;
1152 }
1153 // -------------------------------------------------------------------------
supportsCatalogsInProcedureCalls()1154 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls(  ) throw(SQLException, RuntimeException)
1155 {
1156 	SQLUINTEGER nValue=0;
1157 	if(m_bUseCatalog)
1158 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
1159 	return (nValue & SQL_CU_PROCEDURE_INVOCATION) == SQL_CU_PROCEDURE_INVOCATION;
1160 }
1161 // -------------------------------------------------------------------------
supportsCatalogsInPrivilegeDefinitions()1162 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions(  ) throw(SQLException, RuntimeException)
1163 {
1164 	SQLUINTEGER nValue=0;
1165 	if(m_bUseCatalog)
1166 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this);
1167 	return (nValue & SQL_CU_PRIVILEGE_DEFINITION) == SQL_CU_PRIVILEGE_DEFINITION;
1168 }
1169 // -------------------------------------------------------------------------
supportsCorrelatedSubqueries()1170 sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries(  ) throw(SQLException, RuntimeException)
1171 {
1172 	SQLUINTEGER nValue;
1173 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1174 	return (nValue & SQL_SQ_CORRELATED_SUBQUERIES) == SQL_SQ_CORRELATED_SUBQUERIES;
1175 }
1176 // -------------------------------------------------------------------------
supportsSubqueriesInComparisons()1177 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons(  ) throw(SQLException, RuntimeException)
1178 {
1179 	SQLUINTEGER nValue;
1180 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1181 	return (nValue & SQL_SQ_COMPARISON) == SQL_SQ_COMPARISON;
1182 }
1183 // -------------------------------------------------------------------------
supportsSubqueriesInExists()1184 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists(  ) throw(SQLException, RuntimeException)
1185 {
1186 	SQLUINTEGER nValue;
1187 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1188 	return (nValue & SQL_SQ_EXISTS) == SQL_SQ_EXISTS;
1189 }
1190 // -------------------------------------------------------------------------
supportsSubqueriesInIns()1191 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns(  ) throw(SQLException, RuntimeException)
1192 {
1193 	SQLUINTEGER nValue;
1194 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1195 	return (nValue & SQL_SQ_IN) == SQL_SQ_IN;
1196 }
1197 // -------------------------------------------------------------------------
supportsSubqueriesInQuantifieds()1198 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds(  ) throw(SQLException, RuntimeException)
1199 {
1200 	SQLUINTEGER nValue;
1201 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1202 	return (nValue & SQL_SQ_QUANTIFIED) == SQL_SQ_QUANTIFIED;
1203 }
1204 // -------------------------------------------------------------------------
supportsANSI92IntermediateSQL()1205 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL(  ) throw(SQLException, RuntimeException)
1206 {
1207 	SQLUINTEGER nValue;
1208 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
1209 	return nValue == SQL_SC_SQL92_INTERMEDIATE;
1210 }
1211 // -----------------------------------------------------------------------------
getURLImpl()1212 ::rtl::OUString ODatabaseMetaData::getURLImpl()
1213 {
1214 	::rtl::OUString aValue;
1215 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DATA_SOURCE_NAME,aValue,*this,m_pConnection->getTextEncoding());
1216 	return aValue;
1217 }
1218 // -------------------------------------------------------------------------
getURL()1219 ::rtl::OUString SAL_CALL ODatabaseMetaData::getURL(  ) throw(SQLException, RuntimeException)
1220 {
1221 	::rtl::OUString aValue = m_pConnection->getURL();
1222 	if ( !aValue.getLength() )
1223 	{
1224 		aValue = ::rtl::OUString::createFromAscii("sdbc:odbc:");
1225 		aValue += getURLImpl();
1226 	}
1227 	return aValue;
1228 }
1229 // -------------------------------------------------------------------------
getUserName()1230 ::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName(  ) throw(SQLException, RuntimeException)
1231 {
1232 	::rtl::OUString aValue;
1233 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_USER_NAME,aValue,*this,m_pConnection->getTextEncoding());
1234 	return aValue;
1235 }
1236 // -------------------------------------------------------------------------
getDriverName()1237 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName(  ) throw(SQLException, RuntimeException)
1238 {
1239 	::rtl::OUString aValue;
1240 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_NAME,aValue,*this,m_pConnection->getTextEncoding());
1241 	return aValue;
1242 }
1243 // -------------------------------------------------------------------------
getDriverVersion()1244 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
1245 {
1246 	::rtl::OUString aValue;
1247 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_ODBC_VER,aValue,*this,m_pConnection->getTextEncoding());
1248 	return aValue;
1249 }
1250 // -------------------------------------------------------------------------
getDatabaseProductVersion()1251 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion(  ) throw(SQLException, RuntimeException)
1252 {
1253 	::rtl::OUString aValue;
1254 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1255 	return aValue;
1256 }
1257 // -------------------------------------------------------------------------
getDatabaseProductName()1258 ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName(  ) throw(SQLException, RuntimeException)
1259 {
1260 	::rtl::OUString aValue;
1261 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DBMS_NAME,aValue,*this,m_pConnection->getTextEncoding());
1262 	return aValue;
1263 }
1264 // -------------------------------------------------------------------------
getProcedureTerm()1265 ::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm(  ) throw(SQLException, RuntimeException)
1266 {
1267 	::rtl::OUString aValue;
1268 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_PROCEDURE_TERM,aValue,*this,m_pConnection->getTextEncoding());
1269 	return aValue;
1270 }
1271 // -------------------------------------------------------------------------
getSchemaTerm()1272 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm(  ) throw(SQLException, RuntimeException)
1273 {
1274 	::rtl::OUString aValue;
1275 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SCHEMA_TERM,aValue,*this,m_pConnection->getTextEncoding());
1276 	return aValue;
1277 }
1278 // -------------------------------------------------------------------------
getDriverMajorVersion()1279 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion(  ) throw(RuntimeException)
1280 {
1281 	::rtl::OUString aValue;
1282 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1283 	return aValue.copy(0,aValue.indexOf('.')).toInt32();
1284 }
1285 // -------------------------------------------------------------------------
getDefaultTransactionIsolation()1286 sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation(  ) throw(SQLException, RuntimeException)
1287 {
1288 	SQLUINTEGER nValue;
1289 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this);
1290 	return nValue;
1291 }
1292 // -------------------------------------------------------------------------
getDriverMinorVersion()1293 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion(  ) throw(RuntimeException)
1294 {
1295 	::rtl::OUString aValue;
1296 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
1297 	return aValue.copy(0,aValue.lastIndexOf('.')).toInt32();
1298 }
1299 // -------------------------------------------------------------------------
getSQLKeywords()1300 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords(  ) throw(SQLException, RuntimeException)
1301 {
1302 	::rtl::OUString aValue;
1303 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_KEYWORDS,aValue,*this,m_pConnection->getTextEncoding());
1304 	return aValue;
1305 }
1306 // -------------------------------------------------------------------------
getSearchStringEscape()1307 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape(  ) throw(SQLException, RuntimeException)
1308 {
1309 	::rtl::OUString aValue;
1310 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SEARCH_PATTERN_ESCAPE,aValue,*this,m_pConnection->getTextEncoding());
1311 	return aValue;
1312 }
1313 // -------------------------------------------------------------------------
getStringFunctions()1314 ::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions(  ) throw(SQLException, RuntimeException)
1315 {
1316 	SQLUINTEGER nValue;
1317 	::rtl::OUStringBuffer aValue;
1318 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_STRING_FUNCTIONS,nValue,*this);
1319 	if(nValue & SQL_FN_STR_ASCII)
1320 		aValue.appendAscii("ASCII,");
1321 	if(nValue & SQL_FN_STR_BIT_LENGTH)
1322 		aValue.appendAscii("BIT_LENGTH,");
1323 	if(nValue & SQL_FN_STR_CHAR)
1324 		aValue.appendAscii("CHAR,");
1325 	if(nValue & SQL_FN_STR_CHAR_LENGTH)
1326 		aValue.appendAscii("CHAR_LENGTH,");
1327 	if(nValue & SQL_FN_STR_CHARACTER_LENGTH)
1328 		aValue.appendAscii("CHARACTER_LENGTH,");
1329 	if(nValue & SQL_FN_STR_CONCAT)
1330 		aValue.appendAscii("CONCAT,");
1331 	if(nValue & SQL_FN_STR_DIFFERENCE)
1332 		aValue.appendAscii("DIFFERENCE,");
1333 	if(nValue & SQL_FN_STR_INSERT)
1334 		aValue.appendAscii("INSERT,");
1335 	if(nValue & SQL_FN_STR_LCASE)
1336 		aValue.appendAscii("LCASE,");
1337 	if(nValue & SQL_FN_STR_LEFT)
1338 		aValue.appendAscii("LEFT,");
1339 	if(nValue & SQL_FN_STR_LENGTH)
1340 		aValue.appendAscii("LENGTH,");
1341 	if(nValue & SQL_FN_STR_LOCATE)
1342 		aValue.appendAscii("LOCATE,");
1343 	if(nValue & SQL_FN_STR_LOCATE_2)
1344 		aValue.appendAscii("LOCATE_2,");
1345 	if(nValue & SQL_FN_STR_LTRIM)
1346 		aValue.appendAscii("LTRIM,");
1347 	if(nValue & SQL_FN_STR_OCTET_LENGTH)
1348 		aValue.appendAscii("OCTET_LENGTH,");
1349 	if(nValue & SQL_FN_STR_POSITION)
1350 		aValue.appendAscii("POSITION,");
1351 	if(nValue & SQL_FN_STR_REPEAT)
1352 		aValue.appendAscii("REPEAT,");
1353 	if(nValue & SQL_FN_STR_REPLACE)
1354 		aValue.appendAscii("REPLACE,");
1355 	if(nValue & SQL_FN_STR_RIGHT)
1356 		aValue.appendAscii("RIGHT,");
1357 	if(nValue & SQL_FN_STR_RTRIM)
1358 		aValue.appendAscii("RTRIM,");
1359 	if(nValue & SQL_FN_STR_SOUNDEX)
1360 		aValue.appendAscii("SOUNDEX,");
1361 	if(nValue & SQL_FN_STR_SPACE)
1362 		aValue.appendAscii("SPACE,");
1363 	if(nValue & SQL_FN_STR_SUBSTRING)
1364 		aValue.appendAscii("SUBSTRING,");
1365 	if(nValue & SQL_FN_STR_UCASE)
1366 		aValue.appendAscii("UCASE,");
1367 
1368 
1369 	if ( aValue.getLength() )
1370         aValue.setLength(aValue.getLength()-1);
1371 
1372 	return aValue.makeStringAndClear();
1373 }
1374 // -------------------------------------------------------------------------
getTimeDateFunctions()1375 ::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions(  ) throw(SQLException, RuntimeException)
1376 {
1377 	SQLUINTEGER nValue;
1378 	::rtl::OUStringBuffer aValue;
1379 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TIMEDATE_FUNCTIONS,nValue,*this);
1380 
1381 	if(nValue & SQL_FN_TD_CURRENT_DATE)
1382 		aValue.appendAscii("CURRENT_DATE,");
1383 	if(nValue & SQL_FN_TD_CURRENT_TIME)
1384 		aValue.appendAscii("CURRENT_TIME,");
1385 	if(nValue & SQL_FN_TD_CURRENT_TIMESTAMP)
1386 		aValue.appendAscii("CURRENT_TIMESTAMP,");
1387 	if(nValue & SQL_FN_TD_CURDATE)
1388 		aValue.appendAscii("CURDATE,");
1389 	if(nValue & SQL_FN_TD_CURTIME)
1390 		aValue.appendAscii("CURTIME,");
1391 	if(nValue & SQL_FN_TD_DAYNAME)
1392 		aValue.appendAscii("DAYNAME,");
1393 	if(nValue & SQL_FN_TD_DAYOFMONTH)
1394 		aValue.appendAscii("DAYOFMONTH,");
1395 	if(nValue & SQL_FN_TD_DAYOFWEEK)
1396 		aValue.appendAscii("DAYOFWEEK,");
1397 	if(nValue & SQL_FN_TD_DAYOFYEAR)
1398 		aValue.appendAscii("DAYOFYEAR,");
1399 	if(nValue & SQL_FN_TD_EXTRACT)
1400 		aValue.appendAscii("EXTRACT,");
1401 	if(nValue & SQL_FN_TD_HOUR)
1402 		aValue.appendAscii("HOUR,");
1403 	if(nValue & SQL_FN_TD_MINUTE)
1404 		aValue.appendAscii("MINUTE,");
1405 	if(nValue & SQL_FN_TD_MONTH)
1406 		aValue.appendAscii("MONTH,");
1407 	if(nValue & SQL_FN_TD_MONTHNAME)
1408 		aValue.appendAscii("MONTHNAME,");
1409 	if(nValue & SQL_FN_TD_NOW)
1410 		aValue.appendAscii("NOW,");
1411 	if(nValue & SQL_FN_TD_QUARTER)
1412 		aValue.appendAscii("QUARTER,");
1413 	if(nValue & SQL_FN_TD_SECOND)
1414 		aValue.appendAscii("SECOND,");
1415 	if(nValue & SQL_FN_TD_TIMESTAMPADD)
1416 		aValue.appendAscii("TIMESTAMPADD,");
1417 	if(nValue & SQL_FN_TD_TIMESTAMPDIFF)
1418 		aValue.appendAscii("TIMESTAMPDIFF,");
1419 	if(nValue & SQL_FN_TD_WEEK)
1420 		aValue.appendAscii("WEEK,");
1421 	if(nValue & SQL_FN_TD_YEAR)
1422 		aValue.appendAscii("YEAR,");
1423 
1424 	if ( aValue.getLength() )
1425         aValue.setLength(aValue.getLength()-1);
1426 
1427 	return aValue.makeStringAndClear();
1428 }
1429 // -------------------------------------------------------------------------
getSystemFunctions()1430 ::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions(  ) throw(SQLException, RuntimeException)
1431 {
1432 	SQLUINTEGER nValue;
1433 	::rtl::OUStringBuffer aValue;
1434 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SYSTEM_FUNCTIONS,nValue,*this);
1435 
1436 	if(nValue & SQL_FN_SYS_DBNAME)
1437 		aValue.appendAscii("DBNAME,");
1438 	if(nValue & SQL_FN_SYS_IFNULL)
1439 		aValue.appendAscii("IFNULL,");
1440 	if(nValue & SQL_FN_SYS_USERNAME)
1441 		aValue.appendAscii("USERNAME,");
1442 
1443     if ( aValue.getLength() )
1444         aValue.setLength(aValue.getLength()-1);
1445 
1446 	return aValue.makeStringAndClear();
1447 }
1448 // -------------------------------------------------------------------------
getNumericFunctions()1449 ::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions(  ) throw(SQLException, RuntimeException)
1450 {
1451 	SQLUINTEGER nValue;
1452 	::rtl::OUStringBuffer aValue;
1453 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NUMERIC_FUNCTIONS,nValue,*this);
1454 
1455 	if(nValue & SQL_FN_NUM_ABS)
1456 		aValue.appendAscii("ABS,");
1457 	if(nValue & SQL_FN_NUM_ACOS)
1458 		aValue.appendAscii("ACOS,");
1459 	if(nValue & SQL_FN_NUM_ASIN)
1460 		aValue.appendAscii("ASIN,");
1461 	if(nValue & SQL_FN_NUM_ATAN)
1462 		aValue.appendAscii("ATAN,");
1463 	if(nValue & SQL_FN_NUM_ATAN2)
1464 		aValue.appendAscii("ATAN2,");
1465 	if(nValue & SQL_FN_NUM_CEILING)
1466 		aValue.appendAscii("CEILING,");
1467 	if(nValue & SQL_FN_NUM_COS)
1468 		aValue.appendAscii("COS,");
1469 	if(nValue & SQL_FN_NUM_COT)
1470 		aValue.appendAscii("COT,");
1471 	if(nValue & SQL_FN_NUM_DEGREES)
1472 		aValue.appendAscii("DEGREES,");
1473 	if(nValue & SQL_FN_NUM_EXP)
1474 		aValue.appendAscii("EXP,");
1475 	if(nValue & SQL_FN_NUM_FLOOR)
1476 		aValue.appendAscii("FLOOR,");
1477 	if(nValue & SQL_FN_NUM_LOG)
1478 		aValue.appendAscii("LOGF,");
1479 	if(nValue & SQL_FN_NUM_LOG10)
1480 		aValue.appendAscii("LOG10,");
1481 	if(nValue & SQL_FN_NUM_MOD)
1482 		aValue.appendAscii("MOD,");
1483 	if(nValue & SQL_FN_NUM_PI)
1484 		aValue.appendAscii("PI,");
1485 	if(nValue & SQL_FN_NUM_POWER)
1486 		aValue.appendAscii("POWER,");
1487 	if(nValue & SQL_FN_NUM_RADIANS)
1488 		aValue.appendAscii("RADIANS,");
1489 	if(nValue & SQL_FN_NUM_RAND)
1490 		aValue.appendAscii("RAND,");
1491 	if(nValue & SQL_FN_NUM_ROUND)
1492 		aValue.appendAscii("ROUND,");
1493 	if(nValue & SQL_FN_NUM_SIGN)
1494 		aValue.appendAscii("SIGN,");
1495 	if(nValue & SQL_FN_NUM_SIN)
1496 		aValue.appendAscii("SIN,");
1497 	if(nValue & SQL_FN_NUM_SQRT)
1498 		aValue.appendAscii("SQRT,");
1499 	if(nValue & SQL_FN_NUM_TAN)
1500 		aValue.appendAscii("TAN,");
1501 	if(nValue & SQL_FN_NUM_TRUNCATE)
1502 		aValue.appendAscii("TRUNCATE,");
1503 
1504 	if ( aValue.getLength() )
1505         aValue.setLength(aValue.getLength()-1);
1506 
1507 	return aValue.makeStringAndClear();
1508 }
1509 // -------------------------------------------------------------------------
supportsExtendedSQLGrammar()1510 sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar(  ) throw(SQLException, RuntimeException)
1511 {
1512 	SQLUINTEGER nValue;
1513 	if(m_bOdbc3)
1514 	{
1515 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this);
1516 		return nValue == SQL_OIC_LEVEL2;
1517 	}
1518 	else
1519 	{
1520 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this);
1521 		return nValue == SQL_OAC_LEVEL2;
1522 	}
1523 }
1524 // -------------------------------------------------------------------------
supportsCoreSQLGrammar()1525 sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar(  ) throw(SQLException, RuntimeException)
1526 {
1527 	SQLUINTEGER nValue;
1528 	if(m_bOdbc3)
1529 	{
1530 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this);
1531 		return nValue == SQL_OIC_CORE || nValue == SQL_OIC_LEVEL2 || nValue == SQL_OIC_LEVEL1;
1532 	}
1533 	else
1534 	{
1535 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1536 		return nValue == SQL_OSC_CORE || nValue == SQL_OAC_LEVEL1 || nValue == SQL_OAC_LEVEL2;
1537 	}
1538 }
1539 // -------------------------------------------------------------------------
supportsMinimumSQLGrammar()1540 sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar(  ) throw(SQLException, RuntimeException)
1541 {
1542 	SQLUINTEGER nValue;
1543 	if(m_bOdbc3)
1544 	{
1545 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this);
1546 		return nValue == SQL_OIC_LEVEL1 || nValue == SQL_OIC_LEVEL2;
1547 	}
1548 	else
1549 	{
1550 		OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this);
1551 		return nValue == SQL_OAC_LEVEL1 || nValue == SQL_OAC_LEVEL2;
1552 	}
1553 }
1554 // -------------------------------------------------------------------------
supportsFullOuterJoins()1555 sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins(  ) throw(SQLException, RuntimeException)
1556 {
1557 	SQLUINTEGER nValue;
1558 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
1559 	return (nValue & SQL_OJ_FULL) == SQL_OJ_FULL;
1560 }
1561 // -------------------------------------------------------------------------
supportsLimitedOuterJoins()1562 sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins(  ) throw(SQLException, RuntimeException)
1563 {
1564 	return supportsFullOuterJoins(  );
1565 }
1566 // -------------------------------------------------------------------------
getMaxColumnsInGroupBy()1567 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy(  ) throw(SQLException, RuntimeException)
1568 {
1569 	SQLUSMALLINT nValue;
1570 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_GROUP_BY,nValue,*this);
1571 	return nValue;
1572 }
1573 // -------------------------------------------------------------------------
getMaxColumnsInOrderBy()1574 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy(  ) throw(SQLException, RuntimeException)
1575 {
1576 	SQLUSMALLINT nValue;
1577 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_ORDER_BY,nValue,*this);
1578 	return nValue;
1579 }
1580 // -------------------------------------------------------------------------
getMaxColumnsInSelect()1581 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect(  ) throw(SQLException, RuntimeException)
1582 {
1583 	SQLUSMALLINT nValue;
1584 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_SELECT,nValue,*this);
1585 	return nValue;
1586 }
1587 // -------------------------------------------------------------------------
getMaxUserNameLength()1588 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength(  ) throw(SQLException, RuntimeException)
1589 {
1590 	SQLUSMALLINT nValue;
1591 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_USER_NAME_LEN,nValue,*this);
1592 	return nValue;
1593 }
1594 // -------------------------------------------------------------------------
supportsResultSetType(sal_Int32 setType)1595 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
1596 {
1597 	SQLUINTEGER nValue;
1598 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_SENSITIVITY,nValue,*this);
1599 	return (nValue & static_cast<SQLUINTEGER>(setType)) == static_cast<SQLUINTEGER>(setType);
1600 }
1601 // -------------------------------------------------------------------------
supportsResultSetConcurrency(sal_Int32 setType,sal_Int32 concurrency)1602 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException)
1603 {
1604 	SQLUINTEGER nValue;
1605     SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1606 	switch(setType)
1607 	{
1608         default:
1609 		case ResultSetType::FORWARD_ONLY:
1610 			nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1611 			break;
1612 		case ResultSetType::SCROLL_INSENSITIVE:
1613 			nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1614 			break;
1615 		case ResultSetType::SCROLL_SENSITIVE:
1616 			nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1617 			break;
1618 	}
1619 
1620 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1621 	sal_Bool bRet = sal_False;
1622 	switch(concurrency)
1623 	{
1624 		case ResultSetConcurrency::READ_ONLY:
1625 			bRet = (nValue & SQL_CA2_READ_ONLY_CONCURRENCY) == SQL_CA2_READ_ONLY_CONCURRENCY;
1626 			break;
1627 		case ResultSetConcurrency::UPDATABLE:
1628 			bRet = (nValue & SQL_CA2_OPT_VALUES_CONCURRENCY) == SQL_CA2_OPT_VALUES_CONCURRENCY;
1629 			break;
1630 	}
1631 	return bRet;
1632 }
1633 // -------------------------------------------------------------------------
ownUpdatesAreVisible(sal_Int32 setType)1634 sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1635 {
1636 	SQLUINTEGER nValue;
1637     SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1638 	switch(setType)
1639 	{
1640         default:
1641 		case ResultSetType::FORWARD_ONLY:
1642 			nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1643 			break;
1644 		case ResultSetType::SCROLL_INSENSITIVE:
1645 			nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1646 			break;
1647 		case ResultSetType::SCROLL_SENSITIVE:
1648 			nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1649 			break;
1650 	}
1651 
1652 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1653 	return (nValue & SQL_CA2_SENSITIVITY_UPDATES) == SQL_CA2_SENSITIVITY_UPDATES;
1654 }
1655 // -------------------------------------------------------------------------
ownDeletesAreVisible(sal_Int32 setType)1656 sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1657 {
1658 	SQLUINTEGER nValue;
1659     SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1660 	switch(setType)
1661 	{
1662         default:
1663 		case ResultSetType::FORWARD_ONLY:
1664 			nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1665 			break;
1666 		case ResultSetType::SCROLL_INSENSITIVE:
1667 			nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1668 			break;
1669 		case ResultSetType::SCROLL_SENSITIVE:
1670 			nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1671 			break;
1672 	}
1673 
1674 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1675 	return (nValue & SQL_CA2_SENSITIVITY_DELETIONS) != SQL_CA2_SENSITIVITY_DELETIONS;
1676 }
1677 // -------------------------------------------------------------------------
ownInsertsAreVisible(sal_Int32 setType)1678 sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1679 {
1680 	SQLUINTEGER nValue;
1681     SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1682 	switch(setType)
1683 	{
1684         default:
1685 		case ResultSetType::FORWARD_ONLY:
1686 			nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1687 			break;
1688 		case ResultSetType::SCROLL_INSENSITIVE:
1689 			nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1690 			break;
1691 		case ResultSetType::SCROLL_SENSITIVE:
1692 			nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1693 			break;
1694 	}
1695 
1696 	OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this);
1697 	return (nValue & SQL_CA2_SENSITIVITY_ADDITIONS) == SQL_CA2_SENSITIVITY_ADDITIONS;
1698 }
1699 // -------------------------------------------------------------------------
othersUpdatesAreVisible(sal_Int32 setType)1700 sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1701 {
1702 	return ownUpdatesAreVisible(setType);
1703 }
1704 // -------------------------------------------------------------------------
othersDeletesAreVisible(sal_Int32 setType)1705 sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1706 {
1707 	return ownDeletesAreVisible(setType);
1708 }
1709 // -------------------------------------------------------------------------
othersInsertsAreVisible(sal_Int32 setType)1710 sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1711 {
1712 	return ownInsertsAreVisible(setType);
1713 }
1714 // -------------------------------------------------------------------------
updatesAreDetected(sal_Int32)1715 sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
1716 {
1717 	return sal_False;
1718 }
1719 // -------------------------------------------------------------------------
deletesAreDetected(sal_Int32)1720 sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
1721 {
1722 	return sal_False;
1723 }
1724 // -------------------------------------------------------------------------
insertsAreDetected(sal_Int32)1725 sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
1726 {
1727 	return sal_False;
1728 }
1729 // -------------------------------------------------------------------------
supportsBatchUpdates()1730 sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates(  ) throw(SQLException, RuntimeException)
1731 {
1732 	return sal_False;
1733 }
1734 // -------------------------------------------------------------------------
getUDTs(const Any &,const::rtl::OUString &,const::rtl::OUString &,const Sequence<sal_Int32> &)1735 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)
1736 {
1737 	return NULL;
1738 }
1739 // -----------------------------------------------------------------------------
1740