1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 #include "mysqlc_databasemetadata.hxx" 22 #include <com/sun/star/sdbc/DataType.hpp> 23 #include <com/sun/star/sdbc/ResultSetType.hpp> 24 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> 25 #include <com/sun/star/sdbc/TransactionIsolation.hpp> 26 #include <com/sun/star/sdbc/KeyRule.hpp> 27 #include <com/sun/star/sdbc/Deferrability.hpp> 28 #include <com/sun/star/sdbc/IndexType.hpp> 29 #include <com/sun/star/sdbc/BestRowScope.hpp> 30 #include <com/sun/star/sdbc/ColumnType.hpp> 31 #include <com/sun/star/lang/XInitialization.hpp> 32 33 34 #include "mysqlc_general.hxx" 35 #include "mysqlc_statement.hxx" 36 #include "mysqlc_driver.hxx" 37 #include "mysqlc_preparedstatement.hxx" 38 39 #include <stdio.h> 40 41 using namespace connectivity::mysqlc; 42 using namespace com::sun::star::uno; 43 using namespace com::sun::star::lang; 44 using namespace com::sun::star::beans; 45 using namespace com::sun::star::sdbc; 46 using ::rtl::OUString; 47 using mysqlc_sdbc_driver::getStringFromAny; 48 49 #include <preextstl.h> 50 #include <cppconn/connection.h> 51 #include <cppconn/resultset.h> 52 #include <cppconn/metadata.h> 53 #include <cppconn/statement.h> 54 #include <cppconn/prepared_statement.h> 55 #include <postextstl.h> 56 57 static ext_std::string wild("%"); 58 59 using ::rtl::OUStringToOString; 60 61 // ----------------------------------------------------------------------------- 62 void lcl_setRows_throw(const Reference< XResultSet >& _xResultSet,sal_Int32 _nType,const std::vector< std::vector< Any > >& _rRows) 63 { 64 Reference< XInitialization> xIni(_xResultSet,UNO_QUERY); 65 Sequence< Any > aArgs(2); 66 aArgs[0] <<= _nType; 67 68 Sequence< Sequence< Any > > aRows(_rRows.size()); 69 70 std::vector< std::vector< Any > >::const_iterator aIter = _rRows.begin(); 71 Sequence< Any > * pRowsIter = aRows.getArray(); 72 Sequence< Any > * pRowsEnd = pRowsIter + aRows.getLength(); 73 for (; pRowsIter != pRowsEnd;++pRowsIter,++aIter) { 74 if (!aIter->empty()) { 75 Sequence<Any> aSeq(&(*aIter->begin()),aIter->size()); 76 (*pRowsIter) = aSeq; 77 } 78 } 79 aArgs[1] <<= aRows; 80 xIni->initialize(aArgs); 81 } 82 83 84 /* {{{ ODatabaseMetaData::ODatabaseMetaData() -I- */ 85 ODatabaseMetaData::ODatabaseMetaData(OConnection& _rCon) 86 :m_rConnection(_rCon) 87 ,m_bUseCatalog(sal_True) 88 ,meta(_rCon.getConnectionSettings().cppConnection->getMetaData()) 89 ,identifier_quote_string_set(false) 90 { 91 OSL_TRACE("ODatabaseMetaData::ODatabaseMetaData"); 92 if (!m_rConnection.isCatalogUsed()) 93 { 94 osl_incrementInterlockedCount(&m_refCount); 95 m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable()); 96 osl_decrementInterlockedCount(&m_refCount); 97 } 98 } 99 /* }}} */ 100 101 102 /* {{{ ODatabaseMetaData::~ODatabaseMetaData() -I- */ 103 ODatabaseMetaData::~ODatabaseMetaData() 104 { 105 OSL_TRACE("ODatabaseMetaData::~ODatabaseMetaData"); 106 } 107 /* }}} */ 108 109 110 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */ 111 OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, const ext_std::string& (sql::DatabaseMetaData::*_Method)() ) 112 { 113 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName); 114 OUString stringMetaData; 115 try { 116 stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding()); 117 } catch (sql::MethodNotImplementedException) { 118 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this); 119 } catch (sql::InvalidArgumentException) { 120 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this); 121 } catch (const sql::SQLException& e) { 122 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 123 } 124 return stringMetaData; 125 } 126 /* }}} */ 127 128 129 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */ 130 OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, ext_std::string (sql::DatabaseMetaData::*_Method)() ) 131 { 132 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName); 133 OUString stringMetaData; 134 try { 135 stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding()); 136 } catch (sql::MethodNotImplementedException) { 137 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this); 138 } catch (sql::InvalidArgumentException) { 139 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this); 140 } catch (const sql::SQLException& e) { 141 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 142 } 143 return stringMetaData; 144 } 145 /* }}} */ 146 147 148 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */ 149 OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, const sql::SQLString& (sql::DatabaseMetaData::*_Method)() ) 150 { 151 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName); 152 OUString stringMetaData; 153 try { 154 stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding()); 155 } catch (sql::MethodNotImplementedException) { 156 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this); 157 } catch (sql::InvalidArgumentException) { 158 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this); 159 } catch (const sql::SQLException& e) { 160 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 161 } 162 return stringMetaData; 163 } 164 /* }}} */ 165 166 167 /* {{{ ODatabaseMetaData::impl_getStringMetaData() -I- */ 168 OUString ODatabaseMetaData::impl_getStringMetaData(const sal_Char* _methodName, sql::SQLString (sql::DatabaseMetaData::*_Method)() ) 169 { 170 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName); 171 OUString stringMetaData; 172 try { 173 stringMetaData = mysqlc_sdbc_driver::convert((meta->*_Method)(), m_rConnection.getConnectionEncoding()); 174 } catch (sql::MethodNotImplementedException) { 175 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this); 176 } catch (sql::InvalidArgumentException) { 177 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this); 178 } catch (const sql::SQLException& e) { 179 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 180 } 181 return stringMetaData; 182 } 183 /* }}} */ 184 185 186 /* {{{ ODatabaseMetaData::impl_getInt32MetaData() -I- */ 187 sal_Int32 ODatabaseMetaData::impl_getInt32MetaData(const sal_Char* _methodName, unsigned int (sql::DatabaseMetaData::*_Method)() ) 188 { 189 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName); 190 sal_Int32 int32MetaData(0); 191 try { 192 int32MetaData = (meta->*_Method)(); 193 } catch (sql::MethodNotImplementedException) { 194 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this); 195 } catch (sql::InvalidArgumentException) { 196 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this); 197 } catch (const sql::SQLException& e) { 198 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 199 } 200 return int32MetaData; 201 } 202 /* }}} */ 203 204 205 /* {{{ ODatabaseMetaData::impl_getBoolMetaData() -I- */ 206 sal_Bool ODatabaseMetaData::impl_getBoolMetaData(const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)() ) 207 { 208 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName); 209 sal_Bool boolMetaData(0); 210 try { 211 boolMetaData = (meta->*_Method)() ? sal_True : sal_False; 212 } catch (sql::MethodNotImplementedException) { 213 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this); 214 } catch (sql::InvalidArgumentException) { 215 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this); 216 } catch (const sql::SQLException& e) { 217 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 218 } 219 return boolMetaData; 220 } 221 /* }}} */ 222 223 224 /* {{{ ODatabaseMetaData::impl_getBoolMetaData() -I- */ 225 sal_Bool ODatabaseMetaData::impl_getBoolMetaData(const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)(int), sal_Int32 _arg ) 226 { 227 OSL_TRACE( "mysqlc::ODatabaseMetaData::%s", _methodName); 228 sal_Bool boolMetaData(0); 229 try { 230 boolMetaData = (meta->*_Method)( _arg ) ? sal_True : sal_False; 231 } catch (sql::MethodNotImplementedException) { 232 mysqlc_sdbc_driver::throwFeatureNotImplementedException(_methodName, *this); 233 } catch (sql::InvalidArgumentException) { 234 mysqlc_sdbc_driver::throwInvalidArgumentException(_methodName, *this); 235 } catch (const sql::SQLException& e) { 236 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 237 } 238 return boolMetaData; 239 } 240 /* }}} */ 241 242 243 /* {{{ ODatabaseMetaData::impl_getRSTypeMetaData() -I- */ 244 sal_Bool ODatabaseMetaData::impl_getRSTypeMetaData(const sal_Char* _methodName, bool (sql::DatabaseMetaData::*_Method)(int), sal_Int32 _resultSetType ) 245 { 246 int resultSetType(sql::ResultSet::TYPE_FORWARD_ONLY); 247 switch ( _resultSetType ) { 248 case ResultSetType::SCROLL_INSENSITIVE: resultSetType = sql::ResultSet::TYPE_SCROLL_INSENSITIVE; break; 249 case ResultSetType::SCROLL_SENSITIVE: resultSetType = sql::ResultSet::TYPE_SCROLL_SENSITIVE; break; 250 } 251 252 return impl_getBoolMetaData(_methodName, _Method, resultSetType); 253 } 254 /* }}} */ 255 256 257 /* {{{ ODatabaseMetaData::getCatalogSeparator() -I- */ 258 OUString SAL_CALL ODatabaseMetaData::getCatalogSeparator() 259 throw(SQLException, RuntimeException) 260 { 261 return impl_getStringMetaData("getCatalogSeparator", &sql::DatabaseMetaData::getCatalogSeparator); 262 } 263 /* }}} */ 264 265 266 /* {{{ ODatabaseMetaData::getMaxBinaryLiteralLength() -I- */ 267 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength() 268 throw(SQLException, RuntimeException) 269 { 270 return impl_getInt32MetaData("getMaxBinaryLiteralLength", &sql::DatabaseMetaData::getMaxBinaryLiteralLength); 271 } 272 /* }}} */ 273 274 275 /* {{{ ODatabaseMetaData::getMaxRowSize() -I- */ 276 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize() 277 throw(SQLException, RuntimeException) 278 { 279 return impl_getInt32MetaData("getMaxRowSize", &sql::DatabaseMetaData::getMaxRowSize); 280 } 281 /* }}} */ 282 283 284 /* {{{ ODatabaseMetaData::getMaxCatalogNameLength() -I- */ 285 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength() 286 throw(SQLException, RuntimeException) 287 { 288 return impl_getInt32MetaData("getMaxCatalogNameLength", &sql::DatabaseMetaData::getMaxCatalogNameLength); 289 } 290 /* }}} */ 291 292 293 /* {{{ ODatabaseMetaData::getMaxCharLiteralLength() -I- */ 294 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength() 295 throw(SQLException, RuntimeException) 296 { 297 return impl_getInt32MetaData("getMaxCharLiteralLength", &sql::DatabaseMetaData::getMaxCharLiteralLength); 298 } 299 /* }}} */ 300 301 302 /* {{{ ODatabaseMetaData::getMaxColumnNameLength() -I- */ 303 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength() 304 throw(SQLException, RuntimeException) 305 { 306 return impl_getInt32MetaData("getMaxColumnNameLength", &sql::DatabaseMetaData::getMaxColumnNameLength); 307 } 308 /* }}} */ 309 310 311 /* {{{ ODatabaseMetaData::getMaxColumnsInIndex() -I- */ 312 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex() 313 throw(SQLException, RuntimeException) 314 { 315 return impl_getInt32MetaData("getMaxColumnsInIndex", &sql::DatabaseMetaData::getMaxColumnsInIndex); 316 } 317 /* }}} */ 318 319 320 /* {{{ ODatabaseMetaData::getMaxCursorNameLength() -I- */ 321 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength() 322 throw(SQLException, RuntimeException) 323 { 324 return impl_getInt32MetaData("getMaxCursorNameLength", &sql::DatabaseMetaData::getMaxCursorNameLength); 325 } 326 /* }}} */ 327 328 329 /* {{{ ODatabaseMetaData::getMaxConnections() -I- */ 330 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections() 331 throw(SQLException, RuntimeException) 332 { 333 return impl_getInt32MetaData("getMaxConnections", &sql::DatabaseMetaData::getMaxConnections); 334 } 335 /* }}} */ 336 337 338 /* {{{ ODatabaseMetaData::getMaxColumnsInTable() -I- */ 339 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable() 340 throw(SQLException, RuntimeException) 341 { 342 return impl_getInt32MetaData("getMaxColumnsInTable", &sql::DatabaseMetaData::getMaxColumnsInTable); 343 } 344 /* }}} */ 345 346 347 /* {{{ ODatabaseMetaData::getMaxStatementLength() -I- */ 348 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength() 349 throw(SQLException, RuntimeException) 350 { 351 return impl_getInt32MetaData("getMaxStatementLength", &sql::DatabaseMetaData::getMaxStatementLength); 352 } 353 /* }}} */ 354 355 356 /* {{{ ODatabaseMetaData::getMaxTableNameLength() -I- */ 357 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength() 358 throw(SQLException, RuntimeException) 359 { 360 return impl_getInt32MetaData("getMaxTableNameLength", &sql::DatabaseMetaData::getMaxTableNameLength); 361 } 362 /* }}} */ 363 364 /* {{{ ODatabaseMetaData::getMaxTablesInSelect() -I- */ 365 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect() 366 throw(SQLException, RuntimeException) 367 { 368 return impl_getInt32MetaData("getMaxTablesInSelect", &sql::DatabaseMetaData::getMaxTablesInSelect); 369 } 370 /* }}} */ 371 372 373 /* {{{ ODatabaseMetaData::doesMaxRowSizeIncludeBlobs() -I- */ 374 sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs() 375 throw(SQLException, RuntimeException) 376 { 377 return impl_getBoolMetaData("doesMaxRowSizeIncludeBlobs", &sql::DatabaseMetaData::doesMaxRowSizeIncludeBlobs); 378 } 379 /* }}} */ 380 381 382 /* {{{ ODatabaseMetaData::storesLowerCaseQuotedIdentifiers() -I- */ 383 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers() 384 throw(SQLException, RuntimeException) 385 { 386 return impl_getBoolMetaData("storesLowerCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesLowerCaseQuotedIdentifiers); 387 } 388 /* }}} */ 389 390 391 /* {{{ ODatabaseMetaData::storesLowerCaseIdentifiers() -I- */ 392 sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers() 393 throw(SQLException, RuntimeException) 394 { 395 return impl_getBoolMetaData("storesLowerCaseIdentifiers", &sql::DatabaseMetaData::storesLowerCaseIdentifiers); 396 } 397 /* }}} */ 398 399 400 /* {{{ ODatabaseMetaData::storesMixedCaseQuotedIdentifiers() -I- */ 401 sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseQuotedIdentifiers() 402 throw(SQLException, RuntimeException) 403 { 404 return impl_getBoolMetaData("storesMixedCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesMixedCaseQuotedIdentifiers); 405 } 406 /* }}} */ 407 408 409 /* {{{ ODatabaseMetaData::storesMixedCaseIdentifiers() -I- */ 410 sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers() 411 throw(SQLException, RuntimeException) 412 { 413 return impl_getBoolMetaData("storesMixedCaseIdentifiers", &sql::DatabaseMetaData::storesMixedCaseIdentifiers); 414 } 415 /* }}} */ 416 417 418 /* {{{ ODatabaseMetaData::storesUpperCaseQuotedIdentifiers() -I- */ 419 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers() 420 throw(SQLException, RuntimeException) 421 { 422 return impl_getBoolMetaData("storesUpperCaseQuotedIdentifiers", &sql::DatabaseMetaData::storesUpperCaseQuotedIdentifiers); 423 } 424 /* }}} */ 425 426 427 /* {{{ ODatabaseMetaData::storesUpperCaseIdentifiers() -I- */ 428 sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers() 429 throw(SQLException, RuntimeException) 430 { 431 return impl_getBoolMetaData("storesUpperCaseIdentifiers", &sql::DatabaseMetaData::storesUpperCaseIdentifiers); 432 } 433 /* }}} */ 434 435 436 /* {{{ ODatabaseMetaData::supportsAlterTableWithAddColumn() -I- */ 437 sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithAddColumn() 438 throw(SQLException, RuntimeException) 439 { 440 return impl_getBoolMetaData("supportsAlterTableWithAddColumn", &sql::DatabaseMetaData::supportsAlterTableWithAddColumn); 441 } 442 /* }}} */ 443 444 445 /* {{{ ODatabaseMetaData::supportsAlterTableWithDropColumn() -I- */ 446 sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithDropColumn() 447 throw(SQLException, RuntimeException) 448 { 449 return impl_getBoolMetaData("supportsAlterTableWithDropColumn", &sql::DatabaseMetaData::supportsAlterTableWithDropColumn); 450 } 451 /* }}} */ 452 453 454 /* {{{ ODatabaseMetaData::getMaxIndexLength() -I- */ 455 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength() 456 throw(SQLException, RuntimeException) 457 { 458 return impl_getInt32MetaData("getMaxIndexLength", &sql::DatabaseMetaData::getMaxIndexLength); 459 } 460 /* }}} */ 461 462 463 /* {{{ ODatabaseMetaData::supportsNonNullableColumns() -I- */ 464 sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns() 465 throw(SQLException, RuntimeException) 466 { 467 return impl_getBoolMetaData("supportsNonNullableColumns", &sql::DatabaseMetaData::supportsNonNullableColumns); 468 } 469 /* }}} */ 470 471 472 /* {{{ ODatabaseMetaData::getCatalogTerm() -I- */ 473 OUString SAL_CALL ODatabaseMetaData::getCatalogTerm() 474 throw(SQLException, RuntimeException) 475 { 476 return impl_getStringMetaData("getCatalogTerm", &sql::DatabaseMetaData::getCatalogTerm); 477 } 478 /* }}} */ 479 480 481 /* {{{ ODatabaseMetaData::getIdentifierQuoteString() -I- */ 482 OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString() 483 throw(SQLException, RuntimeException) 484 { 485 if (identifier_quote_string_set == false) { 486 identifier_quote_string = impl_getStringMetaData("getIdentifierQuoteString", &sql::DatabaseMetaData::getIdentifierQuoteString); 487 identifier_quote_string_set = true; 488 } 489 return identifier_quote_string; 490 } 491 /* }}} */ 492 493 494 /* {{{ ODatabaseMetaData::getExtraNameCharacters() -I- */ 495 OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters() 496 throw(SQLException, RuntimeException) 497 { 498 return impl_getStringMetaData("getExtraNameCharacters", &sql::DatabaseMetaData::getExtraNameCharacters); 499 } 500 /* }}} */ 501 502 503 /* {{{ ODatabaseMetaData::supportsDifferentTableCorrelationNames() -I- */ 504 sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames() 505 throw(SQLException, RuntimeException) 506 { 507 return impl_getBoolMetaData("supportsDifferentTableCorrelationNames", &sql::DatabaseMetaData::supportsDifferentTableCorrelationNames); 508 } 509 /* }}} */ 510 511 512 /* {{{ ODatabaseMetaData::isCatalogAtStart() -I- */ 513 sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart() 514 throw(SQLException, RuntimeException) 515 { 516 return impl_getBoolMetaData("isCatalogAtStart", &sql::DatabaseMetaData::isCatalogAtStart); 517 } 518 /* }}} */ 519 520 521 /* {{{ ODatabaseMetaData::dataDefinitionIgnoredInTransactions() -I- */ 522 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions() 523 throw(SQLException, RuntimeException) 524 { 525 return impl_getBoolMetaData("dataDefinitionIgnoredInTransactions", &sql::DatabaseMetaData::dataDefinitionIgnoredInTransactions); 526 } 527 /* }}} */ 528 529 530 /* {{{ ODatabaseMetaData::dataDefinitionCausesTransactionCommit() -I- */ 531 sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit() 532 throw(SQLException, RuntimeException) 533 { 534 return impl_getBoolMetaData("dataDefinitionCausesTransactionCommit", &sql::DatabaseMetaData::dataDefinitionCausesTransactionCommit); 535 } 536 /* }}} */ 537 538 539 /* {{{ ODatabaseMetaData::supportsDataManipulationTransactionsOnly() -I- */ 540 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly() 541 throw(SQLException, RuntimeException) 542 { 543 return impl_getBoolMetaData("supportsDataManipulationTransactionsOnly", &sql::DatabaseMetaData::supportsDataManipulationTransactionsOnly); 544 } 545 /* }}} */ 546 547 548 /* {{{ ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions() -I- */ 549 sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions() 550 throw(SQLException, RuntimeException) 551 { 552 return impl_getBoolMetaData("supportsDataDefinitionAndDataManipulationTransactions", &sql::DatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions); 553 } 554 /* }}} */ 555 556 557 /* {{{ ODatabaseMetaData::supportsPositionedDelete() -I- */ 558 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete() 559 throw(SQLException, RuntimeException) 560 { 561 return impl_getBoolMetaData("supportsPositionedDelete", &sql::DatabaseMetaData::supportsPositionedDelete); 562 } 563 /* }}} */ 564 565 566 /* {{{ ODatabaseMetaData::supportsPositionedUpdate() -I- */ 567 sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate() 568 throw(SQLException, RuntimeException) 569 { 570 return impl_getBoolMetaData("supportsPositionedUpdate", &sql::DatabaseMetaData::supportsPositionedUpdate); 571 } 572 /* }}} */ 573 574 575 /* {{{ ODatabaseMetaData::supportsOpenStatementsAcrossRollback() -I- */ 576 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback() 577 throw(SQLException, RuntimeException) 578 { 579 return impl_getBoolMetaData("supportsOpenStatementsAcrossRollback", &sql::DatabaseMetaData::supportsOpenStatementsAcrossRollback); 580 } 581 /* }}} */ 582 583 584 /* {{{ ODatabaseMetaData::supportsOpenStatementsAcrossCommit() -I- */ 585 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit() 586 throw(SQLException, RuntimeException) 587 { 588 return impl_getBoolMetaData("supportsOpenStatementsAcrossCommit", &sql::DatabaseMetaData::supportsOpenStatementsAcrossCommit); 589 } 590 /* }}} */ 591 592 593 /* {{{ ODatabaseMetaData::supportsOpenCursorsAcrossCommit() -I- */ 594 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit() 595 throw(SQLException, RuntimeException) 596 { 597 return impl_getBoolMetaData("supportsOpenCursorsAcrossCommit", &sql::DatabaseMetaData::supportsOpenCursorsAcrossCommit); 598 } 599 /* }}} */ 600 601 602 /* {{{ ODatabaseMetaData::supportsOpenCursorsAcrossRollback() -I- */ 603 sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback() 604 throw(SQLException, RuntimeException) 605 { 606 return impl_getBoolMetaData("supportsOpenCursorsAcrossRollback", &sql::DatabaseMetaData::supportsOpenCursorsAcrossRollback); 607 } 608 /* }}} */ 609 610 611 /* {{{ ODatabaseMetaData::supportsTransactionIsolationLevel() -I- */ 612 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel(sal_Int32 level) 613 throw(SQLException, RuntimeException) 614 { 615 return impl_getBoolMetaData("supportsTransactionIsolationLevel", &sql::DatabaseMetaData::supportsTransactionIsolationLevel, level); 616 } 617 /* }}} */ 618 619 620 /* {{{ ODatabaseMetaData::supportsSchemasInDataManipulation() -I- */ 621 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation() 622 throw(SQLException, RuntimeException) 623 { 624 return impl_getBoolMetaData("supportsSchemasInDataManipulation", &sql::DatabaseMetaData::supportsSchemasInDataManipulation); 625 } 626 /* }}} */ 627 628 629 /* {{{ ODatabaseMetaData::supportsANSI92FullSQL() -I- */ 630 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL() 631 throw(SQLException, RuntimeException) 632 { 633 return impl_getBoolMetaData("supportsANSI92FullSQL", &sql::DatabaseMetaData::supportsANSI92FullSQL); 634 } 635 /* }}} */ 636 637 638 /* {{{ ODatabaseMetaData::supportsANSI92EntryLevelSQL() -I- */ 639 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL() 640 throw(SQLException, RuntimeException) 641 { 642 return impl_getBoolMetaData("supportsANSI92EntryLevelSQL", &sql::DatabaseMetaData::supportsANSI92EntryLevelSQL); 643 } 644 /* }}} */ 645 646 647 /* {{{ ODatabaseMetaData::supportsIntegrityEnhancementFacility() -I- */ 648 sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility() 649 throw(SQLException, RuntimeException) 650 { 651 return impl_getBoolMetaData("supportsIntegrityEnhancementFacility", &sql::DatabaseMetaData::supportsIntegrityEnhancementFacility); 652 } 653 /* }}} */ 654 655 656 /* {{{ ODatabaseMetaData::supportsSchemasInIndexDefinitions() -I- */ 657 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions() 658 throw(SQLException, RuntimeException) 659 { 660 return impl_getBoolMetaData("supportsSchemasInIndexDefinitions", &sql::DatabaseMetaData::supportsSchemasInIndexDefinitions); 661 } 662 /* }}} */ 663 664 665 /* {{{ ODatabaseMetaData::supportsSchemasInTableDefinitions() -I- */ 666 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions() 667 throw(SQLException, RuntimeException) 668 { 669 return impl_getBoolMetaData("supportsSchemasInTableDefinitions", &sql::DatabaseMetaData::supportsSchemasInTableDefinitions); 670 } 671 /* }}} */ 672 673 674 /* {{{ ODatabaseMetaData::supportsCatalogsInTableDefinitions() -I- */ 675 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInTableDefinitions() 676 throw(SQLException, RuntimeException) 677 { 678 return impl_getBoolMetaData("supportsCatalogsInTableDefinitions", &sql::DatabaseMetaData::supportsCatalogsInTableDefinitions); 679 } 680 /* }}} */ 681 682 683 /* {{{ ODatabaseMetaData::supportsCatalogsInIndexDefinitions() -I- */ 684 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions() 685 throw(SQLException, RuntimeException) 686 { 687 return impl_getBoolMetaData("supportsCatalogsInIndexDefinitions", &sql::DatabaseMetaData::supportsCatalogsInIndexDefinitions); 688 } 689 /* }}} */ 690 691 692 /* {{{ ODatabaseMetaData::supportsCatalogsInDataManipulation() -I- */ 693 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation() 694 throw(SQLException, RuntimeException) 695 { 696 return impl_getBoolMetaData("supportsCatalogsInDataManipulation", &sql::DatabaseMetaData::supportsCatalogsInDataManipulation); 697 } 698 /* }}} */ 699 700 701 /* {{{ ODatabaseMetaData::supportsOuterJoins() -I- */ 702 sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins() 703 throw(SQLException, RuntimeException) 704 { 705 return impl_getBoolMetaData("supportsOuterJoins", &sql::DatabaseMetaData::supportsOuterJoins); 706 } 707 /* }}} */ 708 709 710 /* {{{ ODatabaseMetaData::getMaxStatements() -I- */ 711 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements() 712 throw(SQLException, RuntimeException) 713 { 714 return impl_getInt32MetaData("getMaxStatements", &sql::DatabaseMetaData::getMaxStatements); 715 } 716 /* }}} */ 717 718 719 /* {{{ ODatabaseMetaData::getMaxProcedureNameLength() -I- */ 720 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength() 721 throw(SQLException, RuntimeException) 722 { 723 return impl_getInt32MetaData("getMaxProcedureNameLength", &sql::DatabaseMetaData::getMaxProcedureNameLength); 724 } 725 /* }}} */ 726 727 728 /* {{{ ODatabaseMetaData::getMaxSchemaNameLength() -I- */ 729 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength() 730 throw(SQLException, RuntimeException) 731 { 732 return impl_getInt32MetaData("getMaxSchemaNameLength", &sql::DatabaseMetaData::getMaxSchemaNameLength); 733 } 734 /* }}} */ 735 736 737 /* {{{ ODatabaseMetaData::supportsTransactions() -I- */ 738 sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions() 739 throw(SQLException, RuntimeException) 740 { 741 return impl_getBoolMetaData("supportsTransactions", &sql::DatabaseMetaData::supportsTransactions); 742 } 743 /* }}} */ 744 745 746 /* {{{ ODatabaseMetaData::allProceduresAreCallable() -I- */ 747 sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable() 748 throw(SQLException, RuntimeException) 749 { 750 return impl_getBoolMetaData("allProceduresAreCallable", &sql::DatabaseMetaData::allProceduresAreCallable); 751 } 752 /* }}} */ 753 754 755 /* {{{ ODatabaseMetaData::supportsStoredProcedures() -I- */ 756 sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures() 757 throw(SQLException, RuntimeException) 758 { 759 return impl_getBoolMetaData("supportsStoredProcedures", &sql::DatabaseMetaData::supportsStoredProcedures); 760 } 761 /* }}} */ 762 763 764 /* {{{ ODatabaseMetaData::supportsSelectForUpdate() -I- */ 765 sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate() 766 throw(SQLException, RuntimeException) 767 { 768 return impl_getBoolMetaData("supportsSelectForUpdate", &sql::DatabaseMetaData::supportsSelectForUpdate); 769 } 770 /* }}} */ 771 772 773 /* {{{ ODatabaseMetaData::allTablesAreSelectable() -I- */ 774 sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable() 775 throw(SQLException, RuntimeException) 776 { 777 return impl_getBoolMetaData("allTablesAreSelectable", &sql::DatabaseMetaData::allTablesAreSelectable); 778 } 779 /* }}} */ 780 781 782 /* {{{ ODatabaseMetaData::isReadOnly() -I- */ 783 sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly() 784 throw(SQLException, RuntimeException) 785 { 786 return impl_getBoolMetaData("isReadOnly", &sql::DatabaseMetaData::isReadOnly); 787 } 788 /* }}} */ 789 790 791 /* {{{ ODatabaseMetaData::usesLocalFiles() -I- */ 792 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles() 793 throw(SQLException, RuntimeException) 794 { 795 return impl_getBoolMetaData("usesLocalFiles", &sql::DatabaseMetaData::usesLocalFiles); 796 } 797 /* }}} */ 798 799 800 /* {{{ ODatabaseMetaData::usesLocalFilePerTable() -I- */ 801 sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable() 802 throw(SQLException, RuntimeException) 803 { 804 return impl_getBoolMetaData("usesLocalFilePerTable", &sql::DatabaseMetaData::usesLocalFilePerTable); 805 } 806 /* }}} */ 807 808 809 /* {{{ ODatabaseMetaData::supportsTypeConversion() -I- */ 810 sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion() 811 throw(SQLException, RuntimeException) 812 { 813 return impl_getBoolMetaData("supportsTypeConversion", &sql::DatabaseMetaData::supportsTypeConversion); 814 } 815 /* }}} */ 816 817 818 /* {{{ ODatabaseMetaData::nullPlusNonNullIsNull() -I- */ 819 sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull() 820 throw(SQLException, RuntimeException) 821 { 822 return impl_getBoolMetaData("nullPlusNonNullIsNull", &sql::DatabaseMetaData::nullPlusNonNullIsNull); 823 } 824 /* }}} */ 825 826 827 /* {{{ ODatabaseMetaData::supportsColumnAliasing() -I- */ 828 sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing() 829 throw(SQLException, RuntimeException) 830 { 831 return impl_getBoolMetaData("supportsColumnAliasing", &sql::DatabaseMetaData::supportsColumnAliasing); 832 } 833 /* }}} */ 834 835 836 /* {{{ ODatabaseMetaData::supportsTableCorrelationNames() -I- */ 837 sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames() 838 throw(SQLException, RuntimeException) 839 { 840 return impl_getBoolMetaData("supportsTableCorrelationNames", &sql::DatabaseMetaData::supportsTableCorrelationNames); 841 } 842 /* }}} */ 843 844 845 /* {{{ ODatabaseMetaData::supportsConvert() -I- */ 846 sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert(sal_Int32 /* fromType */, sal_Int32 /* toType */) 847 throw(SQLException, RuntimeException) 848 { 849 OSL_TRACE("ODatabaseMetaData::supportsConvert"); 850 try { 851 /* ToDo -> use supportsConvert( fromType, toType) */ 852 return meta->supportsConvert()? sal_True:sal_False; 853 } catch (sql::MethodNotImplementedException) { 854 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::supportsConvert", *this); 855 } catch (sql::InvalidArgumentException) { 856 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::supportsConvert", *this); 857 } catch (const sql::SQLException& e) { 858 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 859 } 860 return sal_False; 861 } 862 /* }}} */ 863 864 865 /* {{{ ODatabaseMetaData::supportsExpressionsInOrderBy() -I- */ 866 sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy() 867 throw(SQLException, RuntimeException) 868 { 869 return impl_getBoolMetaData("supportsExpressionsInOrderBy", &sql::DatabaseMetaData::supportsExpressionsInOrderBy); 870 } 871 /* }}} */ 872 873 874 /* {{{ ODatabaseMetaData::supportsGroupBy() -I- */ 875 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy() 876 throw(SQLException, RuntimeException) 877 { 878 return impl_getBoolMetaData("supportsGroupBy", &sql::DatabaseMetaData::supportsGroupBy); 879 } 880 /* }}} */ 881 882 883 /* {{{ ODatabaseMetaData::supportsGroupByBeyondSelect() -I- */ 884 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect() 885 throw(SQLException, RuntimeException) 886 { 887 return impl_getBoolMetaData("supportsGroupByBeyondSelect", &sql::DatabaseMetaData::supportsGroupByBeyondSelect); 888 } 889 /* }}} */ 890 891 892 /* {{{ ODatabaseMetaData::supportsGroupByUnrelated() -I- */ 893 sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated() 894 throw(SQLException, RuntimeException) 895 { 896 return impl_getBoolMetaData("supportsGroupByUnrelated", &sql::DatabaseMetaData::supportsGroupByUnrelated); 897 } 898 /* }}} */ 899 900 901 /* {{{ ODatabaseMetaData::supportsMultipleTransactions() -I- */ 902 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions() 903 throw(SQLException, RuntimeException) 904 { 905 return impl_getBoolMetaData("supportsMultipleTransactions", &sql::DatabaseMetaData::supportsMultipleTransactions); 906 } 907 /* }}} */ 908 909 910 /* {{{ ODatabaseMetaData::supportsMultipleResultSets() -I- */ 911 sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets() 912 throw(SQLException, RuntimeException) 913 { 914 return impl_getBoolMetaData("supportsMultipleResultSets", &sql::DatabaseMetaData::supportsMultipleResultSets); 915 } 916 /* }}} */ 917 918 919 /* {{{ ODatabaseMetaData::supportsLikeEscapeClause() -I- */ 920 sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause() 921 throw(SQLException, RuntimeException) 922 { 923 return impl_getBoolMetaData("supportsLikeEscapeClause", &sql::DatabaseMetaData::supportsLikeEscapeClause); 924 } 925 /* }}} */ 926 927 928 /* {{{ ODatabaseMetaData::supportsOrderByUnrelated() -I- */ 929 sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated() 930 throw(SQLException, RuntimeException) 931 { 932 return impl_getBoolMetaData("supportsOrderByUnrelated", &sql::DatabaseMetaData::supportsOrderByUnrelated); 933 } 934 /* }}} */ 935 936 937 /* {{{ ODatabaseMetaData::supportsUnion() -I- */ 938 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion() 939 throw(SQLException, RuntimeException) 940 { 941 return impl_getBoolMetaData("supportsUnion", &sql::DatabaseMetaData::supportsUnion); 942 } 943 /* }}} */ 944 945 946 /* {{{ ODatabaseMetaData::supportsUnionAll() -I- */ 947 sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll() 948 throw(SQLException, RuntimeException) 949 { 950 return impl_getBoolMetaData("supportsUnionAll", &sql::DatabaseMetaData::supportsUnionAll); 951 } 952 /* }}} */ 953 954 955 /* {{{ ODatabaseMetaData::supportsMixedCaseIdentifiers() -I- */ 956 sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers() 957 throw(SQLException, RuntimeException) 958 { 959 return impl_getBoolMetaData("supportsMixedCaseIdentifiers", &sql::DatabaseMetaData::supportsMixedCaseIdentifiers); 960 } 961 /* }}} */ 962 963 964 /* {{{ ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers() -I- */ 965 sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers() 966 throw(SQLException, RuntimeException) 967 { 968 return impl_getBoolMetaData("supportsMixedCaseQuotedIdentifiers", &sql::DatabaseMetaData::supportsMixedCaseQuotedIdentifiers); 969 } 970 /* }}} */ 971 972 973 /* {{{ ODatabaseMetaData::nullsAreSortedAtEnd() -I- */ 974 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd() 975 throw(SQLException, RuntimeException) 976 { 977 return impl_getBoolMetaData("nullsAreSortedAtEnd", &sql::DatabaseMetaData::nullsAreSortedAtEnd); 978 } 979 /* }}} */ 980 981 982 /* {{{ ODatabaseMetaData::nullsAreSortedAtStart() -I- */ 983 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart() 984 throw(SQLException, RuntimeException) 985 { 986 return impl_getBoolMetaData("nullsAreSortedAtStart", &sql::DatabaseMetaData::nullsAreSortedAtStart); 987 } 988 /* }}} */ 989 990 991 /* {{{ ODatabaseMetaData::nullsAreSortedHigh() -I- */ 992 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh() 993 throw(SQLException, RuntimeException) 994 { 995 return impl_getBoolMetaData("nullsAreSortedHigh", &sql::DatabaseMetaData::nullsAreSortedHigh); 996 } 997 /* }}} */ 998 999 1000 /* {{{ ODatabaseMetaData::nullsAreSortedLow() -I- */ 1001 sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow() 1002 throw(SQLException, RuntimeException) 1003 { 1004 return impl_getBoolMetaData("nullsAreSortedLow", &sql::DatabaseMetaData::nullsAreSortedLow); 1005 } 1006 /* }}} */ 1007 1008 1009 /* {{{ ODatabaseMetaData::supportsSchemasInProcedureCalls() -I- */ 1010 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls() 1011 throw(SQLException, RuntimeException) 1012 { 1013 return impl_getBoolMetaData("supportsSchemasInProcedureCalls", &sql::DatabaseMetaData::supportsSchemasInProcedureCalls); 1014 } 1015 /* }}} */ 1016 1017 1018 /* {{{ ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions() -I- */ 1019 sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions() 1020 throw(SQLException, RuntimeException) 1021 { 1022 return impl_getBoolMetaData("supportsSchemasInPrivilegeDefinitions", &sql::DatabaseMetaData::supportsSchemasInPrivilegeDefinitions); 1023 } 1024 /* }}} */ 1025 1026 1027 /* {{{ ODatabaseMetaData::supportsCatalogsInProcedureCalls() -I- */ 1028 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls() 1029 throw(SQLException, RuntimeException) 1030 { 1031 return impl_getBoolMetaData("supportsCatalogsInProcedureCalls", &sql::DatabaseMetaData::supportsCatalogsInProcedureCalls); 1032 } 1033 /* }}} */ 1034 1035 1036 /* {{{ ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions() -I- */ 1037 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions() 1038 throw(SQLException, RuntimeException) 1039 { 1040 return impl_getBoolMetaData("supportsCatalogsInPrivilegeDefinitions", &sql::DatabaseMetaData::supportsCatalogsInPrivilegeDefinitions); 1041 } 1042 /* }}} */ 1043 1044 1045 /* {{{ ODatabaseMetaData::supportsCorrelatedSubqueries() -I- */ 1046 sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries() 1047 throw(SQLException, RuntimeException) 1048 { 1049 return impl_getBoolMetaData("supportsCorrelatedSubqueries", &sql::DatabaseMetaData::supportsCorrelatedSubqueries); 1050 } 1051 /* }}} */ 1052 1053 1054 /* {{{ ODatabaseMetaData::supportsSubqueriesInComparisons() -I- */ 1055 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons() 1056 throw(SQLException, RuntimeException) 1057 { 1058 return impl_getBoolMetaData("supportsSubqueriesInComparisons", &sql::DatabaseMetaData::supportsSubqueriesInComparisons); 1059 } 1060 /* }}} */ 1061 1062 1063 /* {{{ ODatabaseMetaData::supportsSubqueriesInExists() -I- */ 1064 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists() 1065 throw(SQLException, RuntimeException) 1066 { 1067 return impl_getBoolMetaData("supportsSubqueriesInExists", &sql::DatabaseMetaData::supportsSubqueriesInExists); 1068 } 1069 /* }}} */ 1070 1071 1072 /* {{{ ODatabaseMetaData::supportsSubqueriesInIns() -I- */ 1073 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns() 1074 throw(SQLException, RuntimeException) 1075 { 1076 return impl_getBoolMetaData("supportsSubqueriesInIns", &sql::DatabaseMetaData::supportsSubqueriesInIns); 1077 } 1078 /* }}} */ 1079 1080 1081 /* {{{ ODatabaseMetaData::supportsSubqueriesInQuantifieds() -I- */ 1082 sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds() 1083 throw(SQLException, RuntimeException) 1084 { 1085 return impl_getBoolMetaData("supportsSubqueriesInQuantifieds", &sql::DatabaseMetaData::supportsSubqueriesInQuantifieds); 1086 } 1087 /* }}} */ 1088 1089 1090 /* {{{ ODatabaseMetaData::supportsANSI92IntermediateSQL() -I- */ 1091 sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL() 1092 throw(SQLException, RuntimeException) 1093 { 1094 return impl_getBoolMetaData("supportsANSI92IntermediateSQL", &sql::DatabaseMetaData::supportsANSI92IntermediateSQL); 1095 } 1096 /* }}} */ 1097 1098 1099 /* {{{ ODatabaseMetaData::getURL() -I- */ 1100 OUString SAL_CALL ODatabaseMetaData::getURL() 1101 throw(SQLException, RuntimeException) 1102 { 1103 OSL_TRACE("ODatabaseMetaData::getURL"); 1104 return m_rConnection.getConnectionSettings().connectionURL; 1105 } 1106 /* }}} */ 1107 1108 1109 /* {{{ ODatabaseMetaData::getUserName() -I- */ 1110 OUString SAL_CALL ODatabaseMetaData::getUserName() 1111 throw(SQLException, RuntimeException) 1112 { 1113 return impl_getStringMetaData("getUserName", &sql::DatabaseMetaData::getUserName); 1114 } 1115 /* }}} */ 1116 1117 1118 /* {{{ ODatabaseMetaData::getDriverName() -I- */ 1119 OUString SAL_CALL ODatabaseMetaData::getDriverName() 1120 throw(SQLException, RuntimeException) 1121 { 1122 OSL_TRACE("ODatabaseMetaData::getDriverName"); 1123 OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "MySQL Connector/OO.org" ) ); 1124 return aValue; 1125 } 1126 /* }}} */ 1127 1128 1129 /* {{{ ODatabaseMetaData::getDriverVersion() -I- */ 1130 OUString SAL_CALL ODatabaseMetaData::getDriverVersion() 1131 throw(SQLException, RuntimeException) 1132 { 1133 OSL_TRACE("ODatabaseMetaData::getDriverVersion"); 1134 static const OUString sVersion( RTL_CONSTASCII_USTRINGPARAM( "0.9.2" ) ); 1135 return sVersion; 1136 } 1137 /* }}} */ 1138 1139 1140 /* {{{ ODatabaseMetaData::getDatabaseProductVersion() -I- */ 1141 OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion() 1142 throw(SQLException, RuntimeException) 1143 { 1144 return impl_getStringMetaData("getDatabaseProductVersion", &sql::DatabaseMetaData::getDatabaseProductVersion); 1145 } 1146 /* }}} */ 1147 1148 1149 /* {{{ ODatabaseMetaData::getDatabaseProductName() -I- */ 1150 OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName() 1151 throw(SQLException, RuntimeException) 1152 { 1153 return impl_getStringMetaData("getDatabaseProductName", &sql::DatabaseMetaData::getDatabaseProductName); 1154 } 1155 /* }}} */ 1156 1157 1158 /* {{{ ODatabaseMetaData::getProcedureTerm() -I- */ 1159 OUString SAL_CALL ODatabaseMetaData::getProcedureTerm() 1160 throw(SQLException, RuntimeException) 1161 { 1162 return impl_getStringMetaData("getProcedureTerm", &sql::DatabaseMetaData::getProcedureTerm); 1163 } 1164 /* }}} */ 1165 1166 1167 /* {{{ ODatabaseMetaData::getSchemaTerm() -I- */ 1168 OUString SAL_CALL ODatabaseMetaData::getSchemaTerm() 1169 throw(SQLException, RuntimeException) 1170 { 1171 return impl_getStringMetaData("getSchemaTerm", &sql::DatabaseMetaData::getSchemaTerm); 1172 } 1173 /* }}} */ 1174 1175 1176 /* {{{ ODatabaseMetaData::getDriverMajorVersion() -I- */ 1177 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion() 1178 throw(RuntimeException) 1179 { 1180 OSL_TRACE("ODatabaseMetaData::getDriverMajorVersion"); 1181 return MYSQLC_VERSION_MAJOR; 1182 } 1183 /* }}} */ 1184 1185 1186 /* {{{ ODatabaseMetaData::getDefaultTransactionIsolation() -I- */ 1187 sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation() 1188 throw(SQLException, RuntimeException) 1189 { 1190 OSL_TRACE("ODatabaseMetaData::getDefaultTransactionIsolation"); 1191 try { 1192 switch (meta->getDefaultTransactionIsolation()) { 1193 case sql::TRANSACTION_SERIALIZABLE: return TransactionIsolation::SERIALIZABLE; 1194 case sql::TRANSACTION_REPEATABLE_READ: return TransactionIsolation::REPEATABLE_READ; 1195 case sql::TRANSACTION_READ_COMMITTED: return TransactionIsolation::READ_COMMITTED; 1196 case sql::TRANSACTION_READ_UNCOMMITTED: return TransactionIsolation::READ_UNCOMMITTED; 1197 } 1198 } catch (sql::MethodNotImplementedException) { 1199 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getDriverMajorVersion", *this); 1200 } catch (sql::InvalidArgumentException) { 1201 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getDriverMajorVersion", *this); 1202 } catch (const sql::SQLException& e) { 1203 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 1204 } 1205 return TransactionIsolation::NONE; 1206 } 1207 /* }}} */ 1208 1209 1210 /* {{{ ODatabaseMetaData::getDriverMinorVersion() -I- */ 1211 sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion() 1212 throw(RuntimeException) 1213 { 1214 OSL_TRACE("ODatabaseMetaData::getDriverMinorVersion"); 1215 return MYSQLC_VERSION_MINOR; 1216 } 1217 /* }}} */ 1218 1219 1220 /* {{{ ODatabaseMetaData::getSQLKeywords() -I- */ 1221 OUString SAL_CALL ODatabaseMetaData::getSQLKeywords() 1222 throw(SQLException, RuntimeException) 1223 { 1224 return impl_getStringMetaData("getSQLKeywords", &sql::DatabaseMetaData::getSQLKeywords); 1225 } 1226 /* }}} */ 1227 1228 1229 /* {{{ ODatabaseMetaData::getSearchStringEscape() -I- */ 1230 OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape() 1231 throw(SQLException, RuntimeException) 1232 { 1233 return impl_getStringMetaData("getSearchStringEscape", &sql::DatabaseMetaData::getSearchStringEscape); 1234 } 1235 /* }}} */ 1236 1237 1238 /* {{{ ODatabaseMetaData::getStringFunctions() -I- */ 1239 OUString SAL_CALL ODatabaseMetaData::getStringFunctions() 1240 throw(SQLException, RuntimeException) 1241 { 1242 return impl_getStringMetaData("getStringFunctions", &sql::DatabaseMetaData::getStringFunctions); 1243 } 1244 /* }}} */ 1245 1246 1247 /* {{{ ODatabaseMetaData::getTimeDateFunctions() -I- */ 1248 OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions() 1249 throw(SQLException, RuntimeException) 1250 { 1251 return impl_getStringMetaData("getTimeDateFunctions", &sql::DatabaseMetaData::getTimeDateFunctions); 1252 } 1253 /* }}} */ 1254 1255 1256 /* {{{ ODatabaseMetaData::getSystemFunctions() -I- */ 1257 OUString SAL_CALL ODatabaseMetaData::getSystemFunctions() 1258 throw(SQLException, RuntimeException) 1259 { 1260 return impl_getStringMetaData("getSystemFunctions", &sql::DatabaseMetaData::getSystemFunctions); 1261 } 1262 /* }}} */ 1263 1264 1265 /* {{{ ODatabaseMetaData::getNumericFunctions() -I- */ 1266 OUString SAL_CALL ODatabaseMetaData::getNumericFunctions() 1267 throw(SQLException, RuntimeException) 1268 { 1269 return impl_getStringMetaData("getNumericFunctions", &sql::DatabaseMetaData::getNumericFunctions); 1270 } 1271 /* }}} */ 1272 1273 1274 /* {{{ ODatabaseMetaData::supportsExtendedSQLGrammar() -I- */ 1275 sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar() 1276 throw(SQLException, RuntimeException) 1277 { 1278 return impl_getBoolMetaData("supportsExtendedSQLGrammar", &sql::DatabaseMetaData::supportsExtendedSQLGrammar); 1279 } 1280 /* }}} */ 1281 1282 1283 /* {{{ ODatabaseMetaData::supportsCoreSQLGrammar() -I- */ 1284 sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar() 1285 throw(SQLException, RuntimeException) 1286 { 1287 return impl_getBoolMetaData("supportsCoreSQLGrammar", &sql::DatabaseMetaData::supportsCoreSQLGrammar); 1288 } 1289 /* }}} */ 1290 1291 1292 /* {{{ ODatabaseMetaData::supportsMinimumSQLGrammar() -I- */ 1293 sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar() 1294 throw(SQLException, RuntimeException) 1295 { 1296 return impl_getBoolMetaData("supportsMinimumSQLGrammar", &sql::DatabaseMetaData::supportsMinimumSQLGrammar); 1297 } 1298 /* }}} */ 1299 1300 1301 /* {{{ ODatabaseMetaData::supportsFullOuterJoins() -I- */ 1302 sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins() 1303 throw(SQLException, RuntimeException) 1304 { 1305 return impl_getBoolMetaData("supportsFullOuterJoins", &sql::DatabaseMetaData::supportsFullOuterJoins); 1306 } 1307 /* }}} */ 1308 1309 1310 /* {{{ ODatabaseMetaData::supportsLimitedOuterJoins() -I- */ 1311 sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins() 1312 throw(SQLException, RuntimeException) 1313 { 1314 return impl_getBoolMetaData("supportsLimitedOuterJoins", &sql::DatabaseMetaData::supportsLimitedOuterJoins); 1315 } 1316 /* }}} */ 1317 1318 1319 /* {{{ ODatabaseMetaData::getMaxColumnsInGroupBy() -I- */ 1320 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy() 1321 throw(SQLException, RuntimeException) 1322 { 1323 return impl_getInt32MetaData("getMaxColumnsInGroupBy", &sql::DatabaseMetaData::getMaxColumnsInGroupBy); 1324 } 1325 /* }}} */ 1326 1327 1328 /* {{{ ODatabaseMetaData::getMaxColumnsInOrderBy() -I- */ 1329 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy() 1330 throw(SQLException, RuntimeException) 1331 { 1332 return impl_getInt32MetaData("getMaxColumnsInOrderBy", &sql::DatabaseMetaData::getMaxColumnsInOrderBy); 1333 } 1334 /* }}} */ 1335 1336 1337 /* {{{ ODatabaseMetaData::getMaxColumnsInSelect() -I- */ 1338 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect() 1339 throw(SQLException, RuntimeException) 1340 { 1341 return impl_getInt32MetaData("getMaxColumnsInSelect", &sql::DatabaseMetaData::getMaxColumnsInSelect); 1342 } 1343 /* }}} */ 1344 1345 1346 /* {{{ ODatabaseMetaData::getMaxUserNameLength() -I- */ 1347 sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength() 1348 throw(SQLException, RuntimeException) 1349 { 1350 return impl_getInt32MetaData("getMaxUserNameLength", &sql::DatabaseMetaData::getMaxUserNameLength); 1351 } 1352 /* }}} */ 1353 1354 1355 /* {{{ ODatabaseMetaData::supportsResultSetType() -I- */ 1356 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType(sal_Int32 setType) 1357 throw(SQLException, RuntimeException) 1358 { 1359 return impl_getRSTypeMetaData("supportsResultSetType", &sql::DatabaseMetaData::supportsResultSetType, setType); 1360 } 1361 /* }}} */ 1362 1363 1364 /* {{{ ODatabaseMetaData::supportsResultSetConcurrency() -I- */ 1365 sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency(sal_Int32 setType, sal_Int32 concurrency) 1366 throw(SQLException, RuntimeException) 1367 { 1368 OSL_TRACE("ODatabaseMetaData::supportsResultSetConcurrency"); 1369 /* TODO: Check this out */ 1370 try { 1371 return meta->supportsResultSetConcurrency(setType, concurrency==com::sun::star::sdbc::TransactionIsolation::READ_COMMITTED? 1372 sql::TRANSACTION_READ_COMMITTED: 1373 (concurrency == com::sun::star::sdbc::TransactionIsolation::SERIALIZABLE? 1374 sql::TRANSACTION_SERIALIZABLE:sql::TRANSACTION_SERIALIZABLE))? sal_True:sal_False; 1375 } catch (sql::MethodNotImplementedException) { 1376 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::supportsResultSetConcurrency", *this); 1377 } catch (sql::InvalidArgumentException) { 1378 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::supportsResultSetConcurrency", *this); 1379 } catch (const sql::SQLException& e) { 1380 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 1381 } 1382 return sal_False; 1383 } 1384 /* }}} */ 1385 1386 1387 /* {{{ ODatabaseMetaData::ownUpdatesAreVisible() -I- */ 1388 sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible(sal_Int32 setType) 1389 throw(SQLException, RuntimeException) 1390 { 1391 return impl_getRSTypeMetaData("ownUpdatesAreVisible", &sql::DatabaseMetaData::ownUpdatesAreVisible, setType); 1392 } 1393 /* }}} */ 1394 1395 1396 /* {{{ ODatabaseMetaData::ownDeletesAreVisible() -I- */ 1397 sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible(sal_Int32 setType) 1398 throw(SQLException, RuntimeException) 1399 { 1400 return impl_getRSTypeMetaData("ownDeletesAreVisible", &sql::DatabaseMetaData::ownDeletesAreVisible, setType); 1401 } 1402 /* }}} */ 1403 1404 1405 /* {{{ ODatabaseMetaData::ownInsertsAreVisible() -I- */ 1406 sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible(sal_Int32 setType) 1407 throw(SQLException, RuntimeException) 1408 { 1409 return impl_getRSTypeMetaData("ownInsertsAreVisible", &sql::DatabaseMetaData::ownInsertsAreVisible, setType); 1410 } 1411 /* }}} */ 1412 1413 1414 /* {{{ ODatabaseMetaData::othersUpdatesAreVisible() -I- */ 1415 sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible(sal_Int32 setType) 1416 throw(SQLException, RuntimeException) 1417 { 1418 return impl_getRSTypeMetaData("othersUpdatesAreVisible", &sql::DatabaseMetaData::othersUpdatesAreVisible, setType); 1419 } 1420 /* }}} */ 1421 1422 1423 /* {{{ ODatabaseMetaData::othersDeletesAreVisible() -I- */ 1424 sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible(sal_Int32 setType) 1425 throw(SQLException, RuntimeException) 1426 { 1427 return impl_getRSTypeMetaData("othersDeletesAreVisible", &sql::DatabaseMetaData::othersDeletesAreVisible, setType); 1428 } 1429 /* }}} */ 1430 1431 1432 /* {{{ ODatabaseMetaData::othersInsertsAreVisible() -I- */ 1433 sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible(sal_Int32 setType) 1434 throw(SQLException, RuntimeException) 1435 { 1436 return impl_getRSTypeMetaData("othersInsertsAreVisible", &sql::DatabaseMetaData::othersInsertsAreVisible, setType); 1437 } 1438 /* }}} */ 1439 1440 1441 /* {{{ ODatabaseMetaData::updatesAreDetected() -I- */ 1442 sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected(sal_Int32 setType) 1443 throw(SQLException, RuntimeException) 1444 { 1445 return impl_getRSTypeMetaData("updatesAreDetected", &sql::DatabaseMetaData::updatesAreDetected, setType); 1446 } 1447 /* }}} */ 1448 1449 1450 /* {{{ ODatabaseMetaData::deletesAreDetected() -I- */ 1451 sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected(sal_Int32 setType) 1452 throw(SQLException, RuntimeException) 1453 { 1454 return impl_getRSTypeMetaData("deletesAreDetected", &sql::DatabaseMetaData::deletesAreDetected, setType); 1455 } 1456 /* }}} */ 1457 1458 1459 /* {{{ ODatabaseMetaData::insertsAreDetected() -I- */ 1460 sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected(sal_Int32 setType) 1461 throw(SQLException, RuntimeException) 1462 { 1463 return impl_getRSTypeMetaData("insertsAreDetected", &sql::DatabaseMetaData::insertsAreDetected, setType); 1464 } 1465 /* }}} */ 1466 1467 1468 /* {{{ ODatabaseMetaData::supportsBatchUpdates() -I- */ 1469 sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates() 1470 throw(SQLException, RuntimeException) 1471 { 1472 return impl_getBoolMetaData("supportsBatchUpdates", &sql::DatabaseMetaData::supportsBatchUpdates); 1473 } 1474 /* }}} */ 1475 1476 1477 /* {{{ ODatabaseMetaData::getConnection() -I- */ 1478 Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection() 1479 throw(SQLException, RuntimeException) 1480 { 1481 OSL_TRACE("ODatabaseMetaData::getConnection"); 1482 return (Reference< XConnection >)&m_rConnection; 1483 } 1484 /* }}} */ 1485 1486 1487 /* 1488 Here follow all methods which return(a resultset 1489 the first methods is an example implementation how to use this resultset 1490 of course you could implement it on your and you should do this because 1491 the general way is more memory expensive 1492 */ 1493 1494 /* {{{ ODatabaseMetaData::getTableTypes() -I- */ 1495 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes() 1496 throw(SQLException, RuntimeException) 1497 { 1498 OSL_TRACE("ODatabaseMetaData::getTableTypes"); 1499 const char * table_types[] = {"TABLE", "VIEW"}; 1500 sal_Int32 requiredVersion[] = {0, 50000}; 1501 1502 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1503 std::vector< std::vector< Any > > rRows; 1504 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 1505 1506 for (sal_uInt32 i = 0; i < 2; i++) { 1507 if (m_rConnection.getMysqlVersion() >= requiredVersion[i]) { 1508 std::vector< Any > aRow(1); 1509 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(table_types[i], encoding))); 1510 rRows.push_back(aRow); 1511 } 1512 } 1513 lcl_setRows_throw(xResultSet, 5 ,rRows); 1514 return xResultSet; 1515 } 1516 /* }}} */ 1517 1518 1519 /* {{{ ODatabaseMetaData::getTypeInfo() -I- */ 1520 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo() 1521 throw(SQLException, RuntimeException) 1522 { 1523 OSL_TRACE("ODatabaseMetaData::getTypeInfo"); 1524 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1525 1526 std::vector< std::vector< Any > > rRows; 1527 1528 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 1529 unsigned int i = 0; 1530 while (mysqlc_types[i].typeName) { 1531 std::vector< Any > aRow(1); 1532 1533 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].typeName, encoding))); 1534 aRow.push_back(makeAny(mysqlc_types[i].dataType)); 1535 aRow.push_back(makeAny(mysqlc_types[i].precision)); 1536 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalPrefix, encoding))); 1537 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].literalSuffix, encoding))); 1538 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].createParams, encoding))); 1539 aRow.push_back(makeAny(mysqlc_types[i].nullable)); 1540 aRow.push_back(makeAny(mysqlc_types[i].caseSensitive)); 1541 aRow.push_back(makeAny(mysqlc_types[i].searchable)); 1542 aRow.push_back(makeAny(mysqlc_types[i].isUnsigned)); 1543 aRow.push_back(makeAny(mysqlc_types[i].fixedPrecScale)); 1544 aRow.push_back(makeAny(mysqlc_types[i].autoIncrement)); 1545 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(mysqlc_types[i].localTypeName, encoding))); 1546 aRow.push_back(makeAny(mysqlc_types[i].minScale)); 1547 aRow.push_back(makeAny(mysqlc_types[i].maxScale)); 1548 aRow.push_back(makeAny(sal_Int32(0))); 1549 aRow.push_back(makeAny(sal_Int32(0))); 1550 aRow.push_back(makeAny(sal_Int32(10))); 1551 1552 rRows.push_back(aRow); 1553 i++; 1554 } 1555 1556 lcl_setRows_throw(xResultSet, 14, rRows); 1557 return xResultSet; 1558 } 1559 /* }}} */ 1560 1561 1562 /* {{{ ODatabaseMetaData::getCatalogs() -I- */ 1563 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs() 1564 throw(SQLException, RuntimeException) 1565 { 1566 OSL_TRACE("ODatabaseMetaData::getCatalogs"); 1567 1568 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1569 std::vector< std::vector< Any > > rRows; 1570 1571 try { 1572 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 1573 std::auto_ptr< sql::ResultSet> rset( meta->getCatalogs()); 1574 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 1575 sal_uInt32 columns = rs_meta->getColumnCount(); 1576 while (rset->next()) { 1577 std::vector< Any > aRow(1); 1578 for (sal_uInt32 i = 1; i <= columns; i++) { 1579 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding))); 1580 } 1581 rRows.push_back(aRow); 1582 } 1583 } catch (sql::MethodNotImplementedException) { 1584 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getCatalogs", *this); 1585 } catch (sql::InvalidArgumentException) { 1586 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getCatalogs", *this); 1587 } catch (const sql::SQLException& e) { 1588 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 1589 } 1590 1591 lcl_setRows_throw(xResultSet, 0, rRows); 1592 return xResultSet; 1593 } 1594 /* }}} */ 1595 1596 1597 /* {{{ ODatabaseMetaData::getSchemas() -I- */ 1598 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas() 1599 throw(SQLException, RuntimeException) 1600 { 1601 OSL_TRACE("ODatabaseMetaData::getSchemas"); 1602 1603 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1604 std::vector< std::vector< Any > > rRows; 1605 1606 try { 1607 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 1608 std::auto_ptr< sql::ResultSet> rset( meta->getSchemas()); 1609 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 1610 sal_uInt32 columns = rs_meta->getColumnCount(); 1611 while (rset->next()) { 1612 std::vector< Any > aRow(1); 1613 bool informationSchema = false; 1614 for (sal_uInt32 i = 1; i <= columns; i++) { 1615 sql::SQLString columnStringValue = rset->getString(i); 1616 if (i == 1) { // TABLE_SCHEM 1617 informationSchema = (0 == columnStringValue.compare("information_schema")); 1618 } 1619 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(columnStringValue, encoding))); 1620 } 1621 if (!informationSchema ) { 1622 rRows.push_back(aRow); 1623 } 1624 } 1625 } catch (sql::MethodNotImplementedException) { 1626 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getSchemas", *this); 1627 } catch (sql::InvalidArgumentException) { 1628 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getSchemas", *this); 1629 } catch (const sql::SQLException& e) { 1630 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 1631 } 1632 1633 lcl_setRows_throw(xResultSet, 1, rRows); 1634 return xResultSet; 1635 } 1636 /* }}} */ 1637 1638 1639 /* {{{ ODatabaseMetaData::getColumnPrivileges() -I- */ 1640 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges( 1641 const Any& catalog, 1642 const OUString& schema, 1643 const OUString& table, 1644 const OUString& columnNamePattern) 1645 throw(SQLException, RuntimeException) 1646 { 1647 OSL_TRACE("ODatabaseMetaData::getColumnPrivileges"); 1648 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1649 std::vector< std::vector< Any > > rRows; 1650 1651 ext_std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""), 1652 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()), 1653 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr()), 1654 cNamePattern(OUStringToOString(columnNamePattern, m_rConnection.getConnectionEncoding()).getStr()); 1655 try { 1656 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 1657 std::auto_ptr< sql::ResultSet> rset( meta->getColumnPrivileges(cat, sch, tab, cNamePattern.compare("")? cNamePattern:wild)); 1658 1659 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 1660 sal_uInt32 columns = rs_meta->getColumnCount(); 1661 while (rset->next()) { 1662 std::vector< Any > aRow(1); 1663 for (sal_uInt32 i = 1; i <= columns; i++) { 1664 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding))); 1665 } 1666 rRows.push_back(aRow); 1667 } 1668 } catch (sql::MethodNotImplementedException) { 1669 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getColumnPrivileges", *this); 1670 } catch (sql::InvalidArgumentException) { 1671 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getColumnPrivileges", *this); 1672 } catch (const sql::SQLException& e) { 1673 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 1674 } 1675 1676 lcl_setRows_throw(xResultSet, 2, rRows); 1677 return xResultSet; 1678 } 1679 /* }}} */ 1680 1681 1682 /* {{{ ODatabaseMetaData::getColumns() -I- */ 1683 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( 1684 const Any& catalog, 1685 const OUString& schemaPattern, 1686 const OUString& tableNamePattern, 1687 const OUString& columnNamePattern) 1688 throw(SQLException, RuntimeException) 1689 { 1690 OSL_TRACE("ODatabaseMetaData::getColumns"); 1691 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1692 std::vector< std::vector< Any > > rRows; 1693 ext_std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""), 1694 sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()), 1695 tNamePattern(OUStringToOString(tableNamePattern, m_rConnection.getConnectionEncoding()).getStr()), 1696 cNamePattern(OUStringToOString(columnNamePattern, m_rConnection.getConnectionEncoding()).getStr()); 1697 1698 try { 1699 std::auto_ptr< sql::ResultSet> rset( meta->getColumns(cat, 1700 sPattern.compare("")? sPattern:wild, 1701 tNamePattern.compare("")? tNamePattern:wild, 1702 cNamePattern.compare("")? cNamePattern:wild)); 1703 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 1704 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 1705 sal_uInt32 columns = rs_meta->getColumnCount(); 1706 while (rset->next()) { 1707 std::vector< Any > aRow(1); 1708 for (sal_uInt32 i = 1; i <= columns; i++) { 1709 if (i == 5) { // ColumnType 1710 sal_Int32 sdbc_type = mysqlc_sdbc_driver::mysqlToOOOType(atoi(rset->getString(i).c_str())); 1711 aRow.push_back(makeAny(sdbc_type)); 1712 } else { 1713 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding))); 1714 } 1715 } 1716 rRows.push_back(aRow); 1717 } 1718 } catch (sql::MethodNotImplementedException) { 1719 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getColumns", *this); 1720 } catch (sql::InvalidArgumentException) { 1721 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getColumns", *this); 1722 } catch (const sql::SQLException& e) { 1723 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 1724 } 1725 lcl_setRows_throw(xResultSet, 3, rRows); 1726 return xResultSet; 1727 } 1728 /* }}} */ 1729 1730 1731 /* {{{ ODatabaseMetaData::getTables() -I- */ 1732 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( 1733 const Any& catalog, 1734 const OUString& schemaPattern, 1735 const OUString& tableNamePattern, 1736 const Sequence< OUString >& types ) 1737 throw(SQLException, RuntimeException) 1738 { 1739 OSL_TRACE("ODatabaseMetaData::getTables"); 1740 sal_Int32 nLength = types.getLength(); 1741 1742 Reference< XResultSet > xResultSet(getOwnConnection(). 1743 getDriver().getFactory()->createInstance( 1744 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1745 std::vector< std::vector< Any > > rRows; 1746 1747 ext_std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""), 1748 sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()), 1749 tNamePattern(OUStringToOString(tableNamePattern, m_rConnection.getConnectionEncoding()).getStr()); 1750 1751 ext_std::list<sql::SQLString> tabTypes; 1752 for (const OUString *pStart = types.getConstArray(), *p = pStart, *pEnd = pStart + nLength; p != pEnd; ++p) { 1753 tabTypes.push_back(OUStringToOString(*p, m_rConnection.getConnectionEncoding()).getStr()); 1754 } 1755 1756 try { 1757 std::auto_ptr< sql::ResultSet> rset( meta->getTables(cat, 1758 sPattern.compare("")? sPattern:wild, 1759 tNamePattern.compare("")? tNamePattern:wild, 1760 tabTypes)); 1761 1762 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 1763 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 1764 sal_uInt32 columns = rs_meta->getColumnCount(); 1765 while (rset->next()) { 1766 std::vector< Any > aRow(1); 1767 bool informationSchema = false; 1768 for (sal_uInt32 i = 1; (i <= columns) && !informationSchema; ++i) { 1769 sql::SQLString columnStringValue = rset->getString(i); 1770 if (i == 2) { // TABLE_SCHEM 1771 informationSchema = ( 0 == columnStringValue.compare("information_schema")); 1772 } 1773 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(columnStringValue, encoding))); 1774 } 1775 if (!informationSchema) { 1776 rRows.push_back(aRow); 1777 } 1778 } 1779 } catch (sql::MethodNotImplementedException) { 1780 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getTables", *this); 1781 } catch (sql::InvalidArgumentException) { 1782 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getTables", *this); 1783 } catch (const sql::SQLException& e) { 1784 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 1785 } 1786 1787 lcl_setRows_throw(xResultSet, 4, rRows); 1788 return xResultSet; 1789 } 1790 /* }}} */ 1791 1792 1793 /* {{{ ODatabaseMetaData::getProcedureColumns() -I- */ 1794 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns( 1795 const Any& /* catalog */, 1796 const OUString& /* schemaPattern */, 1797 const OUString& /* procedureNamePattern */, 1798 const OUString& /* columnNamePattern */) 1799 throw(SQLException, RuntimeException) 1800 { 1801 OSL_TRACE("ODatabaseMetaData::getProcedureColumns"); 1802 // Currently there is no information available 1803 return NULL; 1804 } 1805 /* }}} */ 1806 1807 1808 /* {{{ ODatabaseMetaData::getProcedures() -I- */ 1809 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures( 1810 const Any& catalog, 1811 const OUString& schemaPattern, 1812 const OUString& procedureNamePattern) 1813 throw(SQLException, RuntimeException) 1814 { 1815 OSL_TRACE("ODatabaseMetaData::getProcedures"); 1816 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1817 std::vector< std::vector< Any > > rRows; 1818 1819 ext_std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""), 1820 sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()), 1821 pNamePattern(OUStringToOString(procedureNamePattern, m_rConnection.getConnectionEncoding()).getStr()); 1822 1823 1824 try { 1825 std::auto_ptr< sql::ResultSet> rset( meta->getProcedures(cat, 1826 sPattern.compare("")? sPattern:wild, 1827 pNamePattern.compare("")? pNamePattern:wild)); 1828 1829 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 1830 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 1831 sal_uInt32 columns = rs_meta->getColumnCount(); 1832 while (rset->next()) { 1833 std::vector< Any > aRow(1); 1834 for (sal_uInt32 i = 1; i <= columns; i++) { 1835 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding))); 1836 } 1837 rRows.push_back(aRow); 1838 } 1839 } catch (sql::MethodNotImplementedException) { 1840 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getProcedures", *this); 1841 } catch (sql::InvalidArgumentException) { 1842 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getProcedures", *this); 1843 } catch (const sql::SQLException& e) { 1844 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 1845 } 1846 1847 lcl_setRows_throw(xResultSet, 7,rRows); 1848 return xResultSet; 1849 } 1850 /* }}} */ 1851 1852 1853 /* {{{ ODatabaseMetaData::getVersionColumns() -I- */ 1854 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns( 1855 const Any& /* catalog */, 1856 const OUString& /* schema */, 1857 const OUString& /* table */) 1858 throw(SQLException, RuntimeException) 1859 { 1860 OSL_TRACE("ODatabaseMetaData::getVersionColumns"); 1861 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1862 std::vector< std::vector< Any > > rRows; 1863 lcl_setRows_throw(xResultSet, 16,rRows); 1864 return xResultSet; 1865 } 1866 /* }}} */ 1867 1868 1869 /* {{{ ODatabaseMetaData::getExportedKeys() -I- */ 1870 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys( 1871 const Any& catalog , 1872 const OUString& schema , 1873 const OUString& table ) 1874 throw(SQLException, RuntimeException) 1875 { 1876 OSL_TRACE("ODatabaseMetaData::getExportedKeys"); 1877 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1878 std::vector< std::vector< Any > > rRows; 1879 ext_std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""), 1880 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()), 1881 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr()); 1882 1883 try { 1884 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 1885 std::auto_ptr< sql::ResultSet> rset( meta->getExportedKeys(cat, sch, tab)); 1886 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 1887 sal_uInt32 columns = rs_meta->getColumnCount(); 1888 while (rset->next()) { 1889 std::vector< Any > aRow(1); 1890 for (sal_uInt32 i = 1; i <= columns; i++) { 1891 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding))); 1892 } 1893 rRows.push_back(aRow); 1894 } 1895 } catch (sql::MethodNotImplementedException) { 1896 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getExportedKeys", *this); 1897 } catch (sql::InvalidArgumentException) { 1898 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getExportedKeys", *this); 1899 } catch (const sql::SQLException& e) { 1900 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 1901 } 1902 1903 lcl_setRows_throw(xResultSet, 8, rRows); 1904 return xResultSet; 1905 } 1906 /* }}} */ 1907 1908 1909 /* {{{ ODatabaseMetaData::getImportedKeys() -I- */ 1910 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys( 1911 const Any& catalog, 1912 const OUString& schema, 1913 const OUString& table) 1914 throw(SQLException, RuntimeException) 1915 { 1916 OSL_TRACE("ODatabaseMetaData::getImportedKeys"); 1917 1918 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1919 std::vector< std::vector< Any > > rRows; 1920 1921 ext_std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""), 1922 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()), 1923 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr()); 1924 1925 try { 1926 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 1927 std::auto_ptr< sql::ResultSet> rset( meta->getImportedKeys(cat, sch, tab)); 1928 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 1929 sal_uInt32 columns = rs_meta->getColumnCount(); 1930 while (rset->next()) { 1931 std::vector< Any > aRow(1); 1932 for (sal_uInt32 i = 1; i <= columns; i++) { 1933 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding))); 1934 } 1935 rRows.push_back(aRow); 1936 } 1937 } catch (sql::MethodNotImplementedException) { 1938 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getImportedKeys", *this); 1939 } catch (sql::InvalidArgumentException) { 1940 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getImportedKeys", *this); 1941 } catch (const sql::SQLException& e) { 1942 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 1943 } 1944 1945 lcl_setRows_throw(xResultSet,9,rRows); 1946 return xResultSet; 1947 } 1948 /* }}} */ 1949 1950 1951 /* {{{ ODatabaseMetaData::getPrimaryKeys() -I- */ 1952 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys( 1953 const Any& catalog, 1954 const OUString& schema, 1955 const OUString& table) 1956 throw(SQLException, RuntimeException) 1957 { 1958 OSL_TRACE("ODatabaseMetaData::getPrimaryKeys"); 1959 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 1960 std::vector< std::vector< Any > > rRows; 1961 1962 ext_std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""), 1963 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()), 1964 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr()); 1965 1966 try { 1967 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 1968 std::auto_ptr< sql::ResultSet> rset( meta->getPrimaryKeys(cat, sch, tab)); 1969 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 1970 sal_uInt32 columns = rs_meta->getColumnCount(); 1971 while (rset->next()) { 1972 std::vector< Any > aRow(1); 1973 for (sal_uInt32 i = 1; i <= columns; i++) { 1974 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding))); 1975 } 1976 rRows.push_back(aRow); 1977 } 1978 } catch (sql::MethodNotImplementedException) { 1979 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getPrimaryKeys", *this); 1980 } catch (sql::InvalidArgumentException) { 1981 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getPrimaryKeys", *this); 1982 } catch (const sql::SQLException& e) { 1983 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 1984 } 1985 1986 lcl_setRows_throw(xResultSet, 10, rRows); 1987 return xResultSet; 1988 } 1989 /* }}} */ 1990 1991 1992 /* {{{ ODatabaseMetaData::getIndexInfo() -I- */ 1993 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo( 1994 const Any& catalog, 1995 const OUString& schema, 1996 const OUString& table, 1997 sal_Bool unique, 1998 sal_Bool approximate) 1999 throw(SQLException, RuntimeException) 2000 { 2001 OSL_TRACE("ODatabaseMetaData::getIndexInfo"); 2002 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 2003 std::vector< std::vector< Any > > rRows; 2004 2005 ext_std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""), 2006 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()), 2007 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr()); 2008 2009 try { 2010 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 2011 std::auto_ptr< sql::ResultSet> rset( meta->getIndexInfo(cat, sch, tab, unique, approximate)); 2012 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 2013 sal_uInt32 columns = rs_meta->getColumnCount(); 2014 while (rset->next()) { 2015 std::vector< Any > aRow(1); 2016 for (sal_uInt32 i = 1; i <= columns; i++) { 2017 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding))); 2018 } 2019 rRows.push_back(aRow); 2020 } 2021 } catch (sql::MethodNotImplementedException) { 2022 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getIndexInfo", *this); 2023 } catch (sql::InvalidArgumentException) { 2024 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getIndexInfo", *this); 2025 } catch (const sql::SQLException& e) { 2026 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 2027 } 2028 2029 lcl_setRows_throw(xResultSet, 11, rRows); 2030 return xResultSet; 2031 } 2032 /* }}} */ 2033 2034 2035 /* {{{ ODatabaseMetaData::getBestRowIdentifier() -I- */ 2036 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier( 2037 const Any& catalog, 2038 const OUString& schema, 2039 const OUString& table, 2040 sal_Int32 scope, 2041 sal_Bool nullable) 2042 throw(SQLException, RuntimeException) 2043 { 2044 OSL_TRACE("ODatabaseMetaData::getBestRowIdentifier"); 2045 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 2046 std::vector< std::vector< Any > > rRows; 2047 2048 ext_std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""), 2049 sch(OUStringToOString(schema, m_rConnection.getConnectionEncoding()).getStr()), 2050 tab(OUStringToOString(table, m_rConnection.getConnectionEncoding()).getStr()); 2051 2052 try { 2053 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 2054 std::auto_ptr< sql::ResultSet> rset( meta->getBestRowIdentifier(cat, sch, tab, scope, nullable)); 2055 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 2056 sal_uInt32 columns = rs_meta->getColumnCount(); 2057 while (rset->next()) { 2058 std::vector< Any > aRow(1); 2059 for (sal_uInt32 i = 1; i <= columns; i++) { 2060 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding))); 2061 } 2062 rRows.push_back(aRow); 2063 } 2064 } catch (sql::MethodNotImplementedException) { 2065 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getBestRowIdentifier", *this); 2066 } catch (sql::InvalidArgumentException) { 2067 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getBestRowIdentifier", *this); 2068 } catch (const sql::SQLException& e) { 2069 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 2070 } 2071 2072 lcl_setRows_throw(xResultSet, 15, rRows); 2073 return xResultSet; 2074 } 2075 /* }}} */ 2076 2077 2078 /* {{{ ODatabaseMetaData::getTablePrivileges() -I- */ 2079 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( 2080 const Any& catalog, 2081 const OUString& schemaPattern, 2082 const OUString& tableNamePattern) 2083 throw(SQLException, RuntimeException) 2084 { 2085 OSL_TRACE("ODatabaseMetaData::getTablePrivileges"); 2086 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 2087 std::vector< std::vector< Any > > rRows; 2088 2089 ext_std::string cat(catalog.hasValue()? OUStringToOString(getStringFromAny(catalog), m_rConnection.getConnectionEncoding()).getStr():""), 2090 sPattern(OUStringToOString(schemaPattern, m_rConnection.getConnectionEncoding()).getStr()), 2091 tPattern(OUStringToOString(tableNamePattern, m_rConnection.getConnectionEncoding()).getStr()); 2092 2093 try { 2094 static bool fakeTablePrivileges = false; 2095 if (fakeTablePrivileges) { 2096 static const sal_Char* allPrivileges[] = { 2097 "ALTER", "DELETE", "DROP", "INDEX", "INSERT", "LOCK TABLES", "SELECT", "UPDATE" 2098 }; 2099 Any userName; userName <<= getUserName(); 2100 for (size_t i = 0; i < sizeof( allPrivileges ) / sizeof( allPrivileges[0]); ++i) { 2101 std::vector< Any > aRow; 2102 aRow.push_back(makeAny( sal_Int32( i ) )); 2103 aRow.push_back(catalog); // TABLE_CAT 2104 aRow.push_back(makeAny( schemaPattern )); // TABLE_SCHEM 2105 aRow.push_back(makeAny( tableNamePattern )); // TABLE_NAME 2106 aRow.push_back(Any()); // GRANTOR 2107 aRow.push_back(userName); // GRANTEE 2108 aRow.push_back(makeAny( ::rtl::OUString::createFromAscii( allPrivileges[i] ) )); // PRIVILEGE 2109 aRow.push_back(Any()); // IS_GRANTABLE 2110 2111 rRows.push_back(aRow); 2112 } 2113 } else { 2114 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 2115 std::auto_ptr< sql::ResultSet> rset( meta->getTablePrivileges(cat, sPattern.compare("")? sPattern:wild, tPattern.compare("")? tPattern:wild)); 2116 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 2117 sal_uInt32 columns = rs_meta->getColumnCount(); 2118 while (rset->next()) { 2119 std::vector< Any > aRow(1); 2120 for (sal_uInt32 i = 1; i <= columns; i++) { 2121 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding))); 2122 } 2123 rRows.push_back(aRow); 2124 } 2125 } 2126 } catch (sql::MethodNotImplementedException) { 2127 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getTablePrivileges", *this); 2128 } catch (sql::InvalidArgumentException) { 2129 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getTablePrivileges", *this); 2130 } catch (const sql::SQLException& e) { 2131 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 2132 } 2133 2134 lcl_setRows_throw(xResultSet,12,rRows); 2135 return xResultSet; 2136 } 2137 /* }}} */ 2138 2139 2140 /* {{{ ODatabaseMetaData::getCrossReference() -I- */ 2141 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( 2142 const Any& primaryCatalog, 2143 const OUString& primarySchema, 2144 const OUString& primaryTable, 2145 const Any& foreignCatalog, 2146 const OUString& foreignSchema, 2147 const OUString& foreignTable) 2148 throw(SQLException, RuntimeException) 2149 { 2150 OSL_TRACE("ODatabaseMetaData::getCrossReference"); 2151 Reference< XResultSet > xResultSet(getOwnConnection().getDriver().getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.DatabaseMetaDataResultSet"))),UNO_QUERY); 2152 std::vector< std::vector< Any > > rRows; 2153 2154 ext_std::string primaryCat(primaryCatalog.hasValue()? OUStringToOString(getStringFromAny(primaryCatalog), m_rConnection.getConnectionEncoding()).getStr():""), 2155 foreignCat(foreignCatalog.hasValue()? OUStringToOString(getStringFromAny(foreignCatalog), m_rConnection.getConnectionEncoding()).getStr():""), 2156 pSchema(OUStringToOString(primarySchema, m_rConnection.getConnectionEncoding()).getStr()), 2157 pTable(OUStringToOString(primaryTable, m_rConnection.getConnectionEncoding()).getStr()), 2158 fSchema(OUStringToOString(foreignSchema, m_rConnection.getConnectionEncoding()).getStr()), 2159 fTable(OUStringToOString(foreignTable, m_rConnection.getConnectionEncoding()).getStr()); 2160 2161 try { 2162 rtl_TextEncoding encoding = m_rConnection.getConnectionEncoding(); 2163 std::auto_ptr< sql::ResultSet> rset( meta->getCrossReference(primaryCat, pSchema, pTable, foreignCat, fSchema, fTable)); 2164 sql::ResultSetMetaData * rs_meta = rset->getMetaData(); 2165 sal_uInt32 columns = rs_meta->getColumnCount(); 2166 while (rset->next()) { 2167 std::vector< Any > aRow(1); 2168 for (sal_uInt32 i = 1; i <= columns; i++) { 2169 aRow.push_back(makeAny(mysqlc_sdbc_driver::convert(rset->getString(i), encoding))); 2170 } 2171 rRows.push_back(aRow); 2172 } 2173 } catch (sql::MethodNotImplementedException) { 2174 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getCrossReference", *this); 2175 } catch (sql::InvalidArgumentException) { 2176 mysqlc_sdbc_driver::throwInvalidArgumentException("ODatabaseMetaData::getCrossReference", *this); 2177 } catch (const sql::SQLException& e) { 2178 mysqlc_sdbc_driver::translateAndThrow(e, *this, m_rConnection.getConnectionEncoding()); 2179 } 2180 2181 lcl_setRows_throw(xResultSet,13,rRows); 2182 return xResultSet; 2183 } 2184 /* }}} */ 2185 2186 2187 /* {{{ ODatabaseMetaData::getUDTs() -I- */ 2188 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( 2189 const Any& /* catalog */, 2190 const OUString& /* schemaPattern */, 2191 const OUString& /* typeNamePattern */, 2192 const Sequence< sal_Int32 >& /* types */) 2193 throw(SQLException, RuntimeException) 2194 { 2195 OSL_TRACE("ODatabaseMetaData::getUDTs"); 2196 mysqlc_sdbc_driver::throwFeatureNotImplementedException("ODatabaseMetaData::getUDTs", *this); 2197 return NULL; 2198 } 2199 /* }}} */ 2200 2201 /* 2202 * Local variables: 2203 * tab-width: 4 2204 * c-basic-offset: 4 2205 * End: 2206 * vim600: noet sw=4 ts=4 fdm=marker 2207 * vim<600: noet sw=4 ts=4 2208 */ 2209 2210