1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_connectivity.hxx" 30 #include "NDatabaseMetaData.hxx" 31 #include <com/sun/star/sdbc/DataType.hpp> 32 #include <com/sun/star/sdbc/ResultSetType.hpp> 33 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> 34 #include <com/sun/star/sdbc/TransactionIsolation.hpp> 35 #include <connectivity/dbexception.hxx> 36 #include <connectivity/FValue.hxx> 37 #include <com/sun/star/sdbc/ColumnValue.hpp> 38 #include <com/sun/star/sdbc/ColumnSearch.hpp> 39 40 #include <vector> 41 #include <string.h> 42 #include "EApi.h" 43 44 #if OSL_DEBUG_LEVEL > 0 45 # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) 46 #else /* OSL_DEBUG_LEVEL */ 47 # define OUtoCStr( x ) ("dummy") 48 #endif /* OSL_DEBUG_LEVEL */ 49 50 using namespace connectivity::evoab; 51 using namespace connectivity; 52 using namespace com::sun::star::uno; 53 using namespace com::sun::star::lang; 54 using namespace com::sun::star::beans; 55 using namespace com::sun::star::sdbc; 56 using namespace com::sun::star::sdbcx; 57 58 59 namespace connectivity 60 { 61 namespace evoab 62 { 63 static sal_Int32 const s_nCOLUMN_SIZE = 256; 64 static sal_Int32 const s_nDECIMAL_DIGITS = 0; 65 static sal_Int32 const s_nNULLABLE = 1; 66 static sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535; 67 68 static ColumnProperty **pFields=NULL; 69 static guint nFields = 0; 70 71 static const char *pBlackList[] = 72 { 73 "id", 74 "list-show-addresses", 75 "address-label-home", 76 "address-label-work", 77 "address-label-other" 78 }; 79 80 const SplitEvoColumns* get_evo_addr() 81 { 82 static const SplitEvoColumns evo_addr[] = { 83 {"addr-line1",DEFAULT_ADDR_LINE1},{"addr-line2",DEFAULT_ADDR_LINE2},{"city",DEFAULT_CITY},{"state",DEFAULT_STATE},{"country",DEFAULT_COUNTRY},{"zip",DEFAULT_ZIP}, 84 {"work-addr-line1",WORK_ADDR_LINE1},{"work-addr-line2",WORK_ADDR_LINE2},{"work-city",WORK_CITY},{"work-state",WORK_STATE},{"work-country",WORK_COUNTRY},{"work-zip",WORK_ZIP}, 85 {"home-addr-line1",HOME_ADDR_LINE1},{"home-addr-line2",HOME_ADDR_LINE2},{"home-addr-City",HOME_CITY},{"home-state",HOME_STATE},{"home-country",HOME_COUNTRY},{"home-zip",HOME_ZIP}, 86 {"other-addr-line1",OTHER_ADDR_LINE1},{"other-addr-line2",OTHER_ADDR_LINE2},{"other-addr-city",OTHER_CITY},{"other-addr-state",OTHER_STATE},{"other-addr-country",OTHER_COUNTRY},{"other-addr-zip",OTHER_ZIP} 87 }; 88 return evo_addr; 89 } 90 91 static void 92 splitColumn (ColumnProperty **pToBeFields) 93 { 94 const SplitEvoColumns* evo_addr( get_evo_addr() ); 95 for (int i = 0; i < OTHER_ZIP; i++) 96 { 97 pToBeFields[nFields] = g_new0(ColumnProperty,1); 98 pToBeFields[nFields]->bIsSplittedValue = true; 99 pToBeFields[nFields]->pField = g_param_spec_ref(g_param_spec_string (evo_addr[i].pColumnName,evo_addr[i].pColumnName,"",NULL,G_PARAM_WRITABLE)); 100 nFields++; 101 } 102 } 103 104 static void 105 initFields() 106 { 107 if( !pFields ) 108 { 109 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); 110 if( !pFields ) 111 { 112 guint nProps; 113 ColumnProperty **pToBeFields; 114 GParamSpec **pProps; 115 nFields = 0; 116 pProps = g_object_class_list_properties 117 ( (GObjectClass *) g_type_class_ref( E_TYPE_CONTACT ), 118 &nProps ); 119 pToBeFields = g_new0(ColumnProperty *, (nProps + OTHER_ZIP)/* new column(s)*/ ); 120 for ( guint i = 0; i < nProps; i++ ) 121 { 122 switch (pProps[i]->value_type) 123 { 124 case G_TYPE_STRING: 125 case G_TYPE_BOOLEAN: 126 { 127 bool bAdd = true; 128 const char *pName = g_param_spec_get_name( pProps[i] ); 129 for (unsigned int j = 0; j < G_N_ELEMENTS( pBlackList ); j++ ) 130 { 131 if( !strcmp( pBlackList[j], pName ) ) 132 { 133 bAdd = false; 134 break; 135 } 136 } 137 if( bAdd ) 138 { 139 pToBeFields[nFields]= g_new0(ColumnProperty,1); 140 pToBeFields[nFields]->bIsSplittedValue=false; 141 pToBeFields[ nFields++ ]->pField = g_param_spec_ref( pProps[i] ); 142 } 143 break; 144 } 145 default: 146 break; 147 } 148 } 149 150 splitColumn(pToBeFields); 151 pFields = pToBeFields; 152 } 153 } 154 } 155 156 157 guint 158 getFieldCount() 159 { 160 initFields(); 161 return nFields; 162 } 163 164 const ColumnProperty * 165 getField(guint n) 166 { 167 initFields(); 168 if( n < nFields ) 169 return pFields[n]; 170 else 171 return NULL; 172 } 173 174 GType 175 getGFieldType( guint nCol ) 176 { 177 initFields(); 178 179 sal_Int32 nType = G_TYPE_STRING; 180 if ( nCol < nFields ) 181 return ((GParamSpec *)pFields[nCol]->pField)->value_type; 182 return nType; 183 } 184 185 sal_Int32 186 getFieldType( guint nCol ) 187 { 188 sal_Int32 nType = getGFieldType( nCol ); 189 return nType == G_TYPE_STRING ? DataType::VARCHAR : DataType::BIT; 190 } 191 192 guint findEvoabField(const rtl::OUString& aColName) 193 { 194 guint nRet = (guint)-1; 195 sal_Bool bFound = sal_False; 196 initFields(); 197 for (guint i=0;(i < nFields) && !bFound;i++) 198 { 199 rtl::OUString aName = getFieldName(i); 200 if (aName == aColName) 201 { 202 nRet = i; 203 bFound = sal_True; 204 } 205 } 206 return nRet; 207 } 208 209 rtl::OUString 210 getFieldTypeName( guint nCol ) 211 { 212 switch( getFieldType( nCol ) ) 213 { 214 case DataType::BIT: 215 return ::rtl::OUString::createFromAscii( "BIT" ); 216 case DataType::VARCHAR: 217 return ::rtl::OUString::createFromAscii( "VARCHAR" ); 218 default: 219 break; 220 } 221 return ::rtl::OUString(); 222 } 223 224 rtl::OUString 225 getFieldName( guint nCol ) 226 { 227 const GParamSpec *pSpec = getField( nCol )->pField; 228 rtl::OUString aName; 229 initFields(); 230 231 if( pSpec ) 232 aName = rtl::OStringToOUString( g_param_spec_get_name( ( GParamSpec * )pSpec ), 233 RTL_TEXTENCODING_UTF8 ); 234 aName = aName.replace( '-', '_' ); 235 return aName; 236 } 237 238 void 239 free_column_resources() 240 { 241 for (int i=nFields-1;i > 0;i--) 242 { 243 if (pFields && pFields[i] ) 244 { 245 if (pFields[i]->pField) 246 g_param_spec_unref(pFields[i]->pField); 247 g_free(pFields[i]); 248 } 249 } 250 if(pFields) 251 { 252 g_free(pFields); 253 pFields=NULL; 254 } 255 256 } 257 258 259 } 260 } 261 262 263 OEvoabDatabaseMetaData::OEvoabDatabaseMetaData(OEvoabConnection* _pCon) 264 : ::connectivity::ODatabaseMetaDataBase(_pCon, _pCon->getConnectionInfo()) 265 ,m_pConnection(_pCon) 266 { 267 OSL_ENSURE(m_pConnection,"OEvoabDatabaseMetaData::OEvoabDatabaseMetaData: No connection set!"); 268 } 269 OEvoabDatabaseMetaData::~OEvoabDatabaseMetaData() 270 { 271 } 272 273 // ------------------------------------------------------------------------- 274 ODatabaseMetaDataResultSet::ORows& OEvoabDatabaseMetaData::getColumnRows( const ::rtl::OUString& columnNamePattern ) 275 { 276 static ODatabaseMetaDataResultSet::ORows aRows; 277 ODatabaseMetaDataResultSet::ORow aRow(19); 278 aRows.clear(); 279 280 // **************************************************** 281 // Some entries in a row never change, so set them now 282 // **************************************************** 283 284 // Catalog 285 aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("")); 286 // Schema 287 aRow[2] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("")); 288 // COLUMN_SIZE 289 aRow[7] = new ORowSetValueDecorator(s_nCOLUMN_SIZE); 290 // BUFFER_LENGTH, not used 291 aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue(); 292 // DECIMAL_DIGITS. 293 aRow[9] = new ORowSetValueDecorator(s_nDECIMAL_DIGITS); 294 // NUM_PREC_RADIX 295 aRow[10] = new ORowSetValueDecorator((sal_Int32)10); 296 // NULLABLE 297 aRow[11] = new ORowSetValueDecorator(s_nNULLABLE); 298 // REMARKS 299 aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue(); 300 // COULUMN_DEF, not used 301 aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue(); 302 // SQL_DATA_TYPE, not used 303 aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue(); 304 // SQL_DATETIME_SUB, not used 305 aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue(); 306 // CHAR_OCTET_LENGTH, refer to [5] 307 aRow[16] = new ORowSetValueDecorator(s_nCHAR_OCTET_LENGTH); 308 // IS_NULLABLE 309 aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii( "YES" )); 310 311 312 aRow[3] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii( "TABLE" )); 313 ::osl::MutexGuard aGuard( m_aMutex ); 314 315 initFields(); 316 for (sal_Int32 i = 0; i < (sal_Int32) nFields; i++) 317 { 318 if( match( columnNamePattern, getFieldName( i ), '\0' ) ) 319 { 320 aRow[5] = new ORowSetValueDecorator( static_cast<sal_Int16>( getFieldType( i ) ) ); 321 aRow[6] = new ORowSetValueDecorator( getFieldTypeName( i ) ); 322 323 OSL_TRACE( "ColumnName = '%s'", g_param_spec_get_name( pFields[i]->pField ) ); 324 // COLUMN_NAME 325 aRow[4] = new ORowSetValueDecorator( getFieldName( i ) ); 326 // ORDINAL_POSITION 327 aRow[17] = new ORowSetValueDecorator( i ); 328 aRows.push_back( aRow ); 329 } 330 } 331 332 return aRows ; 333 } 334 // ------------------------------------------------------------------------- 335 ::rtl::OUString OEvoabDatabaseMetaData::impl_getCatalogSeparator_throw( ) 336 { 337 return ::rtl::OUString(); 338 } 339 // ------------------------------------------------------------------------- 340 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) 341 { 342 return 0;// 0 means no limit 343 } 344 // ------------------------------------------------------------------------- 345 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) 346 { 347 return 0;// 0 means no limit 348 } 349 // ------------------------------------------------------------------------- 350 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) 351 { 352 return 0;// 0 means no limit 353 } 354 // ------------------------------------------------------------------------- 355 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) 356 { 357 return 0;// 0 means no limit 358 } 359 // ------------------------------------------------------------------------- 360 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) 361 { 362 return 0;// 0 means no limit 363 } 364 // ------------------------------------------------------------------------- 365 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) 366 { 367 return 0;// 0 means no limit 368 } 369 // ------------------------------------------------------------------------- 370 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) 371 { 372 return 0;// 0 means no limit 373 } 374 // ------------------------------------------------------------------------- 375 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) 376 { 377 return 0;// 0 means no limit 378 } 379 // ------------------------------------------------------------------------- 380 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) 381 { 382 return 0;// 0 means no limit 383 } 384 // ------------------------------------------------------------------------- 385 sal_Int32 OEvoabDatabaseMetaData::impl_getMaxStatements_throw( ) 386 { 387 return 0;// 0 means no limit 388 } 389 // ------------------------------------------------------------------------- 390 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) 391 { 392 return 0;// 0 means no limit 393 } 394 // ------------------------------------------------------------------------- 395 sal_Int32 OEvoabDatabaseMetaData::impl_getMaxTablesInSelect_throw( ) 396 { 397 // We only support a single table 398 return 1; 399 } 400 // ------------------------------------------------------------------------- 401 // ------------------------------------------------------------------------- 402 sal_Bool SAL_CALL OEvoabDatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) 403 { 404 return sal_False; 405 } 406 // ------------------------------------------------------------------------- 407 sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) 408 { 409 return sal_False; 410 } 411 // ------------------------------------------------------------------------- 412 sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) 413 { 414 return sal_False; 415 } 416 // ------------------------------------------------------------------------- 417 sal_Bool OEvoabDatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( ) 418 { 419 return sal_False; 420 } 421 // ------------------------------------------------------------------------- 422 sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) 423 { 424 return sal_False; 425 } 426 // ------------------------------------------------------------------------- 427 sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) 428 { 429 return sal_False; 430 } 431 // ------------------------------------------------------------------------- 432 sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) 433 { 434 return sal_False; 435 } 436 // ------------------------------------------------------------------------- 437 sal_Bool OEvoabDatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( ) 438 { 439 return sal_False; 440 } 441 // ------------------------------------------------------------------------- 442 sal_Bool OEvoabDatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( ) 443 { 444 return sal_False; 445 } 446 // ------------------------------------------------------------------------- 447 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) 448 { 449 return 0;// 0 means no limit 450 } 451 // ------------------------------------------------------------------------- 452 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) 453 { 454 return sal_False; 455 } 456 // ------------------------------------------------------------------------- 457 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) 458 { 459 ::rtl::OUString aVal; 460 return aVal; 461 } 462 // ------------------------------------------------------------------------- 463 ::rtl::OUString OEvoabDatabaseMetaData::impl_getIdentifierQuoteString_throw( ) 464 { 465 // normally this is " 466 ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("\""); 467 return aVal; 468 } 469 // ------------------------------------------------------------------------- 470 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) 471 { 472 ::rtl::OUString aVal; 473 return aVal; 474 } 475 // ------------------------------------------------------------------------- 476 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) 477 { 478 return sal_False; 479 } 480 // ------------------------------------------------------------------------- 481 sal_Bool OEvoabDatabaseMetaData::impl_isCatalogAtStart_throw( ) 482 { 483 sal_Bool bValue = sal_False; 484 return bValue; 485 } 486 // ------------------------------------------------------------------------- 487 sal_Bool SAL_CALL OEvoabDatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) 488 { 489 return sal_True; 490 } 491 // ------------------------------------------------------------------------- 492 sal_Bool SAL_CALL OEvoabDatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) 493 { 494 return sal_True; 495 } 496 // ------------------------------------------------------------------------- 497 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) 498 { 499 return sal_True; 500 } 501 // ------------------------------------------------------------------------- 502 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) 503 { 504 return sal_True; 505 } 506 // ------------------------------------------------------------------------- 507 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) 508 { 509 return sal_False; 510 } 511 // ------------------------------------------------------------------------- 512 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) 513 { 514 return sal_False; 515 } 516 // ------------------------------------------------------------------------- 517 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) 518 { 519 return sal_False; 520 } 521 // ------------------------------------------------------------------------- 522 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) 523 { 524 return sal_False; 525 } 526 // ------------------------------------------------------------------------- 527 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) 528 { 529 return sal_False; 530 } 531 // ------------------------------------------------------------------------- 532 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) 533 { 534 return sal_False; 535 } 536 // ------------------------------------------------------------------------- 537 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException) 538 { 539 return sal_False; 540 } 541 // ------------------------------------------------------------------------- 542 sal_Bool OEvoabDatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( ) 543 { 544 return sal_False; 545 } 546 // ------------------------------------------------------------------------- 547 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) 548 { 549 return sal_False; 550 } 551 // ------------------------------------------------------------------------- 552 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) 553 { 554 return sal_True; // should be supported at least 555 } 556 // ------------------------------------------------------------------------- 557 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) 558 { 559 return sal_False; 560 } 561 // ------------------------------------------------------------------------- 562 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) 563 { 564 return sal_False; 565 } 566 // ------------------------------------------------------------------------- 567 sal_Bool OEvoabDatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( ) 568 { 569 return sal_False; 570 } 571 // ------------------------------------------------------------------------- 572 sal_Bool OEvoabDatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( ) 573 { 574 return sal_False; 575 } 576 // ------------------------------------------------------------------------- 577 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) 578 { 579 return sal_False; 580 } 581 // ------------------------------------------------------------------------- 582 sal_Bool OEvoabDatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( ) 583 { 584 return sal_False; 585 } 586 // ------------------------------------------------------------------------- 587 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) 588 { 589 return sal_False; 590 } 591 // ------------------------------------------------------------------------- 592 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) 593 { 594 return 0;// 0 means no limit 595 } 596 // ------------------------------------------------------------------------- 597 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) 598 { 599 return 0;// 0 means no limit 600 } 601 // ------------------------------------------------------------------------- 602 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) 603 { 604 return 0;// 0 means no limit 605 } 606 // ------------------------------------------------------------------------- 607 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) 608 { 609 return sal_False; 610 } 611 // ------------------------------------------------------------------------- 612 sal_Bool SAL_CALL OEvoabDatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) 613 { 614 return sal_False; 615 } 616 // ------------------------------------------------------------------------- 617 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) 618 { 619 return sal_False; 620 } 621 // ------------------------------------------------------------------------- 622 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) 623 { 624 return sal_False; 625 } 626 // ------------------------------------------------------------------------- 627 sal_Bool SAL_CALL OEvoabDatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) 628 { 629 // We allow you to select from any table. 630 return sal_True; 631 } 632 // ------------------------------------------------------------------------- 633 sal_Bool SAL_CALL OEvoabDatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) 634 { 635 // For now definately read-only, no support for update/delete 636 return sal_True; 637 } 638 // ------------------------------------------------------------------------- 639 sal_Bool SAL_CALL OEvoabDatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) 640 { 641 return sal_False; 642 } 643 // ------------------------------------------------------------------------- 644 sal_Bool SAL_CALL OEvoabDatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) 645 { 646 return sal_False; 647 } 648 // ------------------------------------------------------------------------- 649 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) 650 { 651 return sal_False; 652 } 653 // ------------------------------------------------------------------------- 654 sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) 655 { 656 return sal_False; 657 } 658 // ------------------------------------------------------------------------- 659 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) 660 { 661 // todo add Support for this. 662 return sal_False; 663 } 664 // ------------------------------------------------------------------------- 665 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) 666 { 667 return sal_False; 668 } 669 // ------------------------------------------------------------------------- 670 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException) 671 { 672 return sal_False; 673 } 674 // ------------------------------------------------------------------------- 675 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) 676 { 677 return sal_False; 678 } 679 // ------------------------------------------------------------------------- 680 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) 681 { 682 return sal_False; 683 } 684 // ------------------------------------------------------------------------- 685 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) 686 { 687 return sal_False; 688 } 689 // ------------------------------------------------------------------------- 690 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) 691 { 692 return sal_False; 693 } 694 // ------------------------------------------------------------------------- 695 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) 696 { 697 return sal_False; 698 } 699 // ------------------------------------------------------------------------- 700 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) 701 { 702 return sal_False; 703 } 704 // ------------------------------------------------------------------------- 705 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) 706 { 707 return sal_False; 708 } 709 // ------------------------------------------------------------------------- 710 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) 711 { 712 return sal_False; 713 } 714 // ------------------------------------------------------------------------- 715 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) 716 { 717 return sal_False; 718 } 719 // ------------------------------------------------------------------------- 720 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) 721 { 722 return sal_False; 723 } 724 // ------------------------------------------------------------------------- 725 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) 726 { 727 return sal_False; 728 } 729 // ------------------------------------------------------------------------- 730 sal_Bool OEvoabDatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( ) 731 { 732 // Any case may be used 733 return sal_True; 734 } 735 // ------------------------------------------------------------------------- 736 sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) 737 { 738 return sal_False; 739 } 740 // ------------------------------------------------------------------------- 741 sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) 742 { 743 return sal_True; 744 } 745 // ------------------------------------------------------------------------- 746 sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) 747 { 748 return sal_False; 749 } 750 // ------------------------------------------------------------------------- 751 sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) 752 { 753 return sal_True; 754 } 755 // ------------------------------------------------------------------------- 756 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) 757 { 758 return sal_False; 759 } 760 // ------------------------------------------------------------------------- 761 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) 762 { 763 return sal_False; 764 } 765 // ------------------------------------------------------------------------- 766 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) 767 { 768 return sal_False; 769 } 770 // ------------------------------------------------------------------------- 771 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) 772 { 773 return sal_False; 774 } 775 // ------------------------------------------------------------------------- 776 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) 777 { 778 return sal_False; 779 } 780 // ------------------------------------------------------------------------- 781 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) 782 { 783 return sal_False; 784 } 785 // ------------------------------------------------------------------------- 786 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) 787 { 788 return sal_False; 789 } 790 // ------------------------------------------------------------------------- 791 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) 792 { 793 return sal_False; 794 } 795 // ------------------------------------------------------------------------- 796 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) 797 { 798 return sal_False; 799 } 800 // ------------------------------------------------------------------------- 801 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) 802 { 803 return sal_False; 804 } 805 // ------------------------------------------------------------------------- 806 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) 807 { 808 ::osl::MutexGuard aGuard( m_aMutex ); 809 810 return m_pConnection->getURL(); 811 } 812 // ------------------------------------------------------------------------- 813 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) 814 { 815 ::rtl::OUString aValue; 816 return aValue; 817 } 818 // ------------------------------------------------------------------------- 819 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) 820 { 821 ::rtl::OUString aValue; 822 return aValue; 823 } 824 // ------------------------------------------------------------------------- 825 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException) 826 { 827 ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)1); 828 return aValue; 829 } 830 // ------------------------------------------------------------------------- 831 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) 832 { 833 ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)0); 834 return aValue; 835 } 836 // ------------------------------------------------------------------------- 837 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) 838 { 839 ::rtl::OUString aValue; 840 return aValue; 841 } 842 // ------------------------------------------------------------------------- 843 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) 844 { 845 ::rtl::OUString aValue; 846 return aValue; 847 } 848 // ------------------------------------------------------------------------- 849 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) 850 { 851 ::rtl::OUString aValue; 852 return aValue; 853 } 854 // ------------------------------------------------------------------------- 855 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) 856 { 857 return 1; 858 } 859 // ------------------------------------------------------------------------- 860 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) 861 { 862 return TransactionIsolation::NONE; 863 } 864 // ------------------------------------------------------------------------- 865 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) 866 { 867 return 0; 868 } 869 // ------------------------------------------------------------------------- 870 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) 871 { 872 ::rtl::OUString aValue; 873 return aValue; 874 } 875 // ------------------------------------------------------------------------- 876 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) 877 { 878 ::rtl::OUString aValue; 879 return aValue; 880 } 881 // ------------------------------------------------------------------------- 882 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) 883 { 884 return ::rtl::OUString(); 885 } 886 // ------------------------------------------------------------------------- 887 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) 888 { 889 return ::rtl::OUString(); 890 } 891 // ------------------------------------------------------------------------- 892 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) 893 { 894 return ::rtl::OUString(); 895 } 896 // ------------------------------------------------------------------------- 897 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) 898 { 899 return ::rtl::OUString(); 900 } 901 // ------------------------------------------------------------------------- 902 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) 903 { 904 return sal_False; 905 } 906 // ------------------------------------------------------------------------- 907 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) 908 { 909 return sal_False; 910 } 911 // ------------------------------------------------------------------------- 912 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) 913 { 914 return sal_True; 915 } 916 // ------------------------------------------------------------------------- 917 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) 918 { 919 return sal_False; 920 } 921 // ------------------------------------------------------------------------- 922 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) 923 { 924 return sal_False; 925 } 926 // ------------------------------------------------------------------------- 927 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) 928 { 929 return 0;// 0 means no limit 930 } 931 // ------------------------------------------------------------------------- 932 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) 933 { 934 return 0;// 0 means no limit 935 } 936 // ------------------------------------------------------------------------- 937 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) 938 { 939 return 0;// 0 means no limit 940 } 941 // ------------------------------------------------------------------------- 942 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) 943 { 944 return 0;// 0 means no limit 945 } 946 // ------------------------------------------------------------------------- 947 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) 948 { 949 return sal_False; 950 } 951 // ------------------------------------------------------------------------- 952 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException) 953 { 954 return sal_False; 955 } 956 // ------------------------------------------------------------------------- 957 sal_Bool SAL_CALL OEvoabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) 958 { 959 return sal_False; 960 } 961 // ------------------------------------------------------------------------- 962 sal_Bool SAL_CALL OEvoabDatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) 963 { 964 return sal_False; 965 } 966 // ------------------------------------------------------------------------- 967 sal_Bool SAL_CALL OEvoabDatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) 968 { 969 return sal_False; 970 } 971 // ------------------------------------------------------------------------- 972 sal_Bool SAL_CALL OEvoabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) 973 { 974 return sal_False; 975 } 976 // ------------------------------------------------------------------------- 977 sal_Bool SAL_CALL OEvoabDatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) 978 { 979 return sal_False; 980 } 981 // ------------------------------------------------------------------------- 982 sal_Bool SAL_CALL OEvoabDatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) 983 { 984 return sal_False; 985 } 986 // ------------------------------------------------------------------------- 987 sal_Bool SAL_CALL OEvoabDatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) 988 { 989 return sal_False; 990 } 991 // ------------------------------------------------------------------------- 992 sal_Bool SAL_CALL OEvoabDatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) 993 { 994 return sal_False; 995 } 996 // ------------------------------------------------------------------------- 997 sal_Bool SAL_CALL OEvoabDatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) 998 { 999 return sal_False; 1000 } 1001 // ------------------------------------------------------------------------- 1002 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) 1003 { 1004 return sal_False; 1005 } 1006 // ------------------------------------------------------------------------- 1007 // here follow all methods which return a resultset 1008 // the first methods is an example implementation how to use this resultset 1009 // of course you could implement it on your and you should do this because 1010 // the general way is more memory expensive 1011 // ------------------------------------------------------------------------- 1012 Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) 1013 { 1014 /* Dont need to change as evoab driver supports only table */ 1015 1016 // there exists no possibility to get table types so we have to check 1017 static ::rtl::OUString sTableTypes[] = 1018 { 1019 ::rtl::OUString::createFromAscii("TABLE"), 1020 // Currently we only support a 'TABLE' nothing more complex 1021 }; 1022 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes); 1023 Reference< XResultSet > xRef = pResult; 1024 1025 // here we fill the rows which should be visible when ask for data from the resultset returned here 1026 sal_Int32 nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString); 1027 ODatabaseMetaDataResultSet::ORows aRows; 1028 for(sal_Int32 i=0;i < nSize;++i) 1029 { 1030 ODatabaseMetaDataResultSet::ORow aRow; 1031 aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); 1032 aRow.push_back(new ORowSetValueDecorator(sTableTypes[i])); 1033 1034 // bound row 1035 aRows.push_back(aRow); 1036 } 1037 // here we set the rows at the resultset 1038 pResult->setRows(aRows); 1039 return xRef; 1040 } 1041 // ------------------------------------------------------------------------- 1042 Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) 1043 { 1044 /* 1045 * Return the proper type information required by evo driver 1046 */ 1047 1048 ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo); 1049 1050 Reference< XResultSet > xResultSet = pResultSet; 1051 static ODatabaseMetaDataResultSet::ORows aRows; 1052 1053 if(aRows.empty()) 1054 { 1055 ODatabaseMetaDataResultSet::ORow aRow; 1056 aRow.reserve(19); 1057 aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); 1058 aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR"))); 1059 aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR)); 1060 aRow.push_back(new ORowSetValueDecorator((sal_Int32)s_nCHAR_OCTET_LENGTH)); 1061 aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); 1062 aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); 1063 aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); 1064 // aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE)); 1065 aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); 1066 aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); 1067 aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::FULL)); 1068 aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); 1069 aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); 1070 aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); 1071 aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); 1072 aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); 1073 aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); 1074 aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); 1075 aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); 1076 aRow.push_back(new ORowSetValueDecorator((sal_Int32)10)); 1077 1078 aRows.push_back(aRow); 1079 1080 aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")); 1081 aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR); 1082 aRow[3] = new ORowSetValueDecorator((sal_Int32)65535); 1083 aRows.push_back(aRow); 1084 } 1085 pResultSet->setRows(aRows); 1086 return xResultSet; 1087 } 1088 // ------------------------------------------------------------------------- 1089 Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns( 1090 const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*tableNamePattern*/, 1091 const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) 1092 { 1093 // this returns an empty resultset where the column-names are already set 1094 // in special the metadata of the resultset already returns the right columns 1095 ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns ); 1096 Reference< XResultSet > xResultSet = pResultSet; 1097 pResultSet->setRows( getColumnRows( columnNamePattern ) ); 1098 return xResultSet; 1099 } 1100 // ------------------------------------------------------------------------- 1101 Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( 1102 const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, 1103 const ::rtl::OUString& /*tableNamePattern*/, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) 1104 { 1105 ::osl::MutexGuard aGuard( m_aMutex ); 1106 1107 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes); 1108 Reference< XResultSet > xRef = pResult; 1109 1110 // check if any type is given 1111 // when no types are given then we have to return all tables e.g. TABLE 1112 1113 const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); 1114 1115 sal_Bool bTableFound = sal_True; 1116 sal_Int32 nLength = types.getLength(); 1117 if(nLength) 1118 { 1119 bTableFound = sal_False; 1120 1121 const ::rtl::OUString* pBegin = types.getConstArray(); 1122 const ::rtl::OUString* pEnd = pBegin + nLength; 1123 for(;pBegin != pEnd;++pBegin) 1124 { 1125 if(*pBegin == aTable) 1126 { 1127 bTableFound = sal_True; 1128 break; 1129 } 1130 } 1131 } 1132 if(!bTableFound) 1133 return xRef; 1134 1135 ODatabaseMetaDataResultSet::ORows aRows; 1136 1137 ESourceList *pSourceList; 1138 if( !e_book_get_addressbooks (&pSourceList, NULL) ) 1139 pSourceList = NULL; 1140 1141 GSList *g; 1142 for( g = e_source_list_peek_groups( pSourceList ); g; g = g->next) 1143 { 1144 GSList *s; 1145 const char *p = e_source_group_peek_base_uri(E_SOURCE_GROUP(g->data)); 1146 1147 switch (m_pConnection->getSDBCAddressType()) { 1148 case SDBCAddress::EVO_GWISE: 1149 if (0==strncmp( "groupwise://", p, 11 )) 1150 break; 1151 else 1152 continue; 1153 case SDBCAddress::EVO_LOCAL: 1154 if (0==strncmp( "file://", p, 6 )) 1155 break; 1156 else 1157 continue; 1158 case SDBCAddress::EVO_LDAP: 1159 if (0==strncmp( "ldap://", p, 6 )) 1160 break; 1161 else 1162 continue; 1163 case SDBCAddress::Unknown: 1164 break; 1165 } 1166 for (s = e_source_group_peek_sources (E_SOURCE_GROUP (g->data)); s; s = s->next) 1167 { 1168 ESource *pSource = E_SOURCE (s->data); 1169 1170 rtl::OUString aName = rtl::OStringToOUString( e_source_peek_name( pSource ), 1171 RTL_TEXTENCODING_UTF8 ); 1172 1173 ODatabaseMetaDataResultSet::ORow aRow(3); 1174 aRow.reserve(6); 1175 aRow.push_back(new ORowSetValueDecorator(aName)); 1176 aRow.push_back(new ORowSetValueDecorator(aTable)); 1177 aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); 1178 aRows.push_back(aRow); 1179 } 1180 } 1181 1182 pResult->setRows(aRows); 1183 1184 return xRef; 1185 } 1186 // ------------------------------------------------------------------------- 1187 Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException) 1188 { 1189 ::dbtools::throwFeatureNotImplementedException( "XDatabaseMetaDaza::getUDTs", *this ); 1190 return NULL; 1191 } 1192 // ----------------------------------------------------------------------------- 1193