Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / mysqlc / source / mysqlc_databasemetadata.cxx
blobe134e05d6e0e8f7ad9ef750b20cddf987aa27125
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #include "mysqlc_databasemetadata.hxx"
20 #include <com/sun/star/sdbc/DataType.hpp>
21 #include <com/sun/star/sdbc/ResultSetType.hpp>
22 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
23 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
24 #include <com/sun/star/sdbc/KeyRule.hpp>
25 #include <com/sun/star/sdbc/Deferrability.hpp>
26 #include <com/sun/star/sdbc/IndexType.hpp>
27 #include <com/sun/star/sdbc/BestRowScope.hpp>
28 #include <com/sun/star/sdbc/ColumnType.hpp>
29 #include <com/sun/star/lang/XInitialization.hpp>
32 #include "mysqlc_general.hxx"
33 #include "mysqlc_statement.hxx"
34 #include "mysqlc_driver.hxx"
35 #include "mysqlc_preparedstatement.hxx"
37 #include <stdio.h>
39 using namespace connectivity::mysqlc;
40 using namespace com::sun::star::uno;
41 using namespace com::sun::star::lang;
42 using namespace com::sun::star::beans;
43 using namespace com::sun::star::sdbc;
44 using ::rtl::OUString;
45 using mysqlc_sdbc_driver::getStringFromAny;
47 #include <cppconn/connection.h>
48 #include <cppconn/resultset.h>
49 #include <cppconn/metadata.h>
50 #include <cppconn/statement.h>
51 #include <cppconn/prepared_statement.h>
53 #include <sal/macros.h>
55 static std::string wild("%");
57 using ::rtl::OUStringToOString;
59 // -----------------------------------------------------------------------------
60 void lcl_setRows_throw(const Reference< XResultSet >& _xResultSet,sal_Int32 _nType,const std::vector< std::vector< Any > >& _rRows)
62 Reference< XInitialization> xIni(_xResultSet,UNO_QUERY);
63 Sequence< Any > aArgs(2);
64 aArgs[0] <<= _nType;
66 Sequence< Sequence< Any > > aRows(_rRows.size());
68 std::vector< std::vector< Any > >::const_iterator aIter = _rRows.begin();
69 Sequence< Any > * pRowsIter = aRows.getArray();
70 Sequence< Any > * pRowsEnd = pRowsIter + aRows.getLength();
71 for (; pRowsIter != pRowsEnd;++pRowsIter,++aIter) {
72 if (!aIter->empty()) {
73 Sequence<Any> aSeq(&(*aIter->begin()),aIter->size());
74 (*pRowsIter) = aSeq;
77 aArgs[1] <<= aRows;
78 xIni->initialize(aArgs);
82 /* {{{ ODatabaseMetaData::ODatabaseMetaData() -I- */
83 ODatabaseMetaData::ODatabaseMetaData(OConnection& _rCon)
84 :m_rConnection(_rCon)
85 ,m_bUseCatalog(sal_True)
86 ,meta(_rCon.getConnectionSettings().cppConnection->getMetaData())
87 ,identifier_quote_string_set(false)
89 OSL_TRACE("ODatabaseMetaData::ODatabaseMetaData");
90 if (!m_rConnection.isCatalogUsed())
92 osl_atomic_increment(&m_refCount);
93 m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
94 osl_atomic_decrement(&m_refCount);
97 /* }}} */
100 /* {{{ ODatabaseMetaData::~ODatabaseMetaData() -I- */
101 ODatabaseMetaData::~ODatabaseMetaData()
103 OSL_TRACE("ODatabaseMetaData::~ODatabaseMetaData");
105 /* }}} */
108 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
109 OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, const std::string& (sql::DatabaseMetaData::*_Method)() )
111 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
112 OUString stringMetaData;
113 try {
114 stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding());
115 } catch (const sql::MethodNotImplementedException &) {
116 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
117 } catch (const sql::InvalidArgumentException &) {
118 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
119 } catch (const sql::SQLException& e) {
120 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
122 return stringMetaData;
124 /* }}} */
127 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
128 OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, std::string (sql::DatabaseMetaData::*_Method)() )
130 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
131 OUString stringMetaData;
132 try {
133 stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding());
134 } catch (const sql::MethodNotImplementedException &) {
135 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
136 } catch (const sql::InvalidArgumentException &) {
137 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
138 } catch (const sql::SQLException& e) {
139 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
141 return stringMetaData;
143 /* }}} */
146 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
147 OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, const sql::SQLString& (sql::DatabaseMetaData::*_Method)() )
149 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
150 OUString stringMetaData;
151 try {
152 stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding());
153 } catch (const sql::MethodNotImplementedException &) {
154 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
155 } catch (const sql::InvalidArgumentException &) {
156 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
157 } catch (const sql::SQLException& e) {
158 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
160 return stringMetaData;
162 /* }}} */
165 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
166 OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, sql::SQLString (sql::DatabaseMetaData::*_Method)() )
168 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
169 OUString stringMetaData;
170 try {
171 stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding());
172 } catch (const sql::MethodNotImplementedException &) {
173 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
174 } catch (const sql::InvalidArgumentException &) {
175 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
176 } catch (const sql::SQLException& e) {
177 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
179 return stringMetaData;
181 /* }}} */
184 /* {{{ ODatabaseMetaData::impl_getInt32MetaData() -I- */
185 sal_Int32 ODatabaseMetaData::impl_getInt32MetaData(const sal_Char* _methodName, unsigned int (sql::DatabaseMetaData::*_Method)() )
187 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
188 sal_Int32 int32MetaData(0);
189 try {
190 int32MetaData = (meta->*_Method)();
191 } catch (const sql::MethodNotImplementedException &) {
192 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
193 } catch (const sql::InvalidArgumentException &) {
194 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
195 } catch (const sql::SQLException& e) {
196 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
198 return int32MetaData;
200 /* }}} */
203 /* {{{ ODatabaseMetaData::impl_getBoolMetaData() -I- */
204 sal_Bool ODatabaseMetaData::impl_getBoolMetaData(const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)() )
206 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
207 sal_Bool boolMetaData(0);
208 try {
209 boolMetaData = (meta->*_Method)() ? sal_True : sal_False;
210 } catch (const sql::MethodNotImplementedException &) {
211 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
212 } catch (const sql::InvalidArgumentException &) {
213 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
214 } catch (const sql::SQLException& e) {
215 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
217 return boolMetaData;
219 /* }}} */
222 /* {{{ ODatabaseMetaData::impl_getBoolMetaData() -I- */
223 sal_Bool ODatabaseMetaData::impl_getBoolMetaData(const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)(int), sal_Int32 _arg )
225 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName);
226 sal_Bool boolMetaData(0);
227 try {
228 boolMetaData = (meta->*_Method)( _arg ) ? sal_True : sal_False;
229 } catch (const sql::MethodNotImplementedException &) {
230 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this);
231 } catch (const sql::InvalidArgumentException &) {
232 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this);
233 } catch (const sql::SQLException& e) {
234 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
236 return boolMetaData;
238 /* }}} */
241 /* {{{ ODatabaseMetaData::impl_getRSTypeMetaData() -I- */
242 sal_Bool ODatabaseMetaData::impl_getRSTypeMetaData(const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)(int), sal_Int32 _resultSetType )
244 int resultSetType(sql::ResultSet::TYPE_FORWARD_ONLY);
245 switch ( _resultSetType ) {
246 case ResultSetType::SCROLL_INSENSITIVE: resultSetType = sql::ResultSet::TYPE_SCROLL_INSENSITIVE; break;
247 case ResultSetType::SCROLL_SENSITIVE: resultSetType = sql::ResultSet::TYPE_SCROLL_SENSITIVE; break;
250 return impl_getBoolMetaData(_methodName, _Method, resultSetType);
252 /* }}} */
255 /* {{{ ODatabaseMetaData::getCatalogSeparator() -I- */
256 OUString SAL_CALL ODatabaseMetaData::getCatalogSeparator()
257 throw(SQLException, RuntimeException)
259 return impl_getStringMetaData("getCatalogSeparator", &sql::DatabaseMetaData::getCatalogSeparator);
261 /* }}} */
264 /* {{{ ODatabaseMetaData::getMaxBinaryLiteralLength() -I- */
265 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength()
266 throw(SQLException, RuntimeException)
268 return impl_getInt32MetaData("getMaxBinaryLiteralLength", &sql::DatabaseMetaData::getMaxBinaryLiteralLength);
270 /* }}} */
273 /* {{{ ODatabaseMetaData::getMaxRowSize() -I- */
274 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize()
275 throw(SQLException, RuntimeException)
277 return impl_getInt32MetaData("getMaxRowSize", &sql::DatabaseMetaData::getMaxRowSize);
279 /* }}} */
282 /* {{{ ODatabaseMetaData::getMaxCatalogNameLength() -I- */
283 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength()
284 throw(SQLException, RuntimeException)
286 return impl_getInt32MetaData("getMaxCatalogNameLength", &sql::DatabaseMetaData::getMaxCatalogNameLength);
288 /* }}} */
291 /* {{{ ODatabaseMetaData::getMaxCharLiteralLength() -I- */
292 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength()
293 throw(SQLException, RuntimeException)
295 return impl_getInt32MetaData("getMaxCharLiteralLength", &sql::DatabaseMetaData::getMaxCharLiteralLength);
297 /* }}} */
300 /* {{{ ODatabaseMetaData::getMaxColumnNameLength() -I- */
301 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength()
302 throw(SQLException, RuntimeException)
304 return impl_getInt32MetaData("getMaxColumnNameLength", &sql::DatabaseMetaData::getMaxColumnNameLength);
306 /* }}} */
309 /* {{{ ODatabaseMetaData::getMaxColumnsInIndex() -I- */
310 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex()
311 throw(SQLException, RuntimeException)
313 return impl_getInt32MetaData("getMaxColumnsInIndex", &sql::DatabaseMetaData::getMaxColumnsInIndex);
315 /* }}} */
318 /* {{{ ODatabaseMetaData::getMaxCursorNameLength() -I- */
319 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength()
320 throw(SQLException, RuntimeException)
322 return impl_getInt32MetaData("getMaxCursorNameLength", &sql::DatabaseMetaData::getMaxCursorNameLength);
324 /* }}} */
327 /* {{{ ODatabaseMetaData::getMaxConnections() -I- */
328 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections()
329 throw(SQLException, RuntimeException)
331 return impl_getInt32MetaData("getMaxConnections", &sql::DatabaseMetaData::getMaxConnections);
333 /* }}} */
336 /* {{{ ODatabaseMetaData::getMaxColumnsInTable() -I- */
337 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable()
338 throw(SQLException, RuntimeException)
340 return impl_getInt32MetaData("getMaxColumnsInTable", &sql::DatabaseMetaData::getMaxColumnsInTable);
342 /* }}} */
345 /* {{{ ODatabaseMetaData::getMaxStatementLength() -I- */
346 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength()
347 throw(SQLException, RuntimeException)
349 return impl_getInt32MetaData("getMaxStatementLength", &sql::DatabaseMetaData::getMaxStatementLength);
351 /* }}} */
354 /* {{{ ODatabaseMetaData::getMaxTableNameLength() -I- */
355 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength()
356 throw(SQLException, RuntimeException)
358 return impl_getInt32MetaData("getMaxTableNameLength", &sql::DatabaseMetaData::getMaxTableNameLength);
360 /* }}} */
362 /* {{{ ODatabaseMetaData::getMaxTablesInSelect() -I- */
363 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect()
364 throw(SQLException, RuntimeException)
366 return impl_getInt32MetaData("getMaxTablesInSelect", &sql::DatabaseMetaData::getMaxTablesInSelect);
368 /* }}} */
371 /* {{{ ODatabaseMetaData::doesMaxRowSizeIncludeBlobs() -I- */
372 sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs()
373 throw(SQLException, RuntimeException)
375 return impl_getBoolMetaData("doesMaxRowSizeIncludeBlobs", &sql::DatabaseMetaData::doesMaxRowSizeIncludeBlobs);
377 /* }}} */
380 /* {{{ ODatabaseMetaData::storesLowerCaseQuotedIdentifiers() -I- */
381 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers()
382 throw(SQLException, RuntimeException)
384 return impl_getBoolMetaData("storesLowerCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesLowerCaseQuotedIdentifiers);
386 /* }}} */
389 /* {{{ ODatabaseMetaData::storesLowerCaseIdentifiers() -I- */
390 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers()
391 throw(SQLException, RuntimeException)
393 return impl_getBoolMetaData("storesLowerCaseIdentifiers", &sql::DatabaseMetaData::storesLowerCaseIdentifiers);
395 /* }}} */
398 /* {{{ ODatabaseMetaData::storesMixedCaseQuotedIdentifiers() -I- */
399 sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseQuotedIdentifiers()
400 throw(SQLException, RuntimeException)
402 return impl_getBoolMetaData("storesMixedCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesMixedCaseQuotedIdentifiers);
404 /* }}} */
407 /* {{{ ODatabaseMetaData::storesMixedCaseIdentifiers() -I- */
408 sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers()
409 throw(SQLException, RuntimeException)
411 return impl_getBoolMetaData("storesMixedCaseIdentifiers", &sql::DatabaseMetaData::storesMixedCaseIdentifiers);
413 /* }}} */
416 /* {{{ ODatabaseMetaData::storesUpperCaseQuotedIdentifiers() -I- */
417 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers()
418 throw(SQLException, RuntimeException)
420 return impl_getBoolMetaData("storesUpperCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesUpperCaseQuotedIdentifiers);
422 /* }}} */
425 /* {{{ ODatabaseMetaData::storesUpperCaseIdentifiers() -I- */
426 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers()
427 throw(SQLException, RuntimeException)
429 return impl_getBoolMetaData("storesUpperCaseIdentifiers", &sql::DatabaseMetaData::storesUpperCaseIdentifiers);
431 /* }}} */
434 /* {{{ ODatabaseMetaData::supportsAlterTableWithAddColumn() -I- */
435 sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithAddColumn()
436 throw(SQLException, RuntimeException)
438 return impl_getBoolMetaData("supportsAlterTableWithAddColumn", &sql::DatabaseMetaData::supportsAlterTableWithAddColumn);
440 /* }}} */
443 /* {{{ ODatabaseMetaData::supportsAlterTableWithDropColumn() -I- */
444 sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithDropColumn()
445 throw(SQLException, RuntimeException)
447 return impl_getBoolMetaData("supportsAlterTableWithDropColumn", &sql::DatabaseMetaData::supportsAlterTableWithDropColumn);
449 /* }}} */
452 /* {{{ ODatabaseMetaData::getMaxIndexLength() -I- */
453 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength()
454 throw(SQLException, RuntimeException)
456 return impl_getInt32MetaData("getMaxIndexLength", &sql::DatabaseMetaData::getMaxIndexLength);
458 /* }}} */
461 /* {{{ ODatabaseMetaData::supportsNonNullableColumns() -I- */
462 sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns()
463 throw(SQLException, RuntimeException)
465 return impl_getBoolMetaData("supportsNonNullableColumns", &sql::DatabaseMetaData::supportsNonNullableColumns);
467 /* }}} */
470 /* {{{ ODatabaseMetaData::getCatalogTerm() -I- */
471 OUString SAL_CALL ODatabaseMetaData::getCatalogTerm()
472 throw(SQLException, RuntimeException)
474 return impl_getStringMetaData("getCatalogTerm", &sql::DatabaseMetaData::getCatalogTerm);
476 /* }}} */
479 /* {{{ ODatabaseMetaData::getIdentifierQuoteString() -I- */
480 OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString()
481 throw(SQLException, RuntimeException)
483 if (identifier_quote_string_set == false) {
484 identifier_quote_string = impl_getStringMetaData("getIdentifierQuoteString", &sql::DatabaseMetaData::getIdentifierQuoteString);
485 identifier_quote_string_set = true;
487 return identifier_quote_string;
489 /* }}} */
492 /* {{{ ODatabaseMetaData::getExtraNameCharacters() -I- */
493 OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters()
494 throw(SQLException, RuntimeException)
496 return impl_getStringMetaData("getExtraNameCharacters", &sql::DatabaseMetaData::getExtraNameCharacters);
498 /* }}} */
501 /* {{{ ODatabaseMetaData::supportsDifferentTableCorrelationNames() -I- */
502 sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames()
503 throw(SQLException, RuntimeException)
505 return impl_getBoolMetaData("supportsDifferentTableCorrelationNames", &sql::DatabaseMetaData::supportsDifferentTableCorrelationNames);
507 /* }}} */
510 /* {{{ ODatabaseMetaData::isCatalogAtStart() -I- */
511 sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart()
512 throw(SQLException, RuntimeException)
514 return impl_getBoolMetaData("isCatalogAtStart", &sql::DatabaseMetaData::isCatalogAtStart);
516 /* }}} */
519 /* {{{ ODatabaseMetaData::dataDefinitionIgnoredInTransactions() -I- */
520 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions()
521 throw(SQLException, RuntimeException)
523 return impl_getBoolMetaData("dataDefinitionIgnoredInTransactions", &sql::DatabaseMetaData::dataDefinitionIgnoredInTransactions);
525 /* }}} */
528 /* {{{ ODatabaseMetaData::dataDefinitionCausesTransactionCommit() -I- */
529 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit()
530 throw(SQLException, RuntimeException)
532 return impl_getBoolMetaData("dataDefinitionCausesTransactionCommit", &sql::DatabaseMetaData::dataDefinitionCausesTransactionCommit);
534 /* }}} */
537 /* {{{ ODatabaseMetaData::supportsDataManipulationTransactionsOnly() -I- */
538 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly()
539 throw(SQLException, RuntimeException)
541 return impl_getBoolMetaData("supportsDataManipulationTransactionsOnly", &sql::DatabaseMetaData::supportsDataManipulationTransactionsOnly);
543 /* }}} */
546 /* {{{ ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions() -I- */
547 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions()
548 throw(SQLException, RuntimeException)
550 return impl_getBoolMetaData("supportsDataDefinitionAndDataManipulationTransactions", &sql::DatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions);
552 /* }}} */
555 /* {{{ ODatabaseMetaData::supportsPositionedDelete() -I- */
556 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete()
557 throw(SQLException, RuntimeException)
559 return impl_getBoolMetaData("supportsPositionedDelete", &sql::DatabaseMetaData::supportsPositionedDelete);
561 /* }}} */
564 /* {{{ ODatabaseMetaData::supportsPositionedUpdate() -I- */
565 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate()
566 throw(SQLException, RuntimeException)
568 return impl_getBoolMetaData("supportsPositionedUpdate", &sql::DatabaseMetaData::supportsPositionedUpdate);
570 /* }}} */
573 /* {{{ ODatabaseMetaData::supportsOpenStatementsAcrossRollback() -I- */
574 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback()
575 throw(SQLException, RuntimeException)
577 return impl_getBoolMetaData("supportsOpenStatementsAcrossRollback", &sql::DatabaseMetaData::supportsOpenStatementsAcrossRollback);
579 /* }}} */
582 /* {{{ ODatabaseMetaData::supportsOpenStatementsAcrossCommit() -I- */
583 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit()
584 throw(SQLException, RuntimeException)
586 return impl_getBoolMetaData("supportsOpenStatementsAcrossCommit", &sql::DatabaseMetaData::supportsOpenStatementsAcrossCommit);
588 /* }}} */
591 /* {{{ ODatabaseMetaData::supportsOpenCursorsAcrossCommit() -I- */
592 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit()
593 throw(SQLException, RuntimeException)
595 return impl_getBoolMetaData("supportsOpenCursorsAcrossCommit", &sql::DatabaseMetaData::supportsOpenCursorsAcrossCommit);
597 /* }}} */
600 /* {{{ ODatabaseMetaData::supportsOpenCursorsAcrossRollback() -I- */
601 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback()
602 throw(SQLException, RuntimeException)
604 return impl_getBoolMetaData("supportsOpenCursorsAcrossRollback", &sql::DatabaseMetaData::supportsOpenCursorsAcrossRollback);
606 /* }}} */
609 /* {{{ ODatabaseMetaData::supportsTransactionIsolationLevel() -I- */
610 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel(sal_Int32 level)
611 throw(SQLException, RuntimeException)
613 return impl_getBoolMetaData("supportsTransactionIsolationLevel", &sql::DatabaseMetaData::supportsTransactionIsolationLevel, level);
615 /* }}} */
618 /* {{{ ODatabaseMetaData::supportsSchemasInDataManipulation() -I- */
619 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation()
620 throw(SQLException, RuntimeException)
622 return impl_getBoolMetaData("supportsSchemasInDataManipulation", &sql::DatabaseMetaData::supportsSchemasInDataManipulation);
624 /* }}} */
627 /* {{{ ODatabaseMetaData::supportsANSI92FullSQL() -I- */
628 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL()
629 throw(SQLException, RuntimeException)
631 return impl_getBoolMetaData("supportsANSI92FullSQL", &sql::DatabaseMetaData::supportsANSI92FullSQL);
633 /* }}} */
636 /* {{{ ODatabaseMetaData::supportsANSI92EntryLevelSQL() -I- */
637 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL()
638 throw(SQLException, RuntimeException)
640 return impl_getBoolMetaData("supportsANSI92EntryLevelSQL", &sql::DatabaseMetaData::supportsANSI92EntryLevelSQL);
642 /* }}} */
645 /* {{{ ODatabaseMetaData::supportsIntegrityEnhancementFacility() -I- */
646 sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility()
647 throw(SQLException, RuntimeException)
649 return impl_getBoolMetaData("supportsIntegrityEnhancementFacility", &sql::DatabaseMetaData::supportsIntegrityEnhancementFacility);
651 /* }}} */
654 /* {{{ ODatabaseMetaData::supportsSchemasInIndexDefinitions() -I- */
655 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions()
656 throw(SQLException, RuntimeException)
658 return impl_getBoolMetaData("supportsSchemasInIndexDefinitions", &sql::DatabaseMetaData::supportsSchemasInIndexDefinitions);
660 /* }}} */
663 /* {{{ ODatabaseMetaData::supportsSchemasInTableDefinitions() -I- */
664 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions()
665 throw(SQLException, RuntimeException)
667 return impl_getBoolMetaData("supportsSchemasInTableDefinitions", &sql::DatabaseMetaData::supportsSchemasInTableDefinitions);
669 /* }}} */
672 /* {{{ ODatabaseMetaData::supportsCatalogsInTableDefinitions() -I- */
673 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInTableDefinitions()
674 throw(SQLException, RuntimeException)
676 return impl_getBoolMetaData("supportsCatalogsInTableDefinitions", &sql::DatabaseMetaData::supportsCatalogsInTableDefinitions);
678 /* }}} */
681 /* {{{ ODatabaseMetaData::supportsCatalogsInIndexDefinitions() -I- */
682 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions()
683 throw(SQLException, RuntimeException)
685 return impl_getBoolMetaData("supportsCatalogsInIndexDefinitions", &sql::DatabaseMetaData::supportsCatalogsInIndexDefinitions);
687 /* }}} */
690 /* {{{ ODatabaseMetaData::supportsCatalogsInDataManipulation() -I- */
691 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation()
692 throw(SQLException, RuntimeException)
694 return impl_getBoolMetaData("supportsCatalogsInDataManipulation", &sql::DatabaseMetaData::supportsCatalogsInDataManipulation);
696 /* }}} */
699 /* {{{ ODatabaseMetaData::supportsOuterJoins() -I- */
700 sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins()
701 throw(SQLException, RuntimeException)
703 return impl_getBoolMetaData("supportsOuterJoins", &sql::DatabaseMetaData::supportsOuterJoins);
705 /* }}} */
708 /* {{{ ODatabaseMetaData::getMaxStatements() -I- */
709 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements()
710 throw(SQLException, RuntimeException)
712 return impl_getInt32MetaData("getMaxStatements", &sql::DatabaseMetaData::getMaxStatements);
714 /* }}} */
717 /* {{{ ODatabaseMetaData::getMaxProcedureNameLength() -I- */
718 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength()
719 throw(SQLException, RuntimeException)
721 return impl_getInt32MetaData("getMaxProcedureNameLength", &sql::DatabaseMetaData::getMaxProcedureNameLength);
723 /* }}} */
726 /* {{{ ODatabaseMetaData::getMaxSchemaNameLength() -I- */
727 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength()
728 throw(SQLException, RuntimeException)
730 return impl_getInt32MetaData("getMaxSchemaNameLength", &sql::DatabaseMetaData::getMaxSchemaNameLength);
732 /* }}} */
735 /* {{{ ODatabaseMetaData::supportsTransactions() -I- */
736 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions()
737 throw(SQLException, RuntimeException)
739 return impl_getBoolMetaData("supportsTransactions", &sql::DatabaseMetaData::supportsTransactions);
741 /* }}} */
744 /* {{{ ODatabaseMetaData::allProceduresAreCallable() -I- */
745 sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable()
746 throw(SQLException, RuntimeException)
748 return impl_getBoolMetaData("allProceduresAreCallable", &sql::DatabaseMetaData::allProceduresAreCallable);
750 /* }}} */
753 /* {{{ ODatabaseMetaData::supportsStoredProcedures() -I- */
754 sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures()
755 throw(SQLException, RuntimeException)
757 return impl_getBoolMetaData("supportsStoredProcedures", &sql::DatabaseMetaData::supportsStoredProcedures);
759 /* }}} */
762 /* {{{ ODatabaseMetaData::supportsSelectForUpdate() -I- */
763 sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate()
764 throw(SQLException, RuntimeException)
766 return impl_getBoolMetaData("supportsSelectForUpdate", &sql::DatabaseMetaData::supportsSelectForUpdate);
768 /* }}} */
771 /* {{{ ODatabaseMetaData::allTablesAreSelectable() -I- */
772 sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable()
773 throw(SQLException, RuntimeException)
775 return impl_getBoolMetaData("allTablesAreSelectable", &sql::DatabaseMetaData::allTablesAreSelectable);
777 /* }}} */
780 /* {{{ ODatabaseMetaData::isReadOnly() -I- */
781 sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly()
782 throw(SQLException, RuntimeException)
784 return impl_getBoolMetaData("isReadOnly", &sql::DatabaseMetaData::isReadOnly);
786 /* }}} */
789 /* {{{ ODatabaseMetaData::usesLocalFiles() -I- */
790 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles()
791 throw(SQLException, RuntimeException)
793 return impl_getBoolMetaData("usesLocalFiles", &sql::DatabaseMetaData::usesLocalFiles);
795 /* }}} */
798 /* {{{ ODatabaseMetaData::usesLocalFilePerTable() -I- */
799 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable()
800 throw(SQLException, RuntimeException)
802 return impl_getBoolMetaData("usesLocalFilePerTable", &sql::DatabaseMetaData::usesLocalFilePerTable);
804 /* }}} */
807 /* {{{ ODatabaseMetaData::supportsTypeConversion() -I- */
808 sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion()
809 throw(SQLException, RuntimeException)
811 return impl_getBoolMetaData("supportsTypeConversion", &sql::DatabaseMetaData::supportsTypeConversion);
813 /* }}} */
816 /* {{{ ODatabaseMetaData::nullPlusNonNullIsNull() -I- */
817 sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull()
818 throw(SQLException, RuntimeException)
820 return impl_getBoolMetaData("nullPlusNonNullIsNull", &sql::DatabaseMetaData::nullPlusNonNullIsNull);
822 /* }}} */
825 /* {{{ ODatabaseMetaData::supportsColumnAliasing() -I- */
826 sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing()
827 throw(SQLException, RuntimeException)
829 return impl_getBoolMetaData("supportsColumnAliasing", &sql::DatabaseMetaData::supportsColumnAliasing);
831 /* }}} */
834 /* {{{ ODatabaseMetaData::supportsTableCorrelationNames() -I- */
835 sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames()
836 throw(SQLException, RuntimeException)
838 return impl_getBoolMetaData("supportsTableCorrelationNames", &sql::DatabaseMetaData::supportsTableCorrelationNames);
840 /* }}} */
843 /* {{{ ODatabaseMetaData::supportsConvert() -I- */
844 sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert(sal_Int32 /* fromType */, sal_Int32 /* toType */)
845 throw(SQLException, RuntimeException)
847 OSL_TRACE("ODatabaseMetaData::supportsConvert");
848 try {
849 /* ToDo -> use supportsConvert( fromType, toType) */
850 return meta->supportsConvert()? sal_True:sal_False;
851 } catch (const sql::MethodNotImplementedException &) {
852 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::supportsConvert", *this);
853 } catch (const sql::InvalidArgumentException &) {
854 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::supportsConvert", *this);
855 } catch (const sql::SQLException& e) {
856 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
858 return sal_False;
860 /* }}} */
863 /* {{{ ODatabaseMetaData::supportsExpressionsInOrderBy() -I- */
864 sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy()
865 throw(SQLException, RuntimeException)
867 return impl_getBoolMetaData("supportsExpressionsInOrderBy", &sql::DatabaseMetaData::supportsExpressionsInOrderBy);
869 /* }}} */
872 /* {{{ ODatabaseMetaData::supportsGroupBy() -I- */
873 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy()
874 throw(SQLException, RuntimeException)
876 return impl_getBoolMetaData("supportsGroupBy", &sql::DatabaseMetaData::supportsGroupBy);
878 /* }}} */
881 /* {{{ ODatabaseMetaData::supportsGroupByBeyondSelect() -I- */
882 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect()
883 throw(SQLException, RuntimeException)
885 return impl_getBoolMetaData("supportsGroupByBeyondSelect", &sql::DatabaseMetaData::supportsGroupByBeyondSelect);
887 /* }}} */
890 /* {{{ ODatabaseMetaData::supportsGroupByUnrelated() -I- */
891 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated()
892 throw(SQLException, RuntimeException)
894 return impl_getBoolMetaData("supportsGroupByUnrelated", &sql::DatabaseMetaData::supportsGroupByUnrelated);
896 /* }}} */
899 /* {{{ ODatabaseMetaData::supportsMultipleTransactions() -I- */
900 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions()
901 throw(SQLException, RuntimeException)
903 return impl_getBoolMetaData("supportsMultipleTransactions", &sql::DatabaseMetaData::supportsMultipleTransactions);
905 /* }}} */
908 /* {{{ ODatabaseMetaData::supportsMultipleResultSets() -I- */
909 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets()
910 throw(SQLException, RuntimeException)
912 return impl_getBoolMetaData("supportsMultipleResultSets", &sql::DatabaseMetaData::supportsMultipleResultSets);
914 /* }}} */
917 /* {{{ ODatabaseMetaData::supportsLikeEscapeClause() -I- */
918 sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause()
919 throw(SQLException, RuntimeException)
921 return impl_getBoolMetaData("supportsLikeEscapeClause", &sql::DatabaseMetaData::supportsLikeEscapeClause);
923 /* }}} */
926 /* {{{ ODatabaseMetaData::supportsOrderByUnrelated() -I- */
927 sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated()
928 throw(SQLException, RuntimeException)
930 return impl_getBoolMetaData("supportsOrderByUnrelated", &sql::DatabaseMetaData::supportsOrderByUnrelated);
932 /* }}} */
935 /* {{{ ODatabaseMetaData::supportsUnion() -I- */
936 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion()
937 throw(SQLException, RuntimeException)
939 return impl_getBoolMetaData("supportsUnion", &sql::DatabaseMetaData::supportsUnion);
941 /* }}} */
944 /* {{{ ODatabaseMetaData::supportsUnionAll() -I- */
945 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll()
946 throw(SQLException, RuntimeException)
948 return impl_getBoolMetaData("supportsUnionAll", &sql::DatabaseMetaData::supportsUnionAll);
950 /* }}} */
953 /* {{{ ODatabaseMetaData::supportsMixedCaseIdentifiers() -I- */
954 sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers()
955 throw(SQLException, RuntimeException)
957 return impl_getBoolMetaData("supportsMixedCaseIdentifiers", &sql::DatabaseMetaData::supportsMixedCaseIdentifiers);
959 /* }}} */
962 /* {{{ ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers() -I- */
963 sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers()
964 throw(SQLException, RuntimeException)
966 return impl_getBoolMetaData("supportsMixedCaseQuotedIdentifiers", &sql::DatabaseMetaData::supportsMixedCaseQuotedIdentifiers);
968 /* }}} */
971 /* {{{ ODatabaseMetaData::nullsAreSortedAtEnd() -I- */
972 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd()
973 throw(SQLException, RuntimeException)
975 return impl_getBoolMetaData("nullsAreSortedAtEnd", &sql::DatabaseMetaData::nullsAreSortedAtEnd);
977 /* }}} */
980 /* {{{ ODatabaseMetaData::nullsAreSortedAtStart() -I- */
981 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart()
982 throw(SQLException, RuntimeException)
984 return impl_getBoolMetaData("nullsAreSortedAtStart", &sql::DatabaseMetaData::nullsAreSortedAtStart);
986 /* }}} */
989 /* {{{ ODatabaseMetaData::nullsAreSortedHigh() -I- */
990 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh()
991 throw(SQLException, RuntimeException)
993 return impl_getBoolMetaData("nullsAreSortedHigh", &sql::DatabaseMetaData::nullsAreSortedHigh);
995 /* }}} */
998 /* {{{ ODatabaseMetaData::nullsAreSortedLow() -I- */
999 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow()
1000 throw(SQLException, RuntimeException)
1002 return impl_getBoolMetaData("nullsAreSortedLow", &sql::DatabaseMetaData::nullsAreSortedLow);
1004 /* }}} */
1007 /* {{{ ODatabaseMetaData::supportsSchemasInProcedureCalls() -I- */
1008 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls()
1009 throw(SQLException, RuntimeException)
1011 return impl_getBoolMetaData("supportsSchemasInProcedureCalls", &sql::DatabaseMetaData::supportsSchemasInProcedureCalls);
1013 /* }}} */
1016 /* {{{ ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions() -I- */
1017 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions()
1018 throw(SQLException, RuntimeException)
1020 return impl_getBoolMetaData("supportsSchemasInPrivilegeDefinitions", &sql::DatabaseMetaData::supportsSchemasInPrivilegeDefinitions);
1022 /* }}} */
1025 /* {{{ ODatabaseMetaData::supportsCatalogsInProcedureCalls() -I- */
1026 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls()
1027 throw(SQLException, RuntimeException)
1029 return impl_getBoolMetaData("supportsCatalogsInProcedureCalls", &sql::DatabaseMetaData::supportsCatalogsInProcedureCalls);
1031 /* }}} */
1034 /* {{{ ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions() -I- */
1035 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions()
1036 throw(SQLException, RuntimeException)
1038 return impl_getBoolMetaData("supportsCatalogsInPrivilegeDefinitions", &sql::DatabaseMetaData::supportsCatalogsInPrivilegeDefinitions);
1040 /* }}} */
1043 /* {{{ ODatabaseMetaData::supportsCorrelatedSubqueries() -I- */
1044 sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries()
1045 throw(SQLException, RuntimeException)
1047 return impl_getBoolMetaData("supportsCorrelatedSubqueries", &sql::DatabaseMetaData::supportsCorrelatedSubqueries);
1049 /* }}} */
1052 /* {{{ ODatabaseMetaData::supportsSubqueriesInComparisons() -I- */
1053 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons()
1054 throw(SQLException, RuntimeException)
1056 return impl_getBoolMetaData("supportsSubqueriesInComparisons", &sql::DatabaseMetaData::supportsSubqueriesInComparisons);
1058 /* }}} */
1061 /* {{{ ODatabaseMetaData::supportsSubqueriesInExists() -I- */
1062 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists()
1063 throw(SQLException, RuntimeException)
1065 return impl_getBoolMetaData("supportsSubqueriesInExists", &sql::DatabaseMetaData::supportsSubqueriesInExists);
1067 /* }}} */
1070 /* {{{ ODatabaseMetaData::supportsSubqueriesInIns() -I- */
1071 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns()
1072 throw(SQLException, RuntimeException)
1074 return impl_getBoolMetaData("supportsSubqueriesInIns", &sql::DatabaseMetaData::supportsSubqueriesInIns);
1076 /* }}} */
1079 /* {{{ ODatabaseMetaData::supportsSubqueriesInQuantifieds() -I- */
1080 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds()
1081 throw(SQLException, RuntimeException)
1083 return impl_getBoolMetaData("supportsSubqueriesInQuantifieds", &sql::DatabaseMetaData::supportsSubqueriesInQuantifieds);
1085 /* }}} */
1088 /* {{{ ODatabaseMetaData::supportsANSI92IntermediateSQL() -I- */
1089 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL()
1090 throw(SQLException, RuntimeException)
1092 return impl_getBoolMetaData("supportsANSI92IntermediateSQL", &sql::DatabaseMetaData::supportsANSI92IntermediateSQL);
1094 /* }}} */
1097 /* {{{ ODatabaseMetaData::getURL() -I- */
1098 OUString SAL_CALL ODatabaseMetaData::getURL()
1099 throw(SQLException, RuntimeException)
1101 OSL_TRACE("ODatabaseMetaData::getURL");
1102 return m_rConnection.getConnectionSettings().connectionURL;
1104 /* }}} */
1107 /* {{{ ODatabaseMetaData::getUserName() -I- */
1108 OUString SAL_CALL ODatabaseMetaData::getUserName()
1109 throw(SQLException, RuntimeException)
1111 return impl_getStringMetaData("getUserName", &sql::DatabaseMetaData::getUserName);
1113 /* }}} */
1116 /* {{{ ODatabaseMetaData::getDriverName() -I- */
1117 OUString SAL_CALL ODatabaseMetaData::getDriverName()
1118 throw(SQLException, RuntimeException)
1120 OSL_TRACE("ODatabaseMetaData::getDriverName");
1121 OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "MySQL Connector/OO.org" ) );
1122 return aValue;
1124 /* }}} */
1127 /* {{{ ODatabaseMetaData::getDriverVersion() -I- */
1128 OUString SAL_CALL ODatabaseMetaData::getDriverVersion()
1129 throw(SQLException, RuntimeException)
1131 OSL_TRACE("ODatabaseMetaData::getDriverVersion");
1132 static const OUString sVersion( RTL_CONSTASCII_USTRINGPARAM( "0.9.2" ) );
1133 return sVersion;
1135 /* }}} */
1138 /* {{{ ODatabaseMetaData::getDatabaseProductVersion() -I- */
1139 OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion()
1140 throw(SQLException, RuntimeException)
1142 return impl_getStringMetaData("getDatabaseProductVersion", &sql::DatabaseMetaData::getDatabaseProductVersion);
1144 /* }}} */
1147 /* {{{ ODatabaseMetaData::getDatabaseProductName() -I- */
1148 OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName()
1149 throw(SQLException, RuntimeException)
1151 return impl_getStringMetaData("getDatabaseProductName", &sql::DatabaseMetaData::getDatabaseProductName);
1153 /* }}} */
1156 /* {{{ ODatabaseMetaData::getProcedureTerm() -I- */
1157 OUString SAL_CALL ODatabaseMetaData::getProcedureTerm()
1158 throw(SQLException, RuntimeException)
1160 return impl_getStringMetaData("getProcedureTerm", &sql::DatabaseMetaData::getProcedureTerm);
1162 /* }}} */
1165 /* {{{ ODatabaseMetaData::getSchemaTerm() -I- */
1166 OUString SAL_CALL ODatabaseMetaData::getSchemaTerm()
1167 throw(SQLException, RuntimeException)
1169 return impl_getStringMetaData("getSchemaTerm", &sql::DatabaseMetaData::getSchemaTerm);
1171 /* }}} */
1174 /* {{{ ODatabaseMetaData::getDriverMajorVersion() -I- */
1175 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion()
1176 throw(RuntimeException)
1178 OSL_TRACE("ODatabaseMetaData::getDriverMajorVersion");
1179 return MYSQLC_VERSION_MAJOR;
1181 /* }}} */
1184 /* {{{ ODatabaseMetaData::getDefaultTransactionIsolation() -I- */
1185 sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation()
1186 throw(SQLException, RuntimeException)
1188 OSL_TRACE("ODatabaseMetaData::getDefaultTransactionIsolation");
1189 try {
1190 switch (meta->getDefaultTransactionIsolation()) {
1191 case sql::TRANSACTION_SERIALIZABLE: return TransactionIsolation::SERIALIZABLE;
1192 case sql::TRANSACTION_REPEATABLE_READ: return TransactionIsolation::REPEATABLE_READ;
1193 case sql::TRANSACTION_READ_COMMITTED: return TransactionIsolation::READ_COMMITTED;
1194 case sql::TRANSACTION_READ_UNCOMMITTED: return TransactionIsolation::READ_UNCOMMITTED;
1196 } catch (const sql::MethodNotImplementedException &) {
1197 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getDriverMajorVersion", *this);
1198 } catch (const sql::InvalidArgumentException &) {
1199 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getDriverMajorVersion", *this);
1200 } catch (const sql::SQLException& e) {
1201 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
1203 return TransactionIsolation::NONE;
1205 /* }}} */
1208 /* {{{ ODatabaseMetaData::getDriverMinorVersion() -I- */
1209 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion()
1210 throw(RuntimeException)
1212 OSL_TRACE("ODatabaseMetaData::getDriverMinorVersion");
1213 return MYSQLC_VERSION_MINOR;
1215 /* }}} */
1218 /* {{{ ODatabaseMetaData::getSQLKeywords() -I- */
1219 OUString SAL_CALL ODatabaseMetaData::getSQLKeywords()
1220 throw(SQLException, RuntimeException)
1222 return impl_getStringMetaData("getSQLKeywords", &sql::DatabaseMetaData::getSQLKeywords);
1224 /* }}} */
1227 /* {{{ ODatabaseMetaData::getSearchStringEscape() -I- */
1228 OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape()
1229 throw(SQLException, RuntimeException)
1231 return impl_getStringMetaData("getSearchStringEscape", &sql::DatabaseMetaData::getSearchStringEscape);
1233 /* }}} */
1236 /* {{{ ODatabaseMetaData::getStringFunctions() -I- */
1237 OUString SAL_CALL ODatabaseMetaData::getStringFunctions()
1238 throw(SQLException, RuntimeException)
1240 return impl_getStringMetaData("getStringFunctions", &sql::DatabaseMetaData::getStringFunctions);
1242 /* }}} */
1245 /* {{{ ODatabaseMetaData::getTimeDateFunctions() -I- */
1246 OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions()
1247 throw(SQLException, RuntimeException)
1249 return impl_getStringMetaData("getTimeDateFunctions", &sql::DatabaseMetaData::getTimeDateFunctions);
1251 /* }}} */
1254 /* {{{ ODatabaseMetaData::getSystemFunctions() -I- */
1255 OUString SAL_CALL ODatabaseMetaData::getSystemFunctions()
1256 throw(SQLException, RuntimeException)
1258 return impl_getStringMetaData("getSystemFunctions", &sql::DatabaseMetaData::getSystemFunctions);
1260 /* }}} */
1263 /* {{{ ODatabaseMetaData::getNumericFunctions() -I- */
1264 OUString SAL_CALL ODatabaseMetaData::getNumericFunctions()
1265 throw(SQLException, RuntimeException)
1267 return impl_getStringMetaData("getNumericFunctions", &sql::DatabaseMetaData::getNumericFunctions);
1269 /* }}} */
1272 /* {{{ ODatabaseMetaData::supportsExtendedSQLGrammar() -I- */
1273 sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar()
1274 throw(SQLException, RuntimeException)
1276 return impl_getBoolMetaData("supportsExtendedSQLGrammar", &sql::DatabaseMetaData::supportsExtendedSQLGrammar);
1278 /* }}} */
1281 /* {{{ ODatabaseMetaData::supportsCoreSQLGrammar() -I- */
1282 sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar()
1283 throw(SQLException, RuntimeException)
1285 return impl_getBoolMetaData("supportsCoreSQLGrammar", &sql::DatabaseMetaData::supportsCoreSQLGrammar);
1287 /* }}} */
1290 /* {{{ ODatabaseMetaData::supportsMinimumSQLGrammar() -I- */
1291 sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar()
1292 throw(SQLException, RuntimeException)
1294 return impl_getBoolMetaData("supportsMinimumSQLGrammar", &sql::DatabaseMetaData::supportsMinimumSQLGrammar);
1296 /* }}} */
1299 /* {{{ ODatabaseMetaData::supportsFullOuterJoins() -I- */
1300 sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins()
1301 throw(SQLException, RuntimeException)
1303 return impl_getBoolMetaData("supportsFullOuterJoins", &sql::DatabaseMetaData::supportsFullOuterJoins);
1305 /* }}} */
1308 /* {{{ ODatabaseMetaData::supportsLimitedOuterJoins() -I- */
1309 sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins()
1310 throw(SQLException, RuntimeException)
1312 return impl_getBoolMetaData("supportsLimitedOuterJoins", &sql::DatabaseMetaData::supportsLimitedOuterJoins);
1314 /* }}} */
1317 /* {{{ ODatabaseMetaData::getMaxColumnsInGroupBy() -I- */
1318 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy()
1319 throw(SQLException, RuntimeException)
1321 return impl_getInt32MetaData("getMaxColumnsInGroupBy", &sql::DatabaseMetaData::getMaxColumnsInGroupBy);
1323 /* }}} */
1326 /* {{{ ODatabaseMetaData::getMaxColumnsInOrderBy() -I- */
1327 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy()
1328 throw(SQLException, RuntimeException)
1330 return impl_getInt32MetaData("getMaxColumnsInOrderBy", &sql::DatabaseMetaData::getMaxColumnsInOrderBy);
1332 /* }}} */
1335 /* {{{ ODatabaseMetaData::getMaxColumnsInSelect() -I- */
1336 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect()
1337 throw(SQLException, RuntimeException)
1339 return impl_getInt32MetaData("getMaxColumnsInSelect", &sql::DatabaseMetaData::getMaxColumnsInSelect);
1341 /* }}} */
1344 /* {{{ ODatabaseMetaData::getMaxUserNameLength() -I- */
1345 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength()
1346 throw(SQLException, RuntimeException)
1348 return impl_getInt32MetaData("getMaxUserNameLength", &sql::DatabaseMetaData::getMaxUserNameLength);
1350 /* }}} */
1353 /* {{{ ODatabaseMetaData::supportsResultSetType() -I- */
1354 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType(sal_Int32 setType)
1355 throw(SQLException, RuntimeException)
1357 return impl_getRSTypeMetaData("supportsResultSetType", &sql::DatabaseMetaData::supportsResultSetType, setType);
1359 /* }}} */
1362 /* {{{ ODatabaseMetaData::supportsResultSetConcurrency() -I- */
1363 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency(sal_Int32 setType, sal_Int32 concurrency)
1364 throw(SQLException, RuntimeException)
1366 OSL_TRACE("ODatabaseMetaData::supportsResultSetConcurrency");
1367 /* TODO: Check this out */
1368 try {
1369 return meta->supportsResultSetConcurrency(setType, concurrency==com::sun::star::sdbc::TransactionIsolation::READ_COMMITTED?
1370 sql::TRANSACTION_READ_COMMITTED:
1371 (concurrency == com::sun::star::sdbc::TransactionIsolation::SERIALIZABLE?
1372 sql::TRANSACTION_SERIALIZABLE:sql::TRANSACTION_SERIALIZABLE))? sal_True:sal_False;
1373 } catch (const sql::MethodNotImplementedException &) {
1374 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::supportsResultSetConcurrency", *this);
1375 } catch (const sql::InvalidArgumentException &) {
1376 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::supportsResultSetConcurrency", *this);
1377 } catch (const sql::SQLException& e) {
1378 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
1380 return sal_False;
1382 /* }}} */
1385 /* {{{ ODatabaseMetaData::ownUpdatesAreVisible() -I- */
1386 sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible(sal_Int32 setType)
1387 throw(SQLException, RuntimeException)
1389 return impl_getRSTypeMetaData("ownUpdatesAreVisible", &sql::DatabaseMetaData::ownUpdatesAreVisible, setType);
1391 /* }}} */
1394 /* {{{ ODatabaseMetaData::ownDeletesAreVisible() -I- */
1395 sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible(sal_Int32 setType)
1396 throw(SQLException, RuntimeException)
1398 return impl_getRSTypeMetaData("ownDeletesAreVisible", &sql::DatabaseMetaData::ownDeletesAreVisible, setType);
1400 /* }}} */
1403 /* {{{ ODatabaseMetaData::ownInsertsAreVisible() -I- */
1404 sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible(sal_Int32 setType)
1405 throw(SQLException, RuntimeException)
1407 return impl_getRSTypeMetaData("ownInsertsAreVisible", &sql::DatabaseMetaData::ownInsertsAreVisible, setType);
1409 /* }}} */
1412 /* {{{ ODatabaseMetaData::othersUpdatesAreVisible() -I- */
1413 sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible(sal_Int32 setType)
1414 throw(SQLException, RuntimeException)
1416 return impl_getRSTypeMetaData("othersUpdatesAreVisible", &sql::DatabaseMetaData::othersUpdatesAreVisible, setType);
1418 /* }}} */
1421 /* {{{ ODatabaseMetaData::othersDeletesAreVisible() -I- */
1422 sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible(sal_Int32 setType)
1423 throw(SQLException, RuntimeException)
1425 return impl_getRSTypeMetaData("othersDeletesAreVisible", &sql::DatabaseMetaData::othersDeletesAreVisible, setType);
1427 /* }}} */
1430 /* {{{ ODatabaseMetaData::othersInsertsAreVisible() -I- */
1431 sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible(sal_Int32 setType)
1432 throw(SQLException, RuntimeException)
1434 return impl_getRSTypeMetaData("othersInsertsAreVisible", &sql::DatabaseMetaData::othersInsertsAreVisible, setType);
1436 /* }}} */
1439 /* {{{ ODatabaseMetaData::updatesAreDetected() -I- */
1440 sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected(sal_Int32 setType)
1441 throw(SQLException, RuntimeException)
1443 return impl_getRSTypeMetaData("updatesAreDetected", &sql::DatabaseMetaData::updatesAreDetected, setType);
1445 /* }}} */
1448 /* {{{ ODatabaseMetaData::deletesAreDetected() -I- */
1449 sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected(sal_Int32 setType)
1450 throw(SQLException, RuntimeException)
1452 return impl_getRSTypeMetaData("deletesAreDetected", &sql::DatabaseMetaData::deletesAreDetected, setType);
1454 /* }}} */
1457 /* {{{ ODatabaseMetaData::insertsAreDetected() -I- */
1458 sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected(sal_Int32 setType)
1459 throw(SQLException, RuntimeException)
1461 return impl_getRSTypeMetaData("insertsAreDetected", &sql::DatabaseMetaData::insertsAreDetected, setType);
1463 /* }}} */
1466 /* {{{ ODatabaseMetaData::supportsBatchUpdates() -I- */
1467 sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates()
1468 throw(SQLException, RuntimeException)
1470 return impl_getBoolMetaData("supportsBatchUpdates", &sql::DatabaseMetaData::supportsBatchUpdates);
1472 /* }}} */
1475 /* {{{ ODatabaseMetaData::getConnection() -I- */
1476 Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection()
1477 throw(SQLException, RuntimeException)
1479 OSL_TRACE("ODatabaseMetaData::getConnection");
1480 return (Reference< XConnection >)&m_rConnection;
1482 /* }}} */
1486 Here follow all methods which return(a resultset
1487 the first methods is an example implementation how to use this resultset
1488 of course you could implement it on your and you should do this because
1489 the general way is more memory expensive
1492 /* {{{ ODatabaseMetaData::getTableTypes() -I- */
1493 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes()
1494 throw(SQLException, RuntimeException)
1496 OSL_TRACE("ODatabaseMetaData::getTableTypes");
1497 const char * table_types[] = {"TABLE", "VIEW"};
1498 sal_Int32 requiredVersion[] = {0, 50000};
1500 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1501 std::vector< std::vector< Any > > rRows;
1502 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
1504 for (sal_uInt32 i = 0; i < 2; i++) {
1505 if (m_rConnection.getMysqlVersion() >= requiredVersion[i]) {
1506 std::vector< Any > aRow(1);
1507 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(table_types[i], encoding)));
1508 rRows.push_back(aRow);
1511 lcl_setRows_throw(xResultSet, 5 ,rRows);
1512 return xResultSet;
1514 /* }}} */
1517 /* {{{ ODatabaseMetaData::getTypeInfo() -I- */
1518 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
1519 throw(SQLException, RuntimeException)
1521 OSL_TRACE("ODatabaseMetaData::getTypeInfo");
1522 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1524 std::vector< std::vector< Any > > rRows;
1526 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
1527 unsigned int i = 0;
1528 while (mysqlc_types[i].typeName) {
1529 std::vector< Any > aRow(1);
1531 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].typeName, encoding)));
1532 aRow.push_back(makeAny(mysqlc_types[i].dataType));
1533 aRow.push_back(makeAny(mysqlc_types[i].precision));
1534 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalPrefix, encoding)));
1535 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalSuffix, encoding)));
1536 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].createParams, encoding)));
1537 aRow.push_back(makeAny(mysqlc_types[i].nullable));
1538 aRow.push_back(makeAny(mysqlc_types[i].caseSensitive));
1539 aRow.push_back(makeAny(mysqlc_types[i].searchable));
1540 aRow.push_back(makeAny(mysqlc_types[i].isUnsigned));
1541 aRow.push_back(makeAny(mysqlc_types[i].fixedPrecScale));
1542 aRow.push_back(makeAny(mysqlc_types[i].autoIncrement));
1543 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].localTypeName, encoding)));
1544 aRow.push_back(makeAny(mysqlc_types[i].minScale));
1545 aRow.push_back(makeAny(mysqlc_types[i].maxScale));
1546 aRow.push_back(makeAny(sal_Int32(0)));
1547 aRow.push_back(makeAny(sal_Int32(0)));
1548 aRow.push_back(makeAny(sal_Int32(10)));
1550 rRows.push_back(aRow);
1551 i++;
1554 lcl_setRows_throw(xResultSet, 14, rRows);
1555 return xResultSet;
1557 /* }}} */
1560 /* {{{ ODatabaseMetaData::getCatalogs() -I- */
1561 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs()
1562 throw(SQLException, RuntimeException)
1564 OSL_TRACE("ODatabaseMetaData::getCatalogs");
1566 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1567 std::vector< std::vector< Any > > rRows;
1569 try {
1570 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
1571 std::auto_ptr< sql::ResultSet> rset( meta->getCatalogs());
1572 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
1573 sal_uInt32 columns = rs_meta->getColumnCount();
1574 while (rset->next()) {
1575 std::vector< Any > aRow(1);
1576 for (sal_uInt32 i = 1; i <= columns; i++) {
1577 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
1579 rRows.push_back(aRow);
1581 } catch (const sql::MethodNotImplementedException &) {
1582 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getCatalogs", *this);
1583 } catch (const sql::InvalidArgumentException &) {
1584 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getCatalogs", *this);
1585 } catch (const sql::SQLException& e) {
1586 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
1589 lcl_setRows_throw(xResultSet, 0, rRows);
1590 return xResultSet;
1592 /* }}} */
1595 /* {{{ ODatabaseMetaData::getSchemas() -I- */
1596 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas()
1597 throw(SQLException, RuntimeException)
1599 OSL_TRACE("ODatabaseMetaData::getSchemas");
1601 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1602 std::vector< std::vector< Any > > rRows;
1604 try {
1605 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
1606 std::auto_ptr< sql::ResultSet> rset( meta->getSchemas());
1607 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
1608 sal_uInt32 columns = rs_meta->getColumnCount();
1609 while (rset->next()) {
1610 std::vector< Any > aRow(1);
1611 bool informationSchema = false;
1612 for (sal_uInt32 i = 1; i <= columns; i++) {
1613 sql::SQLString columnStringValue = rset->getString(i);
1614 if (i == 1) { // TABLE_SCHEM
1615 informationSchema = (0 == columnStringValue.compare("information_schema"));
1617 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(columnStringValue, encoding)));
1619 if (!informationSchema ) {
1620 rRows.push_back(aRow);
1623 } catch (const sql::MethodNotImplementedException &) {
1624 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getSchemas", *this);
1625 } catch (const sql::InvalidArgumentException &) {
1626 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getSchemas", *this);
1627 } catch (const sql::SQLException& e) {
1628 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
1631 lcl_setRows_throw(xResultSet, 1, rRows);
1632 return xResultSet;
1634 /* }}} */
1637 /* {{{ ODatabaseMetaData::getColumnPrivileges() -I- */
1638 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
1639 const Any& catalog,
1640 const OUString& schema,
1641 const OUString& table,
1642 const OUString& columnNamePattern)
1643 throw(SQLException, RuntimeException)
1645 OSL_TRACE("ODatabaseMetaData::getColumnPrivileges");
1646 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1647 std::vector< std::vector< Any > > rRows;
1649 std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
1650 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
1651 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr()),
1652 cNamePattern(OUStringToOString(columnNamePattern, m_rConnection.getConnectionEncoding()).getStr());
1653 try {
1654 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
1655 std::auto_ptr< sql::ResultSet> rset( meta->getColumnPrivileges(cat, sch, tab, cNamePattern.compare("")? cNamePattern:wild));
1657 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
1658 sal_uInt32 columns = rs_meta->getColumnCount();
1659 while (rset->next()) {
1660 std::vector< Any > aRow(1);
1661 for (sal_uInt32 i = 1; i <= columns; i++) {
1662 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
1664 rRows.push_back(aRow);
1666 } catch (const sql::MethodNotImplementedException &) {
1667 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getColumnPrivileges", *this);
1668 } catch (const sql::InvalidArgumentException &) {
1669 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getColumnPrivileges", *this);
1670 } catch (const sql::SQLException& e) {
1671 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
1674 lcl_setRows_throw(xResultSet, 2, rRows);
1675 return xResultSet;
1677 /* }}} */
1680 /* {{{ ODatabaseMetaData::getColumns() -I- */
1681 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
1682 const Any& catalog,
1683 const OUString& schemaPattern,
1684 const OUString& tableNamePattern,
1685 const OUString& columnNamePattern)
1686 throw(SQLException, RuntimeException)
1688 OSL_TRACE("ODatabaseMetaData::getColumns");
1689 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1690 std::vector< std::vector< Any > > rRows;
1691 std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
1692 sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()),
1693 tNamePattern(OUStringToOString(tableNamePattern, m_rConnection.getConnectionEncoding()).getStr()),
1694 cNamePattern(OUStringToOString(columnNamePattern, m_rConnection.getConnectionEncoding()).getStr());
1696 try {
1697 std::auto_ptr< sql::ResultSet> rset( meta->getColumns(cat,
1698 sPattern.compare("")? sPattern:wild,
1699 tNamePattern.compare("")? tNamePattern:wild,
1700 cNamePattern.compare("")? cNamePattern:wild));
1701 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
1702 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
1703 sal_uInt32 columns = rs_meta->getColumnCount();
1704 while (rset->next()) {
1705 std::vector< Any > aRow(1);
1706 for (sal_uInt32 i = 1; i <= columns; i++) {
1707 if (i == 5) { // ColumnType
1708 sal_Int32 sdbc_type = mysqlc_sdbc_driver::mysqlToOOOType(atoi(rset->getString(i).c_str()));
1709 aRow.push_back(makeAny(sdbc_type));
1710 } else {
1711 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
1714 rRows.push_back(aRow);
1716 } catch (const sql::MethodNotImplementedException &) {
1717 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getColumns", *this);
1718 } catch (const sql::InvalidArgumentException &) {
1719 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getColumns", *this);
1720 } catch (const sql::SQLException& e) {
1721 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
1723 lcl_setRows_throw(xResultSet, 3, rRows);
1724 return xResultSet;
1726 /* }}} */
1729 /* {{{ ODatabaseMetaData::getTables() -I- */
1730 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
1731 const Any& catalog,
1732 const OUString& schemaPattern,
1733 const OUString& tableNamePattern,
1734 const Sequence< OUString >& types )
1735 throw(SQLException, RuntimeException)
1737 OSL_TRACE("ODatabaseMetaData::getTables");
1738 sal_Int32 nLength = types.getLength();
1740 Reference< XResultSet > xResultSet(getOwnConnection().
1741 getDriver().getFactory()->createInstance(
1742 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1743 std::vector< std::vector< Any > > rRows;
1745 std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
1746 sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()),
1747 tNamePattern(OUStringToOString(tableNamePattern, m_rConnection.getConnectionEncoding()).getStr());
1749 std::list<sql::SQLString> tabTypes;
1750 for (const OUString *pStart = types.getConstArray(), *p = pStart, *pEnd = pStart + nLength; p != pEnd; ++p) {
1751 tabTypes.push_back(OUStringToOString(*p, m_rConnection.getConnectionEncoding()).getStr());
1754 try {
1755 std::auto_ptr< sql::ResultSet> rset( meta->getTables(cat,
1756 sPattern.compare("")? sPattern:wild,
1757 tNamePattern.compare("")? tNamePattern:wild,
1758 tabTypes));
1760 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
1761 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
1762 sal_uInt32 columns = rs_meta->getColumnCount();
1763 while (rset->next()) {
1764 std::vector< Any > aRow(1);
1765 bool informationSchema = false;
1766 for (sal_uInt32 i = 1; (i <= columns) && !informationSchema; ++i) {
1767 sql::SQLString columnStringValue = rset->getString(i);
1768 if (i == 2) { // TABLE_SCHEM
1769 informationSchema = ( 0 == columnStringValue.compare("information_schema"));
1771 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(columnStringValue, encoding)));
1773 if (!informationSchema) {
1774 rRows.push_back(aRow);
1777 } catch (const sql::MethodNotImplementedException &) {
1778 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getTables", *this);
1779 } catch (const sql::InvalidArgumentException &) {
1780 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getTables", *this);
1781 } catch (const sql::SQLException& e) {
1782 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
1785 lcl_setRows_throw(xResultSet, 4, rRows);
1786 return xResultSet;
1788 /* }}} */
1791 /* {{{ ODatabaseMetaData::getProcedureColumns() -I- */
1792 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
1793 const Any& /* catalog */,
1794 const OUString& /* schemaPattern */,
1795 const OUString& /* procedureNamePattern */,
1796 const OUString& /* columnNamePattern */)
1797 throw(SQLException, RuntimeException)
1799 OSL_TRACE("ODatabaseMetaData::getProcedureColumns");
1800 // Currently there is no information available
1801 return NULL;
1803 /* }}} */
1806 /* {{{ ODatabaseMetaData::getProcedures() -I- */
1807 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
1808 const Any& catalog,
1809 const OUString& schemaPattern,
1810 const OUString& procedureNamePattern)
1811 throw(SQLException, RuntimeException)
1813 OSL_TRACE("ODatabaseMetaData::getProcedures");
1814 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1815 std::vector< std::vector< Any > > rRows;
1817 std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
1818 sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()),
1819 pNamePattern(OUStringToOString(procedureNamePattern, m_rConnection.getConnectionEncoding()).getStr());
1822 try {
1823 std::auto_ptr< sql::ResultSet> rset( meta->getProcedures(cat,
1824 sPattern.compare("")? sPattern:wild,
1825 pNamePattern.compare("")? pNamePattern:wild));
1827 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
1828 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
1829 sal_uInt32 columns = rs_meta->getColumnCount();
1830 while (rset->next()) {
1831 std::vector< Any > aRow(1);
1832 for (sal_uInt32 i = 1; i <= columns; i++) {
1833 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
1835 rRows.push_back(aRow);
1837 } catch (const sql::MethodNotImplementedException &) {
1838 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getProcedures", *this);
1839 } catch (const sql::InvalidArgumentException &) {
1840 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getProcedures", *this);
1841 } catch (const sql::SQLException& e) {
1842 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
1845 lcl_setRows_throw(xResultSet, 7,rRows);
1846 return xResultSet;
1848 /* }}} */
1851 /* {{{ ODatabaseMetaData::getVersionColumns() -I- */
1852 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
1853 const Any& /* catalog */,
1854 const OUString& /* schema */,
1855 const OUString& /* table */)
1856 throw(SQLException, RuntimeException)
1858 OSL_TRACE("ODatabaseMetaData::getVersionColumns");
1859 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1860 std::vector< std::vector< Any > > rRows;
1861 lcl_setRows_throw(xResultSet, 16,rRows);
1862 return xResultSet;
1864 /* }}} */
1867 /* {{{ ODatabaseMetaData::getExportedKeys() -I- */
1868 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
1869 const Any& catalog ,
1870 const OUString& schema ,
1871 const OUString& table )
1872 throw(SQLException, RuntimeException)
1874 OSL_TRACE("ODatabaseMetaData::getExportedKeys");
1875 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1876 std::vector< std::vector< Any > > rRows;
1877 std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
1878 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
1879 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr());
1881 try {
1882 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
1883 std::auto_ptr< sql::ResultSet> rset( meta->getExportedKeys(cat, sch, tab));
1884 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
1885 sal_uInt32 columns = rs_meta->getColumnCount();
1886 while (rset->next()) {
1887 std::vector< Any > aRow(1);
1888 for (sal_uInt32 i = 1; i <= columns; i++) {
1889 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
1891 rRows.push_back(aRow);
1893 } catch (const sql::MethodNotImplementedException &) {
1894 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getExportedKeys", *this);
1895 } catch (const sql::InvalidArgumentException &) {
1896 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getExportedKeys", *this);
1897 } catch (const sql::SQLException& e) {
1898 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
1901 lcl_setRows_throw(xResultSet, 8, rRows);
1902 return xResultSet;
1904 /* }}} */
1907 /* {{{ ODatabaseMetaData::getImportedKeys() -I- */
1908 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
1909 const Any& catalog,
1910 const OUString& schema,
1911 const OUString& table)
1912 throw(SQLException, RuntimeException)
1914 OSL_TRACE("ODatabaseMetaData::getImportedKeys");
1916 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1917 std::vector< std::vector< Any > > rRows;
1919 std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
1920 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
1921 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr());
1923 try {
1924 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
1925 std::auto_ptr< sql::ResultSet> rset( meta->getImportedKeys(cat, sch, tab));
1926 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
1927 sal_uInt32 columns = rs_meta->getColumnCount();
1928 while (rset->next()) {
1929 std::vector< Any > aRow(1);
1930 for (sal_uInt32 i = 1; i <= columns; i++) {
1931 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
1933 rRows.push_back(aRow);
1935 } catch (const sql::MethodNotImplementedException &) {
1936 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getImportedKeys", *this);
1937 } catch (const sql::InvalidArgumentException &) {
1938 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getImportedKeys", *this);
1939 } catch (const sql::SQLException& e) {
1940 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
1943 lcl_setRows_throw(xResultSet,9,rRows);
1944 return xResultSet;
1946 /* }}} */
1949 /* {{{ ODatabaseMetaData::getPrimaryKeys() -I- */
1950 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
1951 const Any& catalog,
1952 const OUString& schema,
1953 const OUString& table)
1954 throw(SQLException, RuntimeException)
1956 OSL_TRACE("ODatabaseMetaData::getPrimaryKeys");
1957 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
1958 std::vector< std::vector< Any > > rRows;
1960 std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
1961 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
1962 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr());
1964 try {
1965 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
1966 std::auto_ptr< sql::ResultSet> rset( meta->getPrimaryKeys(cat, sch, tab));
1967 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
1968 sal_uInt32 columns = rs_meta->getColumnCount();
1969 while (rset->next()) {
1970 std::vector< Any > aRow(1);
1971 for (sal_uInt32 i = 1; i <= columns; i++) {
1972 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
1974 rRows.push_back(aRow);
1976 } catch (const sql::MethodNotImplementedException &) {
1977 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getPrimaryKeys", *this);
1978 } catch (const sql::InvalidArgumentException &) {
1979 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getPrimaryKeys", *this);
1980 } catch (const sql::SQLException& e) {
1981 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
1984 lcl_setRows_throw(xResultSet, 10, rRows);
1985 return xResultSet;
1987 /* }}} */
1990 /* {{{ ODatabaseMetaData::getIndexInfo() -I- */
1991 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
1992 const Any& catalog,
1993 const OUString& schema,
1994 const OUString& table,
1995 sal_Bool unique,
1996 sal_Bool approximate)
1997 throw(SQLException, RuntimeException)
1999 OSL_TRACE("ODatabaseMetaData::getIndexInfo");
2000 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
2001 std::vector< std::vector< Any > > rRows;
2003 std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
2004 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
2005 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr());
2007 try {
2008 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
2009 std::auto_ptr< sql::ResultSet> rset( meta->getIndexInfo(cat, sch, tab, unique, approximate));
2010 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
2011 sal_uInt32 columns = rs_meta->getColumnCount();
2012 while (rset->next()) {
2013 std::vector< Any > aRow(1);
2014 for (sal_uInt32 i = 1; i <= columns; i++) {
2015 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
2017 rRows.push_back(aRow);
2019 } catch (const sql::MethodNotImplementedException &) {
2020 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getIndexInfo", *this);
2021 } catch (const sql::InvalidArgumentException &) {
2022 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getIndexInfo", *this);
2023 } catch (const sql::SQLException& e) {
2024 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
2027 lcl_setRows_throw(xResultSet, 11, rRows);
2028 return xResultSet;
2030 /* }}} */
2033 /* {{{ ODatabaseMetaData::getBestRowIdentifier() -I- */
2034 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
2035 const Any& catalog,
2036 const OUString& schema,
2037 const OUString& table,
2038 sal_Int32 scope,
2039 sal_Bool nullable)
2040 throw(SQLException, RuntimeException)
2042 OSL_TRACE("ODatabaseMetaData::getBestRowIdentifier");
2043 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
2044 std::vector< std::vector< Any > > rRows;
2046 std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
2047 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()),
2048 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr());
2050 try {
2051 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
2052 std::auto_ptr< sql::ResultSet> rset( meta->getBestRowIdentifier(cat, sch, tab, scope, nullable));
2053 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
2054 sal_uInt32 columns = rs_meta->getColumnCount();
2055 while (rset->next()) {
2056 std::vector< Any > aRow(1);
2057 for (sal_uInt32 i = 1; i <= columns; i++) {
2058 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
2060 rRows.push_back(aRow);
2062 } catch (const sql::MethodNotImplementedException &) {
2063 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getBestRowIdentifier", *this);
2064 } catch (const sql::InvalidArgumentException &) {
2065 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getBestRowIdentifier", *this);
2066 } catch (const sql::SQLException& e) {
2067 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
2070 lcl_setRows_throw(xResultSet, 15, rRows);
2071 return xResultSet;
2073 /* }}} */
2076 /* {{{ ODatabaseMetaData::getTablePrivileges() -I- */
2077 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
2078 const Any& catalog,
2079 const OUString& schemaPattern,
2080 const OUString& tableNamePattern)
2081 throw(SQLException, RuntimeException)
2083 OSL_TRACE("ODatabaseMetaData::getTablePrivileges");
2084 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
2085 std::vector< std::vector< Any > > rRows;
2087 std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""),
2088 sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()),
2089 tPattern(OUStringToOString(tableNamePattern, m_rConnection.getConnectionEncoding()).getStr());
2091 try {
2092 static bool fakeTablePrivileges = false;
2093 if (fakeTablePrivileges) {
2094 static const sal_Char* allPrivileges[] = {
2095 "ALTER", "DELETE", "DROP", "INDEX", "INSERT", "LOCK TABLES", "SELECT", "UPDATE"
2097 Any userName; userName <<= getUserName();
2098 for (size_t i = 0; i < SAL_N_ELEMENTS( allPrivileges ); ++i) {
2099 std::vector< Any > aRow;
2100 aRow.push_back(makeAny( sal_Int32( i ) ));
2101 aRow.push_back(catalog); // TABLE_CAT
2102 aRow.push_back(makeAny( schemaPattern )); // TABLE_SCHEM
2103 aRow.push_back(makeAny( tableNamePattern )); // TABLE_NAME
2104 aRow.push_back(Any()); // GRANTOR
2105 aRow.push_back(userName); // GRANTEE
2106 aRow.push_back(makeAny( ::rtl::OUString::createFromAscii( allPrivileges[i] ) )); // PRIVILEGE
2107 aRow.push_back(Any()); // IS_GRANTABLE
2109 rRows.push_back(aRow);
2111 } else {
2112 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
2113 std::auto_ptr< sql::ResultSet> rset( meta->getTablePrivileges(cat, sPattern.compare("")? sPattern:wild, tPattern.compare("")? tPattern:wild));
2114 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
2115 sal_uInt32 columns = rs_meta->getColumnCount();
2116 while (rset->next()) {
2117 std::vector< Any > aRow(1);
2118 for (sal_uInt32 i = 1; i <= columns; i++) {
2119 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
2121 rRows.push_back(aRow);
2124 } catch (const sql::MethodNotImplementedException &) {
2125 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getTablePrivileges", *this);
2126 } catch (const sql::InvalidArgumentException &) {
2127 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getTablePrivileges", *this);
2128 } catch (const sql::SQLException& e) {
2129 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
2132 lcl_setRows_throw(xResultSet,12,rRows);
2133 return xResultSet;
2135 /* }}} */
2138 /* {{{ ODatabaseMetaData::getCrossReference() -I- */
2139 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
2140 const Any& primaryCatalog,
2141 const OUString& primarySchema,
2142 const OUString& primaryTable,
2143 const Any& foreignCatalog,
2144 const OUString& foreignSchema,
2145 const OUString& foreignTable)
2146 throw(SQLException, RuntimeException)
2148 OSL_TRACE("ODatabaseMetaData::getCrossReference");
2149 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY);
2150 std::vector< std::vector< Any > > rRows;
2152 std::string primaryCat(primaryCatalog.hasValue()? OUStringToOString(getStringFromAny(primaryCatalog), m_rConnection.getConnectionEncoding()).getStr():""),
2153 foreignCat(foreignCatalog.hasValue()? OUStringToOString(getStringFromAny(foreignCatalog), m_rConnection.getConnectionEncoding()).getStr():""),
2154 pSchema(OUStringToOString(primarySchema, m_rConnection.getConnectionEncoding()).getStr()),
2155 pTable(OUStringToOString(primaryTable, m_rConnection.getConnectionEncoding()).getStr()),
2156 fSchema(OUStringToOString(foreignSchema, m_rConnection.getConnectionEncoding()).getStr()),
2157 fTable(OUStringToOString(foreignTable, m_rConnection.getConnectionEncoding()).getStr());
2159 try {
2160 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding();
2161 std::auto_ptr< sql::ResultSet> rset( meta->getCrossReference(primaryCat, pSchema, pTable, foreignCat, fSchema, fTable));
2162 sql::ResultSetMetaData * rs_meta = rset->getMetaData();
2163 sal_uInt32 columns = rs_meta->getColumnCount();
2164 while (rset->next()) {
2165 std::vector< Any > aRow(1);
2166 for (sal_uInt32 i = 1; i <= columns; i++) {
2167 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding)));
2169 rRows.push_back(aRow);
2171 } catch (const sql::MethodNotImplementedException &) {
2172 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getCrossReference", *this);
2173 } catch (const sql::InvalidArgumentException &) {
2174 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getCrossReference", *this);
2175 } catch (const sql::SQLException& e) {
2176 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding());
2179 lcl_setRows_throw(xResultSet,13,rRows);
2180 return xResultSet;
2182 /* }}} */
2185 /* {{{ ODatabaseMetaData::getUDTs() -I- */
2186 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs(
2187 const Any& /* catalog */,
2188 const OUString& /* schemaPattern */,
2189 const OUString& /* typeNamePattern */,
2190 const Sequence< sal_Int32 >& /* types */)
2191 throw(SQLException, RuntimeException)
2193 OSL_TRACE("ODatabaseMetaData::getUDTs");
2194 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getUDTs", *this);
2195 return NULL;
2197 /* }}} */
2200 * Local variables:
2201 * tab-width: 4
2202 * c-basic-offset: 4
2203 * End:
2204 * vim600: noet sw=4 ts=4 fdm=marker
2205 * vim<600: noet sw=4 ts=4
2208 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */