1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
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 mysqlc_sdbc_driver::getStringFromAny
;
46 #include <cppconn/connection.h>
47 #include <cppconn/resultset.h>
48 #include <cppconn/metadata.h>
49 #include <cppconn/statement.h>
50 #include <cppconn/prepared_statement.h>
52 #include <sal/macros.h>
54 static std::string
wild("%");
57 // -----------------------------------------------------------------------------
58 void lcl_setRows_throw(const Reference
< XResultSet
>& _xResultSet
,sal_Int32 _nType
,const std::vector
< std::vector
< Any
> >& _rRows
)
60 Reference
< XInitialization
> xIni(_xResultSet
,UNO_QUERY
);
61 Sequence
< Any
> aArgs(2);
64 Sequence
< Sequence
< Any
> > aRows(_rRows
.size());
66 std::vector
< std::vector
< Any
> >::const_iterator aIter
= _rRows
.begin();
67 Sequence
< Any
> * pRowsIter
= aRows
.getArray();
68 Sequence
< Any
> * pRowsEnd
= pRowsIter
+ aRows
.getLength();
69 for (; pRowsIter
!= pRowsEnd
;++pRowsIter
,++aIter
) {
70 if (!aIter
->empty()) {
71 Sequence
<Any
> aSeq(&(*aIter
->begin()),aIter
->size());
76 xIni
->initialize(aArgs
);
80 /* {{{ ODatabaseMetaData::ODatabaseMetaData() -I- */
81 ODatabaseMetaData::ODatabaseMetaData(OConnection
& _rCon
)
83 ,m_bUseCatalog(sal_True
)
84 ,meta(_rCon
.getConnectionSettings().cppConnection
->getMetaData())
85 ,identifier_quote_string_set(false)
87 OSL_TRACE("ODatabaseMetaData::ODatabaseMetaData");
88 if (!m_rConnection
.isCatalogUsed())
90 osl_atomic_increment(&m_refCount
);
91 m_bUseCatalog
= !(usesLocalFiles() || usesLocalFilePerTable());
92 osl_atomic_decrement(&m_refCount
);
98 /* {{{ ODatabaseMetaData::~ODatabaseMetaData() -I- */
99 ODatabaseMetaData::~ODatabaseMetaData()
101 OSL_TRACE("ODatabaseMetaData::~ODatabaseMetaData");
106 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
107 OUString
ODatabaseMetaData::impl_getStringMetaData(const sal_Char
* _methodName
, const std::string
& (sql::DatabaseMetaData::*_Method
)() )
109 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName
);
110 OUString stringMetaData
;
112 stringMetaData
= mysqlc_sdbc_driver::convert((meta
->*_Method
)(), m_rConnection
.getConnectionEncoding());
113 } catch (const sql::MethodNotImplementedException
&) {
114 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName
, *this);
115 } catch (const sql::InvalidArgumentException
&) {
116 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName
, *this);
117 } catch (const sql::SQLException
& e
) {
118 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
120 return stringMetaData
;
125 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
126 OUString
ODatabaseMetaData::impl_getStringMetaData(const sal_Char
* _methodName
, std::string (sql::DatabaseMetaData::*_Method
)() )
128 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName
);
129 OUString stringMetaData
;
131 stringMetaData
= mysqlc_sdbc_driver::convert((meta
->*_Method
)(), m_rConnection
.getConnectionEncoding());
132 } catch (const sql::MethodNotImplementedException
&) {
133 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName
, *this);
134 } catch (const sql::InvalidArgumentException
&) {
135 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName
, *this);
136 } catch (const sql::SQLException
& e
) {
137 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
139 return stringMetaData
;
144 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
145 OUString
ODatabaseMetaData::impl_getStringMetaData(const sal_Char
* _methodName
, const sql::SQLString
& (sql::DatabaseMetaData::*_Method
)() )
147 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName
);
148 OUString stringMetaData
;
150 stringMetaData
= mysqlc_sdbc_driver::convert((meta
->*_Method
)(), m_rConnection
.getConnectionEncoding());
151 } catch (const sql::MethodNotImplementedException
&) {
152 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName
, *this);
153 } catch (const sql::InvalidArgumentException
&) {
154 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName
, *this);
155 } catch (const sql::SQLException
& e
) {
156 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
158 return stringMetaData
;
163 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */
164 OUString
ODatabaseMetaData::impl_getStringMetaData(const sal_Char
* _methodName
, sql::SQLString (sql::DatabaseMetaData::*_Method
)() )
166 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName
);
167 OUString stringMetaData
;
169 stringMetaData
= mysqlc_sdbc_driver::convert((meta
->*_Method
)(), m_rConnection
.getConnectionEncoding());
170 } catch (const sql::MethodNotImplementedException
&) {
171 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName
, *this);
172 } catch (const sql::InvalidArgumentException
&) {
173 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName
, *this);
174 } catch (const sql::SQLException
& e
) {
175 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
177 return stringMetaData
;
182 /* {{{ ODatabaseMetaData::impl_getInt32MetaData() -I- */
183 sal_Int32
ODatabaseMetaData::impl_getInt32MetaData(const sal_Char
* _methodName
, unsigned int (sql::DatabaseMetaData::*_Method
)() )
185 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName
);
186 sal_Int32
int32MetaData(0);
188 int32MetaData
= (meta
->*_Method
)();
189 } catch (const sql::MethodNotImplementedException
&) {
190 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName
, *this);
191 } catch (const sql::InvalidArgumentException
&) {
192 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName
, *this);
193 } catch (const sql::SQLException
& e
) {
194 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
196 return int32MetaData
;
201 /* {{{ ODatabaseMetaData::impl_getBoolMetaData() -I- */
202 sal_Bool
ODatabaseMetaData::impl_getBoolMetaData(const sal_Char
* _methodName
, bool (sql::DatabaseMetaData::*_Method
)() )
204 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName
);
205 sal_Bool
boolMetaData(0);
207 boolMetaData
= (meta
->*_Method
)() ? sal_True
: sal_False
;
208 } catch (const sql::MethodNotImplementedException
&) {
209 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName
, *this);
210 } catch (const sql::InvalidArgumentException
&) {
211 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName
, *this);
212 } catch (const sql::SQLException
& e
) {
213 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
220 /* {{{ ODatabaseMetaData::impl_getBoolMetaData() -I- */
221 sal_Bool
ODatabaseMetaData::impl_getBoolMetaData(const sal_Char
* _methodName
, bool (sql::DatabaseMetaData::*_Method
)(int), sal_Int32 _arg
)
223 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName
);
224 sal_Bool
boolMetaData(0);
226 boolMetaData
= (meta
->*_Method
)( _arg
) ? sal_True
: sal_False
;
227 } catch (const sql::MethodNotImplementedException
&) {
228 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName
, *this);
229 } catch (const sql::InvalidArgumentException
&) {
230 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName
, *this);
231 } catch (const sql::SQLException
& e
) {
232 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
239 /* {{{ ODatabaseMetaData::impl_getRSTypeMetaData() -I- */
240 sal_Bool
ODatabaseMetaData::impl_getRSTypeMetaData(const sal_Char
* _methodName
, bool (sql::DatabaseMetaData::*_Method
)(int), sal_Int32 _resultSetType
)
242 int resultSetType(sql::ResultSet::TYPE_FORWARD_ONLY
);
243 switch ( _resultSetType
) {
244 case ResultSetType::SCROLL_INSENSITIVE
: resultSetType
= sql::ResultSet::TYPE_SCROLL_INSENSITIVE
; break;
245 case ResultSetType::SCROLL_SENSITIVE
: resultSetType
= sql::ResultSet::TYPE_SCROLL_SENSITIVE
; break;
248 return impl_getBoolMetaData(_methodName
, _Method
, resultSetType
);
253 /* {{{ ODatabaseMetaData::getCatalogSeparator() -I- */
254 OUString SAL_CALL
ODatabaseMetaData::getCatalogSeparator()
255 throw(SQLException
, RuntimeException
)
257 return impl_getStringMetaData("getCatalogSeparator", &sql::DatabaseMetaData::getCatalogSeparator
);
262 /* {{{ ODatabaseMetaData::getMaxBinaryLiteralLength() -I- */
263 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxBinaryLiteralLength()
264 throw(SQLException
, RuntimeException
)
266 return impl_getInt32MetaData("getMaxBinaryLiteralLength", &sql::DatabaseMetaData::getMaxBinaryLiteralLength
);
271 /* {{{ ODatabaseMetaData::getMaxRowSize() -I- */
272 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxRowSize()
273 throw(SQLException
, RuntimeException
)
275 return impl_getInt32MetaData("getMaxRowSize", &sql::DatabaseMetaData::getMaxRowSize
);
280 /* {{{ ODatabaseMetaData::getMaxCatalogNameLength() -I- */
281 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxCatalogNameLength()
282 throw(SQLException
, RuntimeException
)
284 return impl_getInt32MetaData("getMaxCatalogNameLength", &sql::DatabaseMetaData::getMaxCatalogNameLength
);
289 /* {{{ ODatabaseMetaData::getMaxCharLiteralLength() -I- */
290 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxCharLiteralLength()
291 throw(SQLException
, RuntimeException
)
293 return impl_getInt32MetaData("getMaxCharLiteralLength", &sql::DatabaseMetaData::getMaxCharLiteralLength
);
298 /* {{{ ODatabaseMetaData::getMaxColumnNameLength() -I- */
299 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnNameLength()
300 throw(SQLException
, RuntimeException
)
302 return impl_getInt32MetaData("getMaxColumnNameLength", &sql::DatabaseMetaData::getMaxColumnNameLength
);
307 /* {{{ ODatabaseMetaData::getMaxColumnsInIndex() -I- */
308 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInIndex()
309 throw(SQLException
, RuntimeException
)
311 return impl_getInt32MetaData("getMaxColumnsInIndex", &sql::DatabaseMetaData::getMaxColumnsInIndex
);
316 /* {{{ ODatabaseMetaData::getMaxCursorNameLength() -I- */
317 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxCursorNameLength()
318 throw(SQLException
, RuntimeException
)
320 return impl_getInt32MetaData("getMaxCursorNameLength", &sql::DatabaseMetaData::getMaxCursorNameLength
);
325 /* {{{ ODatabaseMetaData::getMaxConnections() -I- */
326 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxConnections()
327 throw(SQLException
, RuntimeException
)
329 return impl_getInt32MetaData("getMaxConnections", &sql::DatabaseMetaData::getMaxConnections
);
334 /* {{{ ODatabaseMetaData::getMaxColumnsInTable() -I- */
335 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInTable()
336 throw(SQLException
, RuntimeException
)
338 return impl_getInt32MetaData("getMaxColumnsInTable", &sql::DatabaseMetaData::getMaxColumnsInTable
);
343 /* {{{ ODatabaseMetaData::getMaxStatementLength() -I- */
344 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxStatementLength()
345 throw(SQLException
, RuntimeException
)
347 return impl_getInt32MetaData("getMaxStatementLength", &sql::DatabaseMetaData::getMaxStatementLength
);
352 /* {{{ ODatabaseMetaData::getMaxTableNameLength() -I- */
353 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxTableNameLength()
354 throw(SQLException
, RuntimeException
)
356 return impl_getInt32MetaData("getMaxTableNameLength", &sql::DatabaseMetaData::getMaxTableNameLength
);
360 /* {{{ ODatabaseMetaData::getMaxTablesInSelect() -I- */
361 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxTablesInSelect()
362 throw(SQLException
, RuntimeException
)
364 return impl_getInt32MetaData("getMaxTablesInSelect", &sql::DatabaseMetaData::getMaxTablesInSelect
);
369 /* {{{ ODatabaseMetaData::doesMaxRowSizeIncludeBlobs() -I- */
370 sal_Bool SAL_CALL
ODatabaseMetaData::doesMaxRowSizeIncludeBlobs()
371 throw(SQLException
, RuntimeException
)
373 return impl_getBoolMetaData("doesMaxRowSizeIncludeBlobs", &sql::DatabaseMetaData::doesMaxRowSizeIncludeBlobs
);
378 /* {{{ ODatabaseMetaData::storesLowerCaseQuotedIdentifiers() -I- */
379 sal_Bool SAL_CALL
ODatabaseMetaData::storesLowerCaseQuotedIdentifiers()
380 throw(SQLException
, RuntimeException
)
382 return impl_getBoolMetaData("storesLowerCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesLowerCaseQuotedIdentifiers
);
387 /* {{{ ODatabaseMetaData::storesLowerCaseIdentifiers() -I- */
388 sal_Bool SAL_CALL
ODatabaseMetaData::storesLowerCaseIdentifiers()
389 throw(SQLException
, RuntimeException
)
391 return impl_getBoolMetaData("storesLowerCaseIdentifiers", &sql::DatabaseMetaData::storesLowerCaseIdentifiers
);
396 /* {{{ ODatabaseMetaData::storesMixedCaseQuotedIdentifiers() -I- */
397 sal_Bool SAL_CALL
ODatabaseMetaData::storesMixedCaseQuotedIdentifiers()
398 throw(SQLException
, RuntimeException
)
400 return impl_getBoolMetaData("storesMixedCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesMixedCaseQuotedIdentifiers
);
405 /* {{{ ODatabaseMetaData::storesMixedCaseIdentifiers() -I- */
406 sal_Bool SAL_CALL
ODatabaseMetaData::storesMixedCaseIdentifiers()
407 throw(SQLException
, RuntimeException
)
409 return impl_getBoolMetaData("storesMixedCaseIdentifiers", &sql::DatabaseMetaData::storesMixedCaseIdentifiers
);
414 /* {{{ ODatabaseMetaData::storesUpperCaseQuotedIdentifiers() -I- */
415 sal_Bool SAL_CALL
ODatabaseMetaData::storesUpperCaseQuotedIdentifiers()
416 throw(SQLException
, RuntimeException
)
418 return impl_getBoolMetaData("storesUpperCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesUpperCaseQuotedIdentifiers
);
423 /* {{{ ODatabaseMetaData::storesUpperCaseIdentifiers() -I- */
424 sal_Bool SAL_CALL
ODatabaseMetaData::storesUpperCaseIdentifiers()
425 throw(SQLException
, RuntimeException
)
427 return impl_getBoolMetaData("storesUpperCaseIdentifiers", &sql::DatabaseMetaData::storesUpperCaseIdentifiers
);
432 /* {{{ ODatabaseMetaData::supportsAlterTableWithAddColumn() -I- */
433 sal_Bool SAL_CALL
ODatabaseMetaData::supportsAlterTableWithAddColumn()
434 throw(SQLException
, RuntimeException
)
436 return impl_getBoolMetaData("supportsAlterTableWithAddColumn", &sql::DatabaseMetaData::supportsAlterTableWithAddColumn
);
441 /* {{{ ODatabaseMetaData::supportsAlterTableWithDropColumn() -I- */
442 sal_Bool SAL_CALL
ODatabaseMetaData::supportsAlterTableWithDropColumn()
443 throw(SQLException
, RuntimeException
)
445 return impl_getBoolMetaData("supportsAlterTableWithDropColumn", &sql::DatabaseMetaData::supportsAlterTableWithDropColumn
);
450 /* {{{ ODatabaseMetaData::getMaxIndexLength() -I- */
451 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxIndexLength()
452 throw(SQLException
, RuntimeException
)
454 return impl_getInt32MetaData("getMaxIndexLength", &sql::DatabaseMetaData::getMaxIndexLength
);
459 /* {{{ ODatabaseMetaData::supportsNonNullableColumns() -I- */
460 sal_Bool SAL_CALL
ODatabaseMetaData::supportsNonNullableColumns()
461 throw(SQLException
, RuntimeException
)
463 return impl_getBoolMetaData("supportsNonNullableColumns", &sql::DatabaseMetaData::supportsNonNullableColumns
);
468 /* {{{ ODatabaseMetaData::getCatalogTerm() -I- */
469 OUString SAL_CALL
ODatabaseMetaData::getCatalogTerm()
470 throw(SQLException
, RuntimeException
)
472 return impl_getStringMetaData("getCatalogTerm", &sql::DatabaseMetaData::getCatalogTerm
);
477 /* {{{ ODatabaseMetaData::getIdentifierQuoteString() -I- */
478 OUString SAL_CALL
ODatabaseMetaData::getIdentifierQuoteString()
479 throw(SQLException
, RuntimeException
)
481 if (identifier_quote_string_set
== false) {
482 identifier_quote_string
= impl_getStringMetaData("getIdentifierQuoteString", &sql::DatabaseMetaData::getIdentifierQuoteString
);
483 identifier_quote_string_set
= true;
485 return identifier_quote_string
;
490 /* {{{ ODatabaseMetaData::getExtraNameCharacters() -I- */
491 OUString SAL_CALL
ODatabaseMetaData::getExtraNameCharacters()
492 throw(SQLException
, RuntimeException
)
494 return impl_getStringMetaData("getExtraNameCharacters", &sql::DatabaseMetaData::getExtraNameCharacters
);
499 /* {{{ ODatabaseMetaData::supportsDifferentTableCorrelationNames() -I- */
500 sal_Bool SAL_CALL
ODatabaseMetaData::supportsDifferentTableCorrelationNames()
501 throw(SQLException
, RuntimeException
)
503 return impl_getBoolMetaData("supportsDifferentTableCorrelationNames", &sql::DatabaseMetaData::supportsDifferentTableCorrelationNames
);
508 /* {{{ ODatabaseMetaData::isCatalogAtStart() -I- */
509 sal_Bool SAL_CALL
ODatabaseMetaData::isCatalogAtStart()
510 throw(SQLException
, RuntimeException
)
512 return impl_getBoolMetaData("isCatalogAtStart", &sql::DatabaseMetaData::isCatalogAtStart
);
517 /* {{{ ODatabaseMetaData::dataDefinitionIgnoredInTransactions() -I- */
518 sal_Bool SAL_CALL
ODatabaseMetaData::dataDefinitionIgnoredInTransactions()
519 throw(SQLException
, RuntimeException
)
521 return impl_getBoolMetaData("dataDefinitionIgnoredInTransactions", &sql::DatabaseMetaData::dataDefinitionIgnoredInTransactions
);
526 /* {{{ ODatabaseMetaData::dataDefinitionCausesTransactionCommit() -I- */
527 sal_Bool SAL_CALL
ODatabaseMetaData::dataDefinitionCausesTransactionCommit()
528 throw(SQLException
, RuntimeException
)
530 return impl_getBoolMetaData("dataDefinitionCausesTransactionCommit", &sql::DatabaseMetaData::dataDefinitionCausesTransactionCommit
);
535 /* {{{ ODatabaseMetaData::supportsDataManipulationTransactionsOnly() -I- */
536 sal_Bool SAL_CALL
ODatabaseMetaData::supportsDataManipulationTransactionsOnly()
537 throw(SQLException
, RuntimeException
)
539 return impl_getBoolMetaData("supportsDataManipulationTransactionsOnly", &sql::DatabaseMetaData::supportsDataManipulationTransactionsOnly
);
544 /* {{{ ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions() -I- */
545 sal_Bool SAL_CALL
ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions()
546 throw(SQLException
, RuntimeException
)
548 return impl_getBoolMetaData("supportsDataDefinitionAndDataManipulationTransactions", &sql::DatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions
);
553 /* {{{ ODatabaseMetaData::supportsPositionedDelete() -I- */
554 sal_Bool SAL_CALL
ODatabaseMetaData::supportsPositionedDelete()
555 throw(SQLException
, RuntimeException
)
557 return impl_getBoolMetaData("supportsPositionedDelete", &sql::DatabaseMetaData::supportsPositionedDelete
);
562 /* {{{ ODatabaseMetaData::supportsPositionedUpdate() -I- */
563 sal_Bool SAL_CALL
ODatabaseMetaData::supportsPositionedUpdate()
564 throw(SQLException
, RuntimeException
)
566 return impl_getBoolMetaData("supportsPositionedUpdate", &sql::DatabaseMetaData::supportsPositionedUpdate
);
571 /* {{{ ODatabaseMetaData::supportsOpenStatementsAcrossRollback() -I- */
572 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenStatementsAcrossRollback()
573 throw(SQLException
, RuntimeException
)
575 return impl_getBoolMetaData("supportsOpenStatementsAcrossRollback", &sql::DatabaseMetaData::supportsOpenStatementsAcrossRollback
);
580 /* {{{ ODatabaseMetaData::supportsOpenStatementsAcrossCommit() -I- */
581 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenStatementsAcrossCommit()
582 throw(SQLException
, RuntimeException
)
584 return impl_getBoolMetaData("supportsOpenStatementsAcrossCommit", &sql::DatabaseMetaData::supportsOpenStatementsAcrossCommit
);
589 /* {{{ ODatabaseMetaData::supportsOpenCursorsAcrossCommit() -I- */
590 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenCursorsAcrossCommit()
591 throw(SQLException
, RuntimeException
)
593 return impl_getBoolMetaData("supportsOpenCursorsAcrossCommit", &sql::DatabaseMetaData::supportsOpenCursorsAcrossCommit
);
598 /* {{{ ODatabaseMetaData::supportsOpenCursorsAcrossRollback() -I- */
599 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOpenCursorsAcrossRollback()
600 throw(SQLException
, RuntimeException
)
602 return impl_getBoolMetaData("supportsOpenCursorsAcrossRollback", &sql::DatabaseMetaData::supportsOpenCursorsAcrossRollback
);
607 /* {{{ ODatabaseMetaData::supportsTransactionIsolationLevel() -I- */
608 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTransactionIsolationLevel(sal_Int32 level
)
609 throw(SQLException
, RuntimeException
)
611 return impl_getBoolMetaData("supportsTransactionIsolationLevel", &sql::DatabaseMetaData::supportsTransactionIsolationLevel
, level
);
616 /* {{{ ODatabaseMetaData::supportsSchemasInDataManipulation() -I- */
617 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSchemasInDataManipulation()
618 throw(SQLException
, RuntimeException
)
620 return impl_getBoolMetaData("supportsSchemasInDataManipulation", &sql::DatabaseMetaData::supportsSchemasInDataManipulation
);
625 /* {{{ ODatabaseMetaData::supportsANSI92FullSQL() -I- */
626 sal_Bool SAL_CALL
ODatabaseMetaData::supportsANSI92FullSQL()
627 throw(SQLException
, RuntimeException
)
629 return impl_getBoolMetaData("supportsANSI92FullSQL", &sql::DatabaseMetaData::supportsANSI92FullSQL
);
634 /* {{{ ODatabaseMetaData::supportsANSI92EntryLevelSQL() -I- */
635 sal_Bool SAL_CALL
ODatabaseMetaData::supportsANSI92EntryLevelSQL()
636 throw(SQLException
, RuntimeException
)
638 return impl_getBoolMetaData("supportsANSI92EntryLevelSQL", &sql::DatabaseMetaData::supportsANSI92EntryLevelSQL
);
643 /* {{{ ODatabaseMetaData::supportsIntegrityEnhancementFacility() -I- */
644 sal_Bool SAL_CALL
ODatabaseMetaData::supportsIntegrityEnhancementFacility()
645 throw(SQLException
, RuntimeException
)
647 return impl_getBoolMetaData("supportsIntegrityEnhancementFacility", &sql::DatabaseMetaData::supportsIntegrityEnhancementFacility
);
652 /* {{{ ODatabaseMetaData::supportsSchemasInIndexDefinitions() -I- */
653 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSchemasInIndexDefinitions()
654 throw(SQLException
, RuntimeException
)
656 return impl_getBoolMetaData("supportsSchemasInIndexDefinitions", &sql::DatabaseMetaData::supportsSchemasInIndexDefinitions
);
661 /* {{{ ODatabaseMetaData::supportsSchemasInTableDefinitions() -I- */
662 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSchemasInTableDefinitions()
663 throw(SQLException
, RuntimeException
)
665 return impl_getBoolMetaData("supportsSchemasInTableDefinitions", &sql::DatabaseMetaData::supportsSchemasInTableDefinitions
);
670 /* {{{ ODatabaseMetaData::supportsCatalogsInTableDefinitions() -I- */
671 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCatalogsInTableDefinitions()
672 throw(SQLException
, RuntimeException
)
674 return impl_getBoolMetaData("supportsCatalogsInTableDefinitions", &sql::DatabaseMetaData::supportsCatalogsInTableDefinitions
);
679 /* {{{ ODatabaseMetaData::supportsCatalogsInIndexDefinitions() -I- */
680 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCatalogsInIndexDefinitions()
681 throw(SQLException
, RuntimeException
)
683 return impl_getBoolMetaData("supportsCatalogsInIndexDefinitions", &sql::DatabaseMetaData::supportsCatalogsInIndexDefinitions
);
688 /* {{{ ODatabaseMetaData::supportsCatalogsInDataManipulation() -I- */
689 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCatalogsInDataManipulation()
690 throw(SQLException
, RuntimeException
)
692 return impl_getBoolMetaData("supportsCatalogsInDataManipulation", &sql::DatabaseMetaData::supportsCatalogsInDataManipulation
);
697 /* {{{ ODatabaseMetaData::supportsOuterJoins() -I- */
698 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOuterJoins()
699 throw(SQLException
, RuntimeException
)
701 return impl_getBoolMetaData("supportsOuterJoins", &sql::DatabaseMetaData::supportsOuterJoins
);
706 /* {{{ ODatabaseMetaData::getMaxStatements() -I- */
707 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxStatements()
708 throw(SQLException
, RuntimeException
)
710 return impl_getInt32MetaData("getMaxStatements", &sql::DatabaseMetaData::getMaxStatements
);
715 /* {{{ ODatabaseMetaData::getMaxProcedureNameLength() -I- */
716 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxProcedureNameLength()
717 throw(SQLException
, RuntimeException
)
719 return impl_getInt32MetaData("getMaxProcedureNameLength", &sql::DatabaseMetaData::getMaxProcedureNameLength
);
724 /* {{{ ODatabaseMetaData::getMaxSchemaNameLength() -I- */
725 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxSchemaNameLength()
726 throw(SQLException
, RuntimeException
)
728 return impl_getInt32MetaData("getMaxSchemaNameLength", &sql::DatabaseMetaData::getMaxSchemaNameLength
);
733 /* {{{ ODatabaseMetaData::supportsTransactions() -I- */
734 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTransactions()
735 throw(SQLException
, RuntimeException
)
737 return impl_getBoolMetaData("supportsTransactions", &sql::DatabaseMetaData::supportsTransactions
);
742 /* {{{ ODatabaseMetaData::allProceduresAreCallable() -I- */
743 sal_Bool SAL_CALL
ODatabaseMetaData::allProceduresAreCallable()
744 throw(SQLException
, RuntimeException
)
746 return impl_getBoolMetaData("allProceduresAreCallable", &sql::DatabaseMetaData::allProceduresAreCallable
);
751 /* {{{ ODatabaseMetaData::supportsStoredProcedures() -I- */
752 sal_Bool SAL_CALL
ODatabaseMetaData::supportsStoredProcedures()
753 throw(SQLException
, RuntimeException
)
755 return impl_getBoolMetaData("supportsStoredProcedures", &sql::DatabaseMetaData::supportsStoredProcedures
);
760 /* {{{ ODatabaseMetaData::supportsSelectForUpdate() -I- */
761 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSelectForUpdate()
762 throw(SQLException
, RuntimeException
)
764 return impl_getBoolMetaData("supportsSelectForUpdate", &sql::DatabaseMetaData::supportsSelectForUpdate
);
769 /* {{{ ODatabaseMetaData::allTablesAreSelectable() -I- */
770 sal_Bool SAL_CALL
ODatabaseMetaData::allTablesAreSelectable()
771 throw(SQLException
, RuntimeException
)
773 return impl_getBoolMetaData("allTablesAreSelectable", &sql::DatabaseMetaData::allTablesAreSelectable
);
778 /* {{{ ODatabaseMetaData::isReadOnly() -I- */
779 sal_Bool SAL_CALL
ODatabaseMetaData::isReadOnly()
780 throw(SQLException
, RuntimeException
)
782 return impl_getBoolMetaData("isReadOnly", &sql::DatabaseMetaData::isReadOnly
);
787 /* {{{ ODatabaseMetaData::usesLocalFiles() -I- */
788 sal_Bool SAL_CALL
ODatabaseMetaData::usesLocalFiles()
789 throw(SQLException
, RuntimeException
)
791 return impl_getBoolMetaData("usesLocalFiles", &sql::DatabaseMetaData::usesLocalFiles
);
796 /* {{{ ODatabaseMetaData::usesLocalFilePerTable() -I- */
797 sal_Bool SAL_CALL
ODatabaseMetaData::usesLocalFilePerTable()
798 throw(SQLException
, RuntimeException
)
800 return impl_getBoolMetaData("usesLocalFilePerTable", &sql::DatabaseMetaData::usesLocalFilePerTable
);
805 /* {{{ ODatabaseMetaData::supportsTypeConversion() -I- */
806 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTypeConversion()
807 throw(SQLException
, RuntimeException
)
809 return impl_getBoolMetaData("supportsTypeConversion", &sql::DatabaseMetaData::supportsTypeConversion
);
814 /* {{{ ODatabaseMetaData::nullPlusNonNullIsNull() -I- */
815 sal_Bool SAL_CALL
ODatabaseMetaData::nullPlusNonNullIsNull()
816 throw(SQLException
, RuntimeException
)
818 return impl_getBoolMetaData("nullPlusNonNullIsNull", &sql::DatabaseMetaData::nullPlusNonNullIsNull
);
823 /* {{{ ODatabaseMetaData::supportsColumnAliasing() -I- */
824 sal_Bool SAL_CALL
ODatabaseMetaData::supportsColumnAliasing()
825 throw(SQLException
, RuntimeException
)
827 return impl_getBoolMetaData("supportsColumnAliasing", &sql::DatabaseMetaData::supportsColumnAliasing
);
832 /* {{{ ODatabaseMetaData::supportsTableCorrelationNames() -I- */
833 sal_Bool SAL_CALL
ODatabaseMetaData::supportsTableCorrelationNames()
834 throw(SQLException
, RuntimeException
)
836 return impl_getBoolMetaData("supportsTableCorrelationNames", &sql::DatabaseMetaData::supportsTableCorrelationNames
);
841 /* {{{ ODatabaseMetaData::supportsConvert() -I- */
842 sal_Bool SAL_CALL
ODatabaseMetaData::supportsConvert(sal_Int32
/* fromType */, sal_Int32
/* toType */)
843 throw(SQLException
, RuntimeException
)
845 OSL_TRACE("ODatabaseMetaData::supportsConvert");
847 /* ToDo -> use supportsConvert( fromType, toType) */
848 return meta
->supportsConvert()? sal_True
:sal_False
;
849 } catch (const sql::MethodNotImplementedException
&) {
850 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::supportsConvert", *this);
851 } catch (const sql::InvalidArgumentException
&) {
852 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::supportsConvert", *this);
853 } catch (const sql::SQLException
& e
) {
854 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
861 /* {{{ ODatabaseMetaData::supportsExpressionsInOrderBy() -I- */
862 sal_Bool SAL_CALL
ODatabaseMetaData::supportsExpressionsInOrderBy()
863 throw(SQLException
, RuntimeException
)
865 return impl_getBoolMetaData("supportsExpressionsInOrderBy", &sql::DatabaseMetaData::supportsExpressionsInOrderBy
);
870 /* {{{ ODatabaseMetaData::supportsGroupBy() -I- */
871 sal_Bool SAL_CALL
ODatabaseMetaData::supportsGroupBy()
872 throw(SQLException
, RuntimeException
)
874 return impl_getBoolMetaData("supportsGroupBy", &sql::DatabaseMetaData::supportsGroupBy
);
879 /* {{{ ODatabaseMetaData::supportsGroupByBeyondSelect() -I- */
880 sal_Bool SAL_CALL
ODatabaseMetaData::supportsGroupByBeyondSelect()
881 throw(SQLException
, RuntimeException
)
883 return impl_getBoolMetaData("supportsGroupByBeyondSelect", &sql::DatabaseMetaData::supportsGroupByBeyondSelect
);
888 /* {{{ ODatabaseMetaData::supportsGroupByUnrelated() -I- */
889 sal_Bool SAL_CALL
ODatabaseMetaData::supportsGroupByUnrelated()
890 throw(SQLException
, RuntimeException
)
892 return impl_getBoolMetaData("supportsGroupByUnrelated", &sql::DatabaseMetaData::supportsGroupByUnrelated
);
897 /* {{{ ODatabaseMetaData::supportsMultipleTransactions() -I- */
898 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMultipleTransactions()
899 throw(SQLException
, RuntimeException
)
901 return impl_getBoolMetaData("supportsMultipleTransactions", &sql::DatabaseMetaData::supportsMultipleTransactions
);
906 /* {{{ ODatabaseMetaData::supportsMultipleResultSets() -I- */
907 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMultipleResultSets()
908 throw(SQLException
, RuntimeException
)
910 return impl_getBoolMetaData("supportsMultipleResultSets", &sql::DatabaseMetaData::supportsMultipleResultSets
);
915 /* {{{ ODatabaseMetaData::supportsLikeEscapeClause() -I- */
916 sal_Bool SAL_CALL
ODatabaseMetaData::supportsLikeEscapeClause()
917 throw(SQLException
, RuntimeException
)
919 return impl_getBoolMetaData("supportsLikeEscapeClause", &sql::DatabaseMetaData::supportsLikeEscapeClause
);
924 /* {{{ ODatabaseMetaData::supportsOrderByUnrelated() -I- */
925 sal_Bool SAL_CALL
ODatabaseMetaData::supportsOrderByUnrelated()
926 throw(SQLException
, RuntimeException
)
928 return impl_getBoolMetaData("supportsOrderByUnrelated", &sql::DatabaseMetaData::supportsOrderByUnrelated
);
933 /* {{{ ODatabaseMetaData::supportsUnion() -I- */
934 sal_Bool SAL_CALL
ODatabaseMetaData::supportsUnion()
935 throw(SQLException
, RuntimeException
)
937 return impl_getBoolMetaData("supportsUnion", &sql::DatabaseMetaData::supportsUnion
);
942 /* {{{ ODatabaseMetaData::supportsUnionAll() -I- */
943 sal_Bool SAL_CALL
ODatabaseMetaData::supportsUnionAll()
944 throw(SQLException
, RuntimeException
)
946 return impl_getBoolMetaData("supportsUnionAll", &sql::DatabaseMetaData::supportsUnionAll
);
951 /* {{{ ODatabaseMetaData::supportsMixedCaseIdentifiers() -I- */
952 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMixedCaseIdentifiers()
953 throw(SQLException
, RuntimeException
)
955 return impl_getBoolMetaData("supportsMixedCaseIdentifiers", &sql::DatabaseMetaData::supportsMixedCaseIdentifiers
);
960 /* {{{ ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers() -I- */
961 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers()
962 throw(SQLException
, RuntimeException
)
964 return impl_getBoolMetaData("supportsMixedCaseQuotedIdentifiers", &sql::DatabaseMetaData::supportsMixedCaseQuotedIdentifiers
);
969 /* {{{ ODatabaseMetaData::nullsAreSortedAtEnd() -I- */
970 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedAtEnd()
971 throw(SQLException
, RuntimeException
)
973 return impl_getBoolMetaData("nullsAreSortedAtEnd", &sql::DatabaseMetaData::nullsAreSortedAtEnd
);
978 /* {{{ ODatabaseMetaData::nullsAreSortedAtStart() -I- */
979 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedAtStart()
980 throw(SQLException
, RuntimeException
)
982 return impl_getBoolMetaData("nullsAreSortedAtStart", &sql::DatabaseMetaData::nullsAreSortedAtStart
);
987 /* {{{ ODatabaseMetaData::nullsAreSortedHigh() -I- */
988 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedHigh()
989 throw(SQLException
, RuntimeException
)
991 return impl_getBoolMetaData("nullsAreSortedHigh", &sql::DatabaseMetaData::nullsAreSortedHigh
);
996 /* {{{ ODatabaseMetaData::nullsAreSortedLow() -I- */
997 sal_Bool SAL_CALL
ODatabaseMetaData::nullsAreSortedLow()
998 throw(SQLException
, RuntimeException
)
1000 return impl_getBoolMetaData("nullsAreSortedLow", &sql::DatabaseMetaData::nullsAreSortedLow
);
1005 /* {{{ ODatabaseMetaData::supportsSchemasInProcedureCalls() -I- */
1006 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSchemasInProcedureCalls()
1007 throw(SQLException
, RuntimeException
)
1009 return impl_getBoolMetaData("supportsSchemasInProcedureCalls", &sql::DatabaseMetaData::supportsSchemasInProcedureCalls
);
1014 /* {{{ ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions() -I- */
1015 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions()
1016 throw(SQLException
, RuntimeException
)
1018 return impl_getBoolMetaData("supportsSchemasInPrivilegeDefinitions", &sql::DatabaseMetaData::supportsSchemasInPrivilegeDefinitions
);
1023 /* {{{ ODatabaseMetaData::supportsCatalogsInProcedureCalls() -I- */
1024 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCatalogsInProcedureCalls()
1025 throw(SQLException
, RuntimeException
)
1027 return impl_getBoolMetaData("supportsCatalogsInProcedureCalls", &sql::DatabaseMetaData::supportsCatalogsInProcedureCalls
);
1032 /* {{{ ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions() -I- */
1033 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions()
1034 throw(SQLException
, RuntimeException
)
1036 return impl_getBoolMetaData("supportsCatalogsInPrivilegeDefinitions", &sql::DatabaseMetaData::supportsCatalogsInPrivilegeDefinitions
);
1041 /* {{{ ODatabaseMetaData::supportsCorrelatedSubqueries() -I- */
1042 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCorrelatedSubqueries()
1043 throw(SQLException
, RuntimeException
)
1045 return impl_getBoolMetaData("supportsCorrelatedSubqueries", &sql::DatabaseMetaData::supportsCorrelatedSubqueries
);
1050 /* {{{ ODatabaseMetaData::supportsSubqueriesInComparisons() -I- */
1051 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInComparisons()
1052 throw(SQLException
, RuntimeException
)
1054 return impl_getBoolMetaData("supportsSubqueriesInComparisons", &sql::DatabaseMetaData::supportsSubqueriesInComparisons
);
1059 /* {{{ ODatabaseMetaData::supportsSubqueriesInExists() -I- */
1060 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInExists()
1061 throw(SQLException
, RuntimeException
)
1063 return impl_getBoolMetaData("supportsSubqueriesInExists", &sql::DatabaseMetaData::supportsSubqueriesInExists
);
1068 /* {{{ ODatabaseMetaData::supportsSubqueriesInIns() -I- */
1069 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInIns()
1070 throw(SQLException
, RuntimeException
)
1072 return impl_getBoolMetaData("supportsSubqueriesInIns", &sql::DatabaseMetaData::supportsSubqueriesInIns
);
1077 /* {{{ ODatabaseMetaData::supportsSubqueriesInQuantifieds() -I- */
1078 sal_Bool SAL_CALL
ODatabaseMetaData::supportsSubqueriesInQuantifieds()
1079 throw(SQLException
, RuntimeException
)
1081 return impl_getBoolMetaData("supportsSubqueriesInQuantifieds", &sql::DatabaseMetaData::supportsSubqueriesInQuantifieds
);
1086 /* {{{ ODatabaseMetaData::supportsANSI92IntermediateSQL() -I- */
1087 sal_Bool SAL_CALL
ODatabaseMetaData::supportsANSI92IntermediateSQL()
1088 throw(SQLException
, RuntimeException
)
1090 return impl_getBoolMetaData("supportsANSI92IntermediateSQL", &sql::DatabaseMetaData::supportsANSI92IntermediateSQL
);
1095 /* {{{ ODatabaseMetaData::getURL() -I- */
1096 OUString SAL_CALL
ODatabaseMetaData::getURL()
1097 throw(SQLException
, RuntimeException
)
1099 OSL_TRACE("ODatabaseMetaData::getURL");
1100 return m_rConnection
.getConnectionSettings().connectionURL
;
1105 /* {{{ ODatabaseMetaData::getUserName() -I- */
1106 OUString SAL_CALL
ODatabaseMetaData::getUserName()
1107 throw(SQLException
, RuntimeException
)
1109 return impl_getStringMetaData("getUserName", &sql::DatabaseMetaData::getUserName
);
1114 /* {{{ ODatabaseMetaData::getDriverName() -I- */
1115 OUString SAL_CALL
ODatabaseMetaData::getDriverName()
1116 throw(SQLException
, RuntimeException
)
1118 OSL_TRACE("ODatabaseMetaData::getDriverName");
1119 OUString
aValue( "MySQL Connector/OO.org" );
1125 /* {{{ ODatabaseMetaData::getDriverVersion() -I- */
1126 OUString SAL_CALL
ODatabaseMetaData::getDriverVersion()
1127 throw(SQLException
, RuntimeException
)
1129 OSL_TRACE("ODatabaseMetaData::getDriverVersion");
1130 static const OUString
sVersion( "0.9.2" );
1136 /* {{{ ODatabaseMetaData::getDatabaseProductVersion() -I- */
1137 OUString SAL_CALL
ODatabaseMetaData::getDatabaseProductVersion()
1138 throw(SQLException
, RuntimeException
)
1140 return impl_getStringMetaData("getDatabaseProductVersion", &sql::DatabaseMetaData::getDatabaseProductVersion
);
1145 /* {{{ ODatabaseMetaData::getDatabaseProductName() -I- */
1146 OUString SAL_CALL
ODatabaseMetaData::getDatabaseProductName()
1147 throw(SQLException
, RuntimeException
)
1149 return impl_getStringMetaData("getDatabaseProductName", &sql::DatabaseMetaData::getDatabaseProductName
);
1154 /* {{{ ODatabaseMetaData::getProcedureTerm() -I- */
1155 OUString SAL_CALL
ODatabaseMetaData::getProcedureTerm()
1156 throw(SQLException
, RuntimeException
)
1158 return impl_getStringMetaData("getProcedureTerm", &sql::DatabaseMetaData::getProcedureTerm
);
1163 /* {{{ ODatabaseMetaData::getSchemaTerm() -I- */
1164 OUString SAL_CALL
ODatabaseMetaData::getSchemaTerm()
1165 throw(SQLException
, RuntimeException
)
1167 return impl_getStringMetaData("getSchemaTerm", &sql::DatabaseMetaData::getSchemaTerm
);
1172 /* {{{ ODatabaseMetaData::getDriverMajorVersion() -I- */
1173 sal_Int32 SAL_CALL
ODatabaseMetaData::getDriverMajorVersion()
1174 throw(RuntimeException
)
1176 OSL_TRACE("ODatabaseMetaData::getDriverMajorVersion");
1177 return MARIADBC_VERSION_MAJOR
;
1182 /* {{{ ODatabaseMetaData::getDefaultTransactionIsolation() -I- */
1183 sal_Int32 SAL_CALL
ODatabaseMetaData::getDefaultTransactionIsolation()
1184 throw(SQLException
, RuntimeException
)
1186 OSL_TRACE("ODatabaseMetaData::getDefaultTransactionIsolation");
1188 switch (meta
->getDefaultTransactionIsolation()) {
1189 case sql::TRANSACTION_SERIALIZABLE
: return TransactionIsolation::SERIALIZABLE
;
1190 case sql::TRANSACTION_REPEATABLE_READ
: return TransactionIsolation::REPEATABLE_READ
;
1191 case sql::TRANSACTION_READ_COMMITTED
: return TransactionIsolation::READ_COMMITTED
;
1192 case sql::TRANSACTION_READ_UNCOMMITTED
: return TransactionIsolation::READ_UNCOMMITTED
;
1194 } catch (const sql::MethodNotImplementedException
&) {
1195 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getDriverMajorVersion", *this);
1196 } catch (const sql::InvalidArgumentException
&) {
1197 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getDriverMajorVersion", *this);
1198 } catch (const sql::SQLException
& e
) {
1199 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
1201 return TransactionIsolation::NONE
;
1206 /* {{{ ODatabaseMetaData::getDriverMinorVersion() -I- */
1207 sal_Int32 SAL_CALL
ODatabaseMetaData::getDriverMinorVersion()
1208 throw(RuntimeException
)
1210 OSL_TRACE("ODatabaseMetaData::getDriverMinorVersion");
1211 return MARIADBC_VERSION_MINOR
;
1216 /* {{{ ODatabaseMetaData::getSQLKeywords() -I- */
1217 OUString SAL_CALL
ODatabaseMetaData::getSQLKeywords()
1218 throw(SQLException
, RuntimeException
)
1220 return impl_getStringMetaData("getSQLKeywords", &sql::DatabaseMetaData::getSQLKeywords
);
1225 /* {{{ ODatabaseMetaData::getSearchStringEscape() -I- */
1226 OUString SAL_CALL
ODatabaseMetaData::getSearchStringEscape()
1227 throw(SQLException
, RuntimeException
)
1229 return impl_getStringMetaData("getSearchStringEscape", &sql::DatabaseMetaData::getSearchStringEscape
);
1234 /* {{{ ODatabaseMetaData::getStringFunctions() -I- */
1235 OUString SAL_CALL
ODatabaseMetaData::getStringFunctions()
1236 throw(SQLException
, RuntimeException
)
1238 return impl_getStringMetaData("getStringFunctions", &sql::DatabaseMetaData::getStringFunctions
);
1243 /* {{{ ODatabaseMetaData::getTimeDateFunctions() -I- */
1244 OUString SAL_CALL
ODatabaseMetaData::getTimeDateFunctions()
1245 throw(SQLException
, RuntimeException
)
1247 return impl_getStringMetaData("getTimeDateFunctions", &sql::DatabaseMetaData::getTimeDateFunctions
);
1252 /* {{{ ODatabaseMetaData::getSystemFunctions() -I- */
1253 OUString SAL_CALL
ODatabaseMetaData::getSystemFunctions()
1254 throw(SQLException
, RuntimeException
)
1256 return impl_getStringMetaData("getSystemFunctions", &sql::DatabaseMetaData::getSystemFunctions
);
1261 /* {{{ ODatabaseMetaData::getNumericFunctions() -I- */
1262 OUString SAL_CALL
ODatabaseMetaData::getNumericFunctions()
1263 throw(SQLException
, RuntimeException
)
1265 return impl_getStringMetaData("getNumericFunctions", &sql::DatabaseMetaData::getNumericFunctions
);
1270 /* {{{ ODatabaseMetaData::supportsExtendedSQLGrammar() -I- */
1271 sal_Bool SAL_CALL
ODatabaseMetaData::supportsExtendedSQLGrammar()
1272 throw(SQLException
, RuntimeException
)
1274 return impl_getBoolMetaData("supportsExtendedSQLGrammar", &sql::DatabaseMetaData::supportsExtendedSQLGrammar
);
1279 /* {{{ ODatabaseMetaData::supportsCoreSQLGrammar() -I- */
1280 sal_Bool SAL_CALL
ODatabaseMetaData::supportsCoreSQLGrammar()
1281 throw(SQLException
, RuntimeException
)
1283 return impl_getBoolMetaData("supportsCoreSQLGrammar", &sql::DatabaseMetaData::supportsCoreSQLGrammar
);
1288 /* {{{ ODatabaseMetaData::supportsMinimumSQLGrammar() -I- */
1289 sal_Bool SAL_CALL
ODatabaseMetaData::supportsMinimumSQLGrammar()
1290 throw(SQLException
, RuntimeException
)
1292 return impl_getBoolMetaData("supportsMinimumSQLGrammar", &sql::DatabaseMetaData::supportsMinimumSQLGrammar
);
1297 /* {{{ ODatabaseMetaData::supportsFullOuterJoins() -I- */
1298 sal_Bool SAL_CALL
ODatabaseMetaData::supportsFullOuterJoins()
1299 throw(SQLException
, RuntimeException
)
1301 return impl_getBoolMetaData("supportsFullOuterJoins", &sql::DatabaseMetaData::supportsFullOuterJoins
);
1306 /* {{{ ODatabaseMetaData::supportsLimitedOuterJoins() -I- */
1307 sal_Bool SAL_CALL
ODatabaseMetaData::supportsLimitedOuterJoins()
1308 throw(SQLException
, RuntimeException
)
1310 return impl_getBoolMetaData("supportsLimitedOuterJoins", &sql::DatabaseMetaData::supportsLimitedOuterJoins
);
1315 /* {{{ ODatabaseMetaData::getMaxColumnsInGroupBy() -I- */
1316 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInGroupBy()
1317 throw(SQLException
, RuntimeException
)
1319 return impl_getInt32MetaData("getMaxColumnsInGroupBy", &sql::DatabaseMetaData::getMaxColumnsInGroupBy
);
1324 /* {{{ ODatabaseMetaData::getMaxColumnsInOrderBy() -I- */
1325 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInOrderBy()
1326 throw(SQLException
, RuntimeException
)
1328 return impl_getInt32MetaData("getMaxColumnsInOrderBy", &sql::DatabaseMetaData::getMaxColumnsInOrderBy
);
1333 /* {{{ ODatabaseMetaData::getMaxColumnsInSelect() -I- */
1334 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxColumnsInSelect()
1335 throw(SQLException
, RuntimeException
)
1337 return impl_getInt32MetaData("getMaxColumnsInSelect", &sql::DatabaseMetaData::getMaxColumnsInSelect
);
1342 /* {{{ ODatabaseMetaData::getMaxUserNameLength() -I- */
1343 sal_Int32 SAL_CALL
ODatabaseMetaData::getMaxUserNameLength()
1344 throw(SQLException
, RuntimeException
)
1346 return impl_getInt32MetaData("getMaxUserNameLength", &sql::DatabaseMetaData::getMaxUserNameLength
);
1351 /* {{{ ODatabaseMetaData::supportsResultSetType() -I- */
1352 sal_Bool SAL_CALL
ODatabaseMetaData::supportsResultSetType(sal_Int32 setType
)
1353 throw(SQLException
, RuntimeException
)
1355 return impl_getRSTypeMetaData("supportsResultSetType", &sql::DatabaseMetaData::supportsResultSetType
, setType
);
1360 /* {{{ ODatabaseMetaData::supportsResultSetConcurrency() -I- */
1361 sal_Bool SAL_CALL
ODatabaseMetaData::supportsResultSetConcurrency(sal_Int32 setType
, sal_Int32 concurrency
)
1362 throw(SQLException
, RuntimeException
)
1364 OSL_TRACE("ODatabaseMetaData::supportsResultSetConcurrency");
1365 /* TODO: Check this out */
1367 return meta
->supportsResultSetConcurrency(setType
, concurrency
==com::sun::star::sdbc::TransactionIsolation::READ_COMMITTED
?
1368 sql::TRANSACTION_READ_COMMITTED
:
1369 (concurrency
== com::sun::star::sdbc::TransactionIsolation::SERIALIZABLE
?
1370 sql::TRANSACTION_SERIALIZABLE
:sql::TRANSACTION_SERIALIZABLE
))? sal_True
:sal_False
;
1371 } catch (const sql::MethodNotImplementedException
&) {
1372 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::supportsResultSetConcurrency", *this);
1373 } catch (const sql::InvalidArgumentException
&) {
1374 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::supportsResultSetConcurrency", *this);
1375 } catch (const sql::SQLException
& e
) {
1376 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
1383 /* {{{ ODatabaseMetaData::ownUpdatesAreVisible() -I- */
1384 sal_Bool SAL_CALL
ODatabaseMetaData::ownUpdatesAreVisible(sal_Int32 setType
)
1385 throw(SQLException
, RuntimeException
)
1387 return impl_getRSTypeMetaData("ownUpdatesAreVisible", &sql::DatabaseMetaData::ownUpdatesAreVisible
, setType
);
1392 /* {{{ ODatabaseMetaData::ownDeletesAreVisible() -I- */
1393 sal_Bool SAL_CALL
ODatabaseMetaData::ownDeletesAreVisible(sal_Int32 setType
)
1394 throw(SQLException
, RuntimeException
)
1396 return impl_getRSTypeMetaData("ownDeletesAreVisible", &sql::DatabaseMetaData::ownDeletesAreVisible
, setType
);
1401 /* {{{ ODatabaseMetaData::ownInsertsAreVisible() -I- */
1402 sal_Bool SAL_CALL
ODatabaseMetaData::ownInsertsAreVisible(sal_Int32 setType
)
1403 throw(SQLException
, RuntimeException
)
1405 return impl_getRSTypeMetaData("ownInsertsAreVisible", &sql::DatabaseMetaData::ownInsertsAreVisible
, setType
);
1410 /* {{{ ODatabaseMetaData::othersUpdatesAreVisible() -I- */
1411 sal_Bool SAL_CALL
ODatabaseMetaData::othersUpdatesAreVisible(sal_Int32 setType
)
1412 throw(SQLException
, RuntimeException
)
1414 return impl_getRSTypeMetaData("othersUpdatesAreVisible", &sql::DatabaseMetaData::othersUpdatesAreVisible
, setType
);
1419 /* {{{ ODatabaseMetaData::othersDeletesAreVisible() -I- */
1420 sal_Bool SAL_CALL
ODatabaseMetaData::othersDeletesAreVisible(sal_Int32 setType
)
1421 throw(SQLException
, RuntimeException
)
1423 return impl_getRSTypeMetaData("othersDeletesAreVisible", &sql::DatabaseMetaData::othersDeletesAreVisible
, setType
);
1428 /* {{{ ODatabaseMetaData::othersInsertsAreVisible() -I- */
1429 sal_Bool SAL_CALL
ODatabaseMetaData::othersInsertsAreVisible(sal_Int32 setType
)
1430 throw(SQLException
, RuntimeException
)
1432 return impl_getRSTypeMetaData("othersInsertsAreVisible", &sql::DatabaseMetaData::othersInsertsAreVisible
, setType
);
1437 /* {{{ ODatabaseMetaData::updatesAreDetected() -I- */
1438 sal_Bool SAL_CALL
ODatabaseMetaData::updatesAreDetected(sal_Int32 setType
)
1439 throw(SQLException
, RuntimeException
)
1441 return impl_getRSTypeMetaData("updatesAreDetected", &sql::DatabaseMetaData::updatesAreDetected
, setType
);
1446 /* {{{ ODatabaseMetaData::deletesAreDetected() -I- */
1447 sal_Bool SAL_CALL
ODatabaseMetaData::deletesAreDetected(sal_Int32 setType
)
1448 throw(SQLException
, RuntimeException
)
1450 return impl_getRSTypeMetaData("deletesAreDetected", &sql::DatabaseMetaData::deletesAreDetected
, setType
);
1455 /* {{{ ODatabaseMetaData::insertsAreDetected() -I- */
1456 sal_Bool SAL_CALL
ODatabaseMetaData::insertsAreDetected(sal_Int32 setType
)
1457 throw(SQLException
, RuntimeException
)
1459 return impl_getRSTypeMetaData("insertsAreDetected", &sql::DatabaseMetaData::insertsAreDetected
, setType
);
1464 /* {{{ ODatabaseMetaData::supportsBatchUpdates() -I- */
1465 sal_Bool SAL_CALL
ODatabaseMetaData::supportsBatchUpdates()
1466 throw(SQLException
, RuntimeException
)
1468 return impl_getBoolMetaData("supportsBatchUpdates", &sql::DatabaseMetaData::supportsBatchUpdates
);
1473 /* {{{ ODatabaseMetaData::getConnection() -I- */
1474 Reference
< XConnection
> SAL_CALL
ODatabaseMetaData::getConnection()
1475 throw(SQLException
, RuntimeException
)
1477 OSL_TRACE("ODatabaseMetaData::getConnection");
1478 return (Reference
< XConnection
>)&m_rConnection
;
1484 Here follow all methods which return(a resultset
1485 the first methods is an example implementation how to use this resultset
1486 of course you could implement it on your and you should do this because
1487 the general way is more memory expensive
1490 /* {{{ ODatabaseMetaData::getTableTypes() -I- */
1491 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getTableTypes()
1492 throw(SQLException
, RuntimeException
)
1494 OSL_TRACE("ODatabaseMetaData::getTableTypes");
1495 const char * table_types
[] = {"TABLE", "VIEW"};
1496 sal_Int32 requiredVersion
[] = {0, 50000};
1498 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1499 std::vector
< std::vector
< Any
> > rRows
;
1500 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
1502 for (sal_uInt32 i
= 0; i
< 2; i
++) {
1503 if (m_rConnection
.getMysqlVersion() >= requiredVersion
[i
]) {
1504 std::vector
< Any
> aRow(1);
1505 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(table_types
[i
], encoding
)));
1506 rRows
.push_back(aRow
);
1509 lcl_setRows_throw(xResultSet
, 5 ,rRows
);
1515 /* {{{ ODatabaseMetaData::getTypeInfo() -I- */
1516 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getTypeInfo()
1517 throw(SQLException
, RuntimeException
)
1519 OSL_TRACE("ODatabaseMetaData::getTypeInfo");
1520 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1522 std::vector
< std::vector
< Any
> > rRows
;
1524 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
1526 while (mysqlc_types
[i
].typeName
) {
1527 std::vector
< Any
> aRow(1);
1529 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types
[i
].typeName
, encoding
)));
1530 aRow
.push_back(makeAny(mysqlc_types
[i
].dataType
));
1531 aRow
.push_back(makeAny(mysqlc_types
[i
].precision
));
1532 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types
[i
].literalPrefix
, encoding
)));
1533 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types
[i
].literalSuffix
, encoding
)));
1534 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types
[i
].createParams
, encoding
)));
1535 aRow
.push_back(makeAny(mysqlc_types
[i
].nullable
));
1536 aRow
.push_back(makeAny(mysqlc_types
[i
].caseSensitive
));
1537 aRow
.push_back(makeAny(mysqlc_types
[i
].searchable
));
1538 aRow
.push_back(makeAny(mysqlc_types
[i
].isUnsigned
));
1539 aRow
.push_back(makeAny(mysqlc_types
[i
].fixedPrecScale
));
1540 aRow
.push_back(makeAny(mysqlc_types
[i
].autoIncrement
));
1541 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types
[i
].localTypeName
, encoding
)));
1542 aRow
.push_back(makeAny(mysqlc_types
[i
].minScale
));
1543 aRow
.push_back(makeAny(mysqlc_types
[i
].maxScale
));
1544 aRow
.push_back(makeAny(sal_Int32(0)));
1545 aRow
.push_back(makeAny(sal_Int32(0)));
1546 aRow
.push_back(makeAny(sal_Int32(10)));
1548 rRows
.push_back(aRow
);
1552 lcl_setRows_throw(xResultSet
, 14, rRows
);
1558 /* {{{ ODatabaseMetaData::getCatalogs() -I- */
1559 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getCatalogs()
1560 throw(SQLException
, RuntimeException
)
1562 OSL_TRACE("ODatabaseMetaData::getCatalogs");
1564 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1565 std::vector
< std::vector
< Any
> > rRows
;
1568 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
1569 std::auto_ptr
< sql::ResultSet
> rset( meta
->getCatalogs());
1570 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
1571 sal_uInt32 columns
= rs_meta
->getColumnCount();
1572 while (rset
->next()) {
1573 std::vector
< Any
> aRow(1);
1574 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
1575 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(rset
->getString(i
), encoding
)));
1577 rRows
.push_back(aRow
);
1579 } catch (const sql::MethodNotImplementedException
&) {
1580 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getCatalogs", *this);
1581 } catch (const sql::InvalidArgumentException
&) {
1582 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getCatalogs", *this);
1583 } catch (const sql::SQLException
& e
) {
1584 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
1587 lcl_setRows_throw(xResultSet
, 0, rRows
);
1593 /* {{{ ODatabaseMetaData::getSchemas() -I- */
1594 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getSchemas()
1595 throw(SQLException
, RuntimeException
)
1597 OSL_TRACE("ODatabaseMetaData::getSchemas");
1599 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1600 std::vector
< std::vector
< Any
> > rRows
;
1603 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
1604 std::auto_ptr
< sql::ResultSet
> rset( meta
->getSchemas());
1605 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
1606 sal_uInt32 columns
= rs_meta
->getColumnCount();
1607 while (rset
->next()) {
1608 std::vector
< Any
> aRow(1);
1609 bool informationSchema
= false;
1610 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
1611 sql::SQLString columnStringValue
= rset
->getString(i
);
1612 if (i
== 1) { // TABLE_SCHEM
1613 informationSchema
= (0 == columnStringValue
.compare("information_schema"));
1615 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(columnStringValue
, encoding
)));
1617 if (!informationSchema
) {
1618 rRows
.push_back(aRow
);
1621 } catch (const sql::MethodNotImplementedException
&) {
1622 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getSchemas", *this);
1623 } catch (const sql::InvalidArgumentException
&) {
1624 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getSchemas", *this);
1625 } catch (const sql::SQLException
& e
) {
1626 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
1629 lcl_setRows_throw(xResultSet
, 1, rRows
);
1635 /* {{{ ODatabaseMetaData::getColumnPrivileges() -I- */
1636 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getColumnPrivileges(
1638 const OUString
& schema
,
1639 const OUString
& table
,
1640 const OUString
& columnNamePattern
)
1641 throw(SQLException
, RuntimeException
)
1643 OSL_TRACE("ODatabaseMetaData::getColumnPrivileges");
1644 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1645 std::vector
< std::vector
< Any
> > rRows
;
1647 std::string
cat(catalog
.hasValue()? OUStringToOString(getStringFromAny(catalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
1648 sch(OUStringToOString(schema
, m_rConnection
.getConnectionEncoding()).getStr()),
1649 tab(OUStringToOString(table
, m_rConnection
.getConnectionEncoding()).getStr()),
1650 cNamePattern(OUStringToOString(columnNamePattern
, m_rConnection
.getConnectionEncoding()).getStr());
1652 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
1653 std::auto_ptr
< sql::ResultSet
> rset( meta
->getColumnPrivileges(cat
, sch
, tab
, cNamePattern
.compare("")? cNamePattern
:wild
));
1655 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
1656 sal_uInt32 columns
= rs_meta
->getColumnCount();
1657 while (rset
->next()) {
1658 std::vector
< Any
> aRow(1);
1659 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
1660 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(rset
->getString(i
), encoding
)));
1662 rRows
.push_back(aRow
);
1664 } catch (const sql::MethodNotImplementedException
&) {
1665 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getColumnPrivileges", *this);
1666 } catch (const sql::InvalidArgumentException
&) {
1667 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getColumnPrivileges", *this);
1668 } catch (const sql::SQLException
& e
) {
1669 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
1672 lcl_setRows_throw(xResultSet
, 2, rRows
);
1678 /* {{{ ODatabaseMetaData::getColumns() -I- */
1679 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getColumns(
1681 const OUString
& schemaPattern
,
1682 const OUString
& tableNamePattern
,
1683 const OUString
& columnNamePattern
)
1684 throw(SQLException
, RuntimeException
)
1686 OSL_TRACE("ODatabaseMetaData::getColumns");
1687 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1688 std::vector
< std::vector
< Any
> > rRows
;
1689 std::string
cat(catalog
.hasValue()? OUStringToOString(getStringFromAny(catalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
1690 sPattern(OUStringToOString(schemaPattern
, m_rConnection
.getConnectionEncoding()).getStr()),
1691 tNamePattern(OUStringToOString(tableNamePattern
, m_rConnection
.getConnectionEncoding()).getStr()),
1692 cNamePattern(OUStringToOString(columnNamePattern
, m_rConnection
.getConnectionEncoding()).getStr());
1695 std::auto_ptr
< sql::ResultSet
> rset( meta
->getColumns(cat
,
1696 sPattern
.compare("")? sPattern
:wild
,
1697 tNamePattern
.compare("")? tNamePattern
:wild
,
1698 cNamePattern
.compare("")? cNamePattern
:wild
));
1699 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
1700 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
1701 sal_uInt32 columns
= rs_meta
->getColumnCount();
1702 while (rset
->next()) {
1703 std::vector
< Any
> aRow(1);
1704 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
1705 if (i
== 5) { // ColumnType
1706 sal_Int32 sdbc_type
= mysqlc_sdbc_driver::mysqlToOOOType(atoi(rset
->getString(i
).c_str()));
1707 aRow
.push_back(makeAny(sdbc_type
));
1709 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(rset
->getString(i
), encoding
)));
1712 rRows
.push_back(aRow
);
1714 } catch (const sql::MethodNotImplementedException
&) {
1715 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getColumns", *this);
1716 } catch (const sql::InvalidArgumentException
&) {
1717 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getColumns", *this);
1718 } catch (const sql::SQLException
& e
) {
1719 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
1721 lcl_setRows_throw(xResultSet
, 3, rRows
);
1727 /* {{{ ODatabaseMetaData::getTables() -I- */
1728 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getTables(
1730 const OUString
& schemaPattern
,
1731 const OUString
& tableNamePattern
,
1732 const Sequence
< OUString
>& types
)
1733 throw(SQLException
, RuntimeException
)
1735 OSL_TRACE("ODatabaseMetaData::getTables");
1736 sal_Int32 nLength
= types
.getLength();
1738 Reference
< XResultSet
> xResultSet(getOwnConnection().
1739 getDriver().getFactory()->createInstance(
1740 OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1741 std::vector
< std::vector
< Any
> > rRows
;
1743 std::string
cat(catalog
.hasValue()? OUStringToOString(getStringFromAny(catalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
1744 sPattern(OUStringToOString(schemaPattern
, m_rConnection
.getConnectionEncoding()).getStr()),
1745 tNamePattern(OUStringToOString(tableNamePattern
, m_rConnection
.getConnectionEncoding()).getStr());
1747 std::list
<sql::SQLString
> tabTypes
;
1748 for (const OUString
*pStart
= types
.getConstArray(), *p
= pStart
, *pEnd
= pStart
+ nLength
; p
!= pEnd
; ++p
) {
1749 tabTypes
.push_back(OUStringToOString(*p
, m_rConnection
.getConnectionEncoding()).getStr());
1753 std::auto_ptr
< sql::ResultSet
> rset( meta
->getTables(cat
,
1754 sPattern
.compare("")? sPattern
:wild
,
1755 tNamePattern
.compare("")? tNamePattern
:wild
,
1758 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
1759 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
1760 sal_uInt32 columns
= rs_meta
->getColumnCount();
1761 while (rset
->next()) {
1762 std::vector
< Any
> aRow(1);
1763 bool informationSchema
= false;
1764 for (sal_uInt32 i
= 1; (i
<= columns
) && !informationSchema
; ++i
) {
1765 sql::SQLString columnStringValue
= rset
->getString(i
);
1766 if (i
== 2) { // TABLE_SCHEM
1767 informationSchema
= ( 0 == columnStringValue
.compare("information_schema"));
1769 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(columnStringValue
, encoding
)));
1771 if (!informationSchema
) {
1772 rRows
.push_back(aRow
);
1775 } catch (const sql::MethodNotImplementedException
&) {
1776 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getTables", *this);
1777 } catch (const sql::InvalidArgumentException
&) {
1778 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getTables", *this);
1779 } catch (const sql::SQLException
& e
) {
1780 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
1783 lcl_setRows_throw(xResultSet
, 4, rRows
);
1789 /* {{{ ODatabaseMetaData::getProcedureColumns() -I- */
1790 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getProcedureColumns(
1791 const Any
& /* catalog */,
1792 const OUString
& /* schemaPattern */,
1793 const OUString
& /* procedureNamePattern */,
1794 const OUString
& /* columnNamePattern */)
1795 throw(SQLException
, RuntimeException
)
1797 OSL_TRACE("ODatabaseMetaData::getProcedureColumns");
1798 // Currently there is no information available
1804 /* {{{ ODatabaseMetaData::getProcedures() -I- */
1805 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getProcedures(
1807 const OUString
& schemaPattern
,
1808 const OUString
& procedureNamePattern
)
1809 throw(SQLException
, RuntimeException
)
1811 OSL_TRACE("ODatabaseMetaData::getProcedures");
1812 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1813 std::vector
< std::vector
< Any
> > rRows
;
1815 std::string
cat(catalog
.hasValue()? OUStringToOString(getStringFromAny(catalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
1816 sPattern(OUStringToOString(schemaPattern
, m_rConnection
.getConnectionEncoding()).getStr()),
1817 pNamePattern(OUStringToOString(procedureNamePattern
, m_rConnection
.getConnectionEncoding()).getStr());
1821 std::auto_ptr
< sql::ResultSet
> rset( meta
->getProcedures(cat
,
1822 sPattern
.compare("")? sPattern
:wild
,
1823 pNamePattern
.compare("")? pNamePattern
:wild
));
1825 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
1826 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
1827 sal_uInt32 columns
= rs_meta
->getColumnCount();
1828 while (rset
->next()) {
1829 std::vector
< Any
> aRow(1);
1830 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
1831 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(rset
->getString(i
), encoding
)));
1833 rRows
.push_back(aRow
);
1835 } catch (const sql::MethodNotImplementedException
&) {
1836 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getProcedures", *this);
1837 } catch (const sql::InvalidArgumentException
&) {
1838 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getProcedures", *this);
1839 } catch (const sql::SQLException
& e
) {
1840 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
1843 lcl_setRows_throw(xResultSet
, 7,rRows
);
1849 /* {{{ ODatabaseMetaData::getVersionColumns() -I- */
1850 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getVersionColumns(
1851 const Any
& /* catalog */,
1852 const OUString
& /* schema */,
1853 const OUString
& /* table */)
1854 throw(SQLException
, RuntimeException
)
1856 OSL_TRACE("ODatabaseMetaData::getVersionColumns");
1857 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1858 std::vector
< std::vector
< Any
> > rRows
;
1859 lcl_setRows_throw(xResultSet
, 16,rRows
);
1865 /* {{{ ODatabaseMetaData::getExportedKeys() -I- */
1866 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getExportedKeys(
1867 const Any
& catalog
,
1868 const OUString
& schema
,
1869 const OUString
& table
)
1870 throw(SQLException
, RuntimeException
)
1872 OSL_TRACE("ODatabaseMetaData::getExportedKeys");
1873 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1874 std::vector
< std::vector
< Any
> > rRows
;
1875 std::string
cat(catalog
.hasValue()? OUStringToOString(getStringFromAny(catalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
1876 sch(OUStringToOString(schema
, m_rConnection
.getConnectionEncoding()).getStr()),
1877 tab(OUStringToOString(table
, m_rConnection
.getConnectionEncoding()).getStr());
1880 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
1881 std::auto_ptr
< sql::ResultSet
> rset( meta
->getExportedKeys(cat
, sch
, tab
));
1882 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
1883 sal_uInt32 columns
= rs_meta
->getColumnCount();
1884 while (rset
->next()) {
1885 std::vector
< Any
> aRow(1);
1886 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
1887 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(rset
->getString(i
), encoding
)));
1889 rRows
.push_back(aRow
);
1891 } catch (const sql::MethodNotImplementedException
&) {
1892 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getExportedKeys", *this);
1893 } catch (const sql::InvalidArgumentException
&) {
1894 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getExportedKeys", *this);
1895 } catch (const sql::SQLException
& e
) {
1896 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
1899 lcl_setRows_throw(xResultSet
, 8, rRows
);
1905 /* {{{ ODatabaseMetaData::getImportedKeys() -I- */
1906 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getImportedKeys(
1908 const OUString
& schema
,
1909 const OUString
& table
)
1910 throw(SQLException
, RuntimeException
)
1912 OSL_TRACE("ODatabaseMetaData::getImportedKeys");
1914 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1915 std::vector
< std::vector
< Any
> > rRows
;
1917 std::string
cat(catalog
.hasValue()? OUStringToOString(getStringFromAny(catalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
1918 sch(OUStringToOString(schema
, m_rConnection
.getConnectionEncoding()).getStr()),
1919 tab(OUStringToOString(table
, m_rConnection
.getConnectionEncoding()).getStr());
1922 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
1923 std::auto_ptr
< sql::ResultSet
> rset( meta
->getImportedKeys(cat
, sch
, tab
));
1924 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
1925 sal_uInt32 columns
= rs_meta
->getColumnCount();
1926 while (rset
->next()) {
1927 std::vector
< Any
> aRow(1);
1928 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
1929 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(rset
->getString(i
), encoding
)));
1931 rRows
.push_back(aRow
);
1933 } catch (const sql::MethodNotImplementedException
&) {
1934 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getImportedKeys", *this);
1935 } catch (const sql::InvalidArgumentException
&) {
1936 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getImportedKeys", *this);
1937 } catch (const sql::SQLException
& e
) {
1938 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
1941 lcl_setRows_throw(xResultSet
,9,rRows
);
1947 /* {{{ ODatabaseMetaData::getPrimaryKeys() -I- */
1948 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getPrimaryKeys(
1950 const OUString
& schema
,
1951 const OUString
& table
)
1952 throw(SQLException
, RuntimeException
)
1954 OSL_TRACE("ODatabaseMetaData::getPrimaryKeys");
1955 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1956 std::vector
< std::vector
< Any
> > rRows
;
1958 std::string
cat(catalog
.hasValue()? OUStringToOString(getStringFromAny(catalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
1959 sch(OUStringToOString(schema
, m_rConnection
.getConnectionEncoding()).getStr()),
1960 tab(OUStringToOString(table
, m_rConnection
.getConnectionEncoding()).getStr());
1963 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
1964 std::auto_ptr
< sql::ResultSet
> rset( meta
->getPrimaryKeys(cat
, sch
, tab
));
1965 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
1966 sal_uInt32 columns
= rs_meta
->getColumnCount();
1967 while (rset
->next()) {
1968 std::vector
< Any
> aRow(1);
1969 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
1970 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(rset
->getString(i
), encoding
)));
1972 rRows
.push_back(aRow
);
1974 } catch (const sql::MethodNotImplementedException
&) {
1975 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getPrimaryKeys", *this);
1976 } catch (const sql::InvalidArgumentException
&) {
1977 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getPrimaryKeys", *this);
1978 } catch (const sql::SQLException
& e
) {
1979 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
1982 lcl_setRows_throw(xResultSet
, 10, rRows
);
1988 /* {{{ ODatabaseMetaData::getIndexInfo() -I- */
1989 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getIndexInfo(
1991 const OUString
& schema
,
1992 const OUString
& table
,
1994 sal_Bool approximate
)
1995 throw(SQLException
, RuntimeException
)
1997 OSL_TRACE("ODatabaseMetaData::getIndexInfo");
1998 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
1999 std::vector
< std::vector
< Any
> > rRows
;
2001 std::string
cat(catalog
.hasValue()? OUStringToOString(getStringFromAny(catalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
2002 sch(OUStringToOString(schema
, m_rConnection
.getConnectionEncoding()).getStr()),
2003 tab(OUStringToOString(table
, m_rConnection
.getConnectionEncoding()).getStr());
2006 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
2007 std::auto_ptr
< sql::ResultSet
> rset( meta
->getIndexInfo(cat
, sch
, tab
, unique
, approximate
));
2008 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
2009 sal_uInt32 columns
= rs_meta
->getColumnCount();
2010 while (rset
->next()) {
2011 std::vector
< Any
> aRow(1);
2012 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
2013 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(rset
->getString(i
), encoding
)));
2015 rRows
.push_back(aRow
);
2017 } catch (const sql::MethodNotImplementedException
&) {
2018 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getIndexInfo", *this);
2019 } catch (const sql::InvalidArgumentException
&) {
2020 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getIndexInfo", *this);
2021 } catch (const sql::SQLException
& e
) {
2022 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
2025 lcl_setRows_throw(xResultSet
, 11, rRows
);
2031 /* {{{ ODatabaseMetaData::getBestRowIdentifier() -I- */
2032 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getBestRowIdentifier(
2034 const OUString
& schema
,
2035 const OUString
& table
,
2038 throw(SQLException
, RuntimeException
)
2040 OSL_TRACE("ODatabaseMetaData::getBestRowIdentifier");
2041 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
2042 std::vector
< std::vector
< Any
> > rRows
;
2044 std::string
cat(catalog
.hasValue()? OUStringToOString(getStringFromAny(catalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
2045 sch(OUStringToOString(schema
, m_rConnection
.getConnectionEncoding()).getStr()),
2046 tab(OUStringToOString(table
, m_rConnection
.getConnectionEncoding()).getStr());
2049 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
2050 std::auto_ptr
< sql::ResultSet
> rset( meta
->getBestRowIdentifier(cat
, sch
, tab
, scope
, nullable
));
2051 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
2052 sal_uInt32 columns
= rs_meta
->getColumnCount();
2053 while (rset
->next()) {
2054 std::vector
< Any
> aRow(1);
2055 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
2056 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(rset
->getString(i
), encoding
)));
2058 rRows
.push_back(aRow
);
2060 } catch (const sql::MethodNotImplementedException
&) {
2061 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getBestRowIdentifier", *this);
2062 } catch (const sql::InvalidArgumentException
&) {
2063 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getBestRowIdentifier", *this);
2064 } catch (const sql::SQLException
& e
) {
2065 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
2068 lcl_setRows_throw(xResultSet
, 15, rRows
);
2074 /* {{{ ODatabaseMetaData::getTablePrivileges() -I- */
2075 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getTablePrivileges(
2077 const OUString
& schemaPattern
,
2078 const OUString
& tableNamePattern
)
2079 throw(SQLException
, RuntimeException
)
2081 OSL_TRACE("ODatabaseMetaData::getTablePrivileges");
2082 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
2083 std::vector
< std::vector
< Any
> > rRows
;
2085 std::string
cat(catalog
.hasValue()? OUStringToOString(getStringFromAny(catalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
2086 sPattern(OUStringToOString(schemaPattern
, m_rConnection
.getConnectionEncoding()).getStr()),
2087 tPattern(OUStringToOString(tableNamePattern
, m_rConnection
.getConnectionEncoding()).getStr());
2090 static bool fakeTablePrivileges
= false;
2091 if (fakeTablePrivileges
) {
2092 static const sal_Char
* allPrivileges
[] = {
2093 "ALTER", "DELETE", "DROP", "INDEX", "INSERT", "LOCK TABLES", "SELECT", "UPDATE"
2095 Any userName
; userName
<<= getUserName();
2096 for (size_t i
= 0; i
< SAL_N_ELEMENTS( allPrivileges
); ++i
) {
2097 std::vector
< Any
> aRow
;
2098 aRow
.push_back(makeAny( sal_Int32( i
) ));
2099 aRow
.push_back(catalog
); // TABLE_CAT
2100 aRow
.push_back(makeAny( schemaPattern
)); // TABLE_SCHEM
2101 aRow
.push_back(makeAny( tableNamePattern
)); // TABLE_NAME
2102 aRow
.push_back(Any()); // GRANTOR
2103 aRow
.push_back(userName
); // GRANTEE
2104 aRow
.push_back(makeAny( OUString::createFromAscii( allPrivileges
[i
] ) )); // PRIVILEGE
2105 aRow
.push_back(Any()); // IS_GRANTABLE
2107 rRows
.push_back(aRow
);
2110 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
2111 std::auto_ptr
< sql::ResultSet
> rset( meta
->getTablePrivileges(cat
, sPattern
.compare("")? sPattern
:wild
, tPattern
.compare("")? tPattern
:wild
));
2112 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
2113 sal_uInt32 columns
= rs_meta
->getColumnCount();
2114 while (rset
->next()) {
2115 std::vector
< Any
> aRow(1);
2116 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
2117 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(rset
->getString(i
), encoding
)));
2119 rRows
.push_back(aRow
);
2122 } catch (const sql::MethodNotImplementedException
&) {
2123 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getTablePrivileges", *this);
2124 } catch (const sql::InvalidArgumentException
&) {
2125 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getTablePrivileges", *this);
2126 } catch (const sql::SQLException
& e
) {
2127 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
2130 lcl_setRows_throw(xResultSet
,12,rRows
);
2136 /* {{{ ODatabaseMetaData::getCrossReference() -I- */
2137 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getCrossReference(
2138 const Any
& primaryCatalog
,
2139 const OUString
& primarySchema
,
2140 const OUString
& primaryTable
,
2141 const Any
& foreignCatalog
,
2142 const OUString
& foreignSchema
,
2143 const OUString
& foreignTable
)
2144 throw(SQLException
, RuntimeException
)
2146 OSL_TRACE("ODatabaseMetaData::getCrossReference");
2147 Reference
< XResultSet
> xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(OUString("org.openoffice.comp.helper.DatabaseMetaDataResultSet")),UNO_QUERY
);
2148 std::vector
< std::vector
< Any
> > rRows
;
2150 std::string
primaryCat(primaryCatalog
.hasValue()? OUStringToOString(getStringFromAny(primaryCatalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
2151 foreignCat(foreignCatalog
.hasValue()? OUStringToOString(getStringFromAny(foreignCatalog
), m_rConnection
.getConnectionEncoding()).getStr():""),
2152 pSchema(OUStringToOString(primarySchema
, m_rConnection
.getConnectionEncoding()).getStr()),
2153 pTable(OUStringToOString(primaryTable
, m_rConnection
.getConnectionEncoding()).getStr()),
2154 fSchema(OUStringToOString(foreignSchema
, m_rConnection
.getConnectionEncoding()).getStr()),
2155 fTable(OUStringToOString(foreignTable
, m_rConnection
.getConnectionEncoding()).getStr());
2158 rtl_TextEncoding encoding
= m_rConnection
.getConnectionEncoding();
2159 std::auto_ptr
< sql::ResultSet
> rset( meta
->getCrossReference(primaryCat
, pSchema
, pTable
, foreignCat
, fSchema
, fTable
));
2160 sql::ResultSetMetaData
* rs_meta
= rset
->getMetaData();
2161 sal_uInt32 columns
= rs_meta
->getColumnCount();
2162 while (rset
->next()) {
2163 std::vector
< Any
> aRow(1);
2164 for (sal_uInt32 i
= 1; i
<= columns
; i
++) {
2165 aRow
.push_back(makeAny(mysqlc_sdbc_driver::convert(rset
->getString(i
), encoding
)));
2167 rRows
.push_back(aRow
);
2169 } catch (const sql::MethodNotImplementedException
&) {
2170 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getCrossReference", *this);
2171 } catch (const sql::InvalidArgumentException
&) {
2172 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getCrossReference", *this);
2173 } catch (const sql::SQLException
& e
) {
2174 mysqlc_sdbc_driver::translateAndThrow(e
, *this, m_rConnection
.getConnectionEncoding());
2177 lcl_setRows_throw(xResultSet
,13,rRows
);
2183 /* {{{ ODatabaseMetaData::getUDTs() -I- */
2184 Reference
< XResultSet
> SAL_CALL
ODatabaseMetaData::getUDTs(
2185 const Any
& /* catalog */,
2186 const OUString
& /* schemaPattern */,
2187 const OUString
& /* typeNamePattern */,
2188 const Sequence
< sal_Int32
>& /* types */)
2189 throw(SQLException
, RuntimeException
)
2191 OSL_TRACE("ODatabaseMetaData::getUDTs");
2192 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getUDTs", *this);
2202 * vim600: noet sw=4 ts=4 fdm=marker
2203 * vim<600: noet sw=4 ts=4
2206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */