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 "FDatabaseMetaDataResultSetMetaData.hxx" 31 #include <com/sun/star/sdbc/DataType.hpp> 32 #include <com/sun/star/sdbc/ProcedureResult.hpp> 33 #include <com/sun/star/sdbc/ColumnValue.hpp> 34 35 using namespace connectivity; 36 using namespace ::com::sun::star::beans; 37 using namespace ::com::sun::star::uno; 38 using namespace ::com::sun::star::sdbcx; 39 using namespace ::com::sun::star::sdbc; 40 using namespace ::com::sun::star::container; 41 using namespace ::com::sun::star::lang; 42 43 // ------------------------------------------------------------------------- 44 ODatabaseMetaDataResultSetMetaData::~ODatabaseMetaDataResultSetMetaData() 45 { 46 } 47 // ------------------------------------------------------------------------- 48 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) 49 { 50 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 51 return (*m_mColumnsIter).second.getColumnDisplaySize(); 52 53 return 0; 54 } 55 // ------------------------------------------------------------------------- 56 57 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) 58 { 59 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 60 return (*m_mColumnsIter).second.getColumnType(); 61 return 1; 62 } 63 // ------------------------------------------------------------------------- 64 65 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) 66 { 67 return m_mColumns.size(); 68 } 69 // ------------------------------------------------------------------------- 70 71 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) 72 { 73 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 74 return (*m_mColumnsIter).second.isCaseSensitive(); 75 return sal_True; 76 } 77 // ------------------------------------------------------------------------- 78 79 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getSchemaName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) 80 { 81 return ::rtl::OUString(); 82 } 83 // ------------------------------------------------------------------------- 84 85 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) 86 { 87 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 88 return (*m_mColumnsIter).second.getColumnName(); 89 return ::rtl::OUString(); 90 } 91 // ------------------------------------------------------------------------- 92 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) 93 { 94 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 95 return (*m_mColumnsIter).second.getTableName(); 96 return ::rtl::OUString(); 97 } 98 // ------------------------------------------------------------------------- 99 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getCatalogName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) 100 { 101 return ::rtl::OUString(); 102 } 103 // ------------------------------------------------------------------------- 104 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) 105 { 106 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 107 return (*m_mColumnsIter).second.getColumnTypeName(); 108 return ::rtl::OUString(); 109 } 110 // ------------------------------------------------------------------------- 111 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) 112 { 113 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 114 return (*m_mColumnsIter).second.getColumnLabel(); 115 return getColumnName(column); 116 } 117 // ------------------------------------------------------------------------- 118 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) 119 { 120 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 121 return (*m_mColumnsIter).second.getColumnServiceName(); 122 return ::rtl::OUString(); 123 } 124 // ------------------------------------------------------------------------- 125 126 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) 127 { 128 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 129 return (*m_mColumnsIter).second.isCurrency(); 130 return sal_False; 131 } 132 // ------------------------------------------------------------------------- 133 134 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) 135 { 136 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 137 return (*m_mColumnsIter).second.isAutoIncrement(); 138 return sal_False; 139 } 140 // ------------------------------------------------------------------------- 141 142 143 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) 144 { 145 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 146 return (*m_mColumnsIter).second.isSigned(); 147 return sal_False; 148 } 149 // ------------------------------------------------------------------------- 150 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) 151 { 152 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 153 return (*m_mColumnsIter).second.getPrecision(); 154 return 0; 155 } 156 // ------------------------------------------------------------------------- 157 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 158 { 159 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 160 return (*m_mColumnsIter).second.getScale(); 161 162 return 0; 163 } 164 // ------------------------------------------------------------------------- 165 166 sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) 167 { 168 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 169 return (*m_mColumnsIter).second.isNullable(); 170 171 return sal_False; 172 } 173 // ------------------------------------------------------------------------- 174 175 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) 176 { 177 if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 178 return (*m_mColumnsIter).second.isSearchable(); 179 return sal_True; 180 } 181 // ------------------------------------------------------------------------- 182 183 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isReadOnly( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) 184 { 185 // if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 186 // return (*m_mColumnsIter).second.isReadOnly(); 187 188 return sal_True; 189 } 190 // ------------------------------------------------------------------------- 191 192 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isDefinitelyWritable( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException) 193 { 194 // if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 195 // return (*m_mColumnsIter).second.isDefinitelyWritable(); 196 197 return sal_False; 198 ; 199 } 200 // ------------------------------------------------------------------------- 201 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) 202 { 203 // if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) 204 // return (*m_mColumnsIter).second.isWritable(); 205 return isDefinitelyWritable(column); 206 } 207 // ------------------------------------------------------------------------- 208 void ODatabaseMetaDataResultSetMetaData::setColumnPrivilegesMap() 209 { 210 setColumnMap(); 211 m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("GRANTOR"), 212 ColumnValue::NULLABLE, 213 3,3,0, 214 DataType::VARCHAR); 215 m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("GRANTEE"), 216 ColumnValue::NULLABLE, 217 3,3,0, 218 DataType::VARCHAR); 219 m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRIVILEGE"), 220 ColumnValue::NULLABLE, 221 3,3,0, 222 DataType::VARCHAR); 223 m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_GRANTABLE"), 224 ColumnValue::NULLABLE, 225 3,3,0, 226 DataType::VARCHAR); 227 } 228 // ----------------------------------------------------------------------------- 229 void ODatabaseMetaDataResultSetMetaData::setTableNameMap() 230 { 231 m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_CAT"), 232 ColumnValue::NULLABLE, 233 3,3,0, 234 DataType::VARCHAR); 235 m_mColumns[2] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_SCHEM"), 236 ColumnValue::NULLABLE, 237 3,3,0, 238 DataType::VARCHAR); 239 m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_NAME"), 240 ColumnValue::NO_NULLS, 241 3,3,0, 242 DataType::VARCHAR); 243 } 244 // ----------------------------------------------------------------------------- 245 void ODatabaseMetaDataResultSetMetaData::setColumnMap() 246 { 247 setTableNameMap(); 248 m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_NAME"), 249 ColumnValue::NO_NULLS, 250 3,3,0, 251 DataType::VARCHAR); 252 } 253 // ------------------------------------------------------------------------- 254 void ODatabaseMetaDataResultSetMetaData::setColumnsMap() 255 { 256 setColumnMap(); 257 258 m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DATA_TYPE"), 259 ColumnValue::NO_NULLS, 260 0,0,0, 261 DataType::INTEGER); 262 m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE_NAME"), 263 ColumnValue::NO_NULLS, 264 0,0,0, 265 DataType::VARCHAR); 266 m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_SIZE"), 267 ColumnValue::NO_NULLS, 268 3,3,0, 269 DataType::INTEGER); 270 m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("BUFFER_LENGTH"), 271 ColumnValue::NULLABLE, 272 3,3,0, 273 DataType::INTEGER); 274 m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DECIMAL_DIGITS"), 275 ColumnValue::NO_NULLS, 276 0,0,0, 277 DataType::INTEGER); 278 m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NUM_PREC_RADIX"), 279 ColumnValue::NO_NULLS, 280 0,0,0, 281 DataType::INTEGER); 282 m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"), 283 ColumnValue::NO_NULLS, 284 1,1,0, 285 DataType::INTEGER); 286 m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"), 287 ColumnValue::NULLABLE, 288 0,0,0, 289 DataType::VARCHAR); 290 m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_DEF"), 291 ColumnValue::NULLABLE, 292 0,0,0, 293 DataType::VARCHAR); 294 m_mColumns[14] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATA_TYPE"), 295 ColumnValue::NO_NULLS, 296 1,1,0, 297 DataType::INTEGER); 298 m_mColumns[15] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATETIME_SUB"), 299 ColumnValue::NO_NULLS, 300 1,1,0, 301 DataType::INTEGER); 302 m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("CHAR_OCTET_LENGTH"), 303 ColumnValue::NO_NULLS, 304 1,1,0, 305 DataType::INTEGER); 306 m_mColumns[17] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("ORDINAL_POSITION"), 307 ColumnValue::NO_NULLS, 308 1,1,0, 309 DataType::INTEGER); 310 m_mColumns[18] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_NULLABLE"), 311 ColumnValue::NO_NULLS, 312 1,1,0, 313 DataType::VARCHAR); 314 } 315 // ------------------------------------------------------------------------- 316 void ODatabaseMetaDataResultSetMetaData::setTablesMap() 317 { 318 setTableNameMap(); 319 m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_TYPE"), 320 ColumnValue::NO_NULLS, 321 0,0,0, 322 DataType::VARCHAR); 323 m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"), 324 ColumnValue::NULLABLE, 325 0,0,0, 326 DataType::VARCHAR); 327 } 328 // ------------------------------------------------------------------------- 329 void ODatabaseMetaDataResultSetMetaData::setProcedureNameMap() 330 { 331 m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PROCEDURE_CAT"), 332 ColumnValue::NULLABLE, 333 0,0,0, 334 DataType::VARCHAR); 335 m_mColumns[2] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PROCEDURE_SCHEM"), 336 ColumnValue::NULLABLE, 337 0,0,0, 338 DataType::VARCHAR); 339 m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PROCEDURE_NAME"), 340 ColumnValue::NO_NULLS, 341 0,0,0, 342 DataType::VARCHAR); 343 } 344 // ------------------------------------------------------------------------- 345 void ODatabaseMetaDataResultSetMetaData::setProcedureColumnsMap() 346 { 347 setProcedureNameMap(); 348 m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_NAME"), 349 ColumnValue::NO_NULLS, 350 0,0,0, 351 DataType::VARCHAR); 352 m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_TYPE"), 353 ColumnValue::NO_NULLS, 354 0,0,0, 355 DataType::INTEGER); 356 m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DATA_TYPE"), 357 ColumnValue::NO_NULLS, 358 0,0,0, 359 DataType::INTEGER); 360 m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE_NAME"), 361 ColumnValue::NULLABLE, 362 0,0,0, 363 DataType::VARCHAR); 364 m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRECISION"), 365 ColumnValue::NO_NULLS, 366 0,0,0, 367 DataType::INTEGER); 368 m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("LENGTH"), 369 ColumnValue::NO_NULLS, 370 0,0,0, 371 DataType::INTEGER); 372 m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SCALE"), 373 ColumnValue::NO_NULLS, 374 0,0,0, 375 DataType::INTEGER); 376 m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("RADIX"), 377 ColumnValue::NO_NULLS, 378 0,0,0, 379 DataType::INTEGER); 380 m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"), 381 ColumnValue::NO_NULLS, 382 0,0,0, 383 DataType::INTEGER); 384 m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"), 385 ColumnValue::NULLABLE, 386 0,0,0, 387 DataType::VARCHAR); 388 389 } 390 // ------------------------------------------------------------------------- 391 void ODatabaseMetaDataResultSetMetaData::setPrimaryKeysMap() 392 { 393 setColumnMap(); 394 m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("KEY_SEQ"), 395 ColumnValue::NO_NULLS, 396 1,1,0, 397 DataType::INTEGER); 398 m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PK_NAME"), 399 ColumnValue::NULLABLE, 400 0,0,0, 401 DataType::VARCHAR); 402 } 403 // ------------------------------------------------------------------------- 404 void ODatabaseMetaDataResultSetMetaData::setIndexInfoMap() 405 { 406 setTableNameMap(); 407 m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NON_UNIQUE"), 408 ColumnValue::NO_NULLS, 409 1,1,0, 410 DataType::BIT); 411 m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("INDEX_QUALIFIER"), 412 ColumnValue::NULLABLE, 413 0,0,0, 414 DataType::VARCHAR); 415 m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("INDEX_NAME"), 416 ColumnValue::NULLABLE, 417 0,0,0, 418 DataType::VARCHAR); 419 m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE"), 420 ColumnValue::NO_NULLS, 421 0,0,0, 422 DataType::INTEGER); 423 m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("ORDINAL_POSITION"), 424 ColumnValue::NO_NULLS, 425 0,0,0, 426 DataType::INTEGER); 427 m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_NAME"), 428 ColumnValue::NO_NULLS, 429 0,0,0, 430 DataType::VARCHAR); 431 m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("ASC_OR_DESC"), 432 ColumnValue::NULLABLE, 433 0,0,0, 434 DataType::VARCHAR); 435 m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("CARDINALITY"), 436 ColumnValue::NO_NULLS, 437 0,0,0, 438 DataType::INTEGER); 439 m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PAGES"), 440 ColumnValue::NO_NULLS, 441 0,0,0, 442 DataType::INTEGER); 443 m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FILTER_CONDITION"), 444 ColumnValue::NULLABLE, 445 0,0,0, 446 DataType::VARCHAR); 447 } 448 // ------------------------------------------------------------------------- 449 void ODatabaseMetaDataResultSetMetaData::setTablePrivilegesMap() 450 { 451 setTableNameMap(); 452 m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("GRANTOR"), 453 ColumnValue::NULLABLE, 454 0,0,0, 455 DataType::VARCHAR); 456 m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("GRANTEE"), 457 ColumnValue::NO_NULLS, 458 0,0,0, 459 DataType::VARCHAR); 460 m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRIVILEGE"), 461 ColumnValue::NULLABLE, 462 0,0,0, 463 DataType::VARCHAR); 464 m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_GRANTABLE"), 465 ColumnValue::NULLABLE, 466 0,0,0, 467 DataType::VARCHAR); 468 } 469 // ------------------------------------------------------------------------- 470 void ODatabaseMetaDataResultSetMetaData::setCrossReferenceMap() 471 { 472 m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PKTABLE_CAT"), 473 ColumnValue::NULLABLE, 474 0,0,0, 475 DataType::VARCHAR); 476 m_mColumns[2] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PKTABLE_SCHEM"), 477 ColumnValue::NULLABLE, 478 0,0,0, 479 DataType::VARCHAR); 480 m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PKTABLE_NAME"), 481 ColumnValue::NO_NULLS, 482 0,0,0, 483 DataType::VARCHAR); 484 m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PKCOLUMN_NAME"), 485 ColumnValue::NO_NULLS, 486 0,0,0, 487 DataType::VARCHAR); 488 m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FKTABLE_CAT"), 489 ColumnValue::NULLABLE, 490 0,0,0, 491 DataType::VARCHAR); 492 m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FKTABLE_SCHEM"), 493 ColumnValue::NULLABLE, 494 0,0,0, 495 DataType::VARCHAR); 496 m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FKTABLE_NAME"), 497 ColumnValue::NO_NULLS, 498 0,0,0, 499 DataType::VARCHAR); 500 m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FKCOLUMN_NAME"), 501 ColumnValue::NO_NULLS, 502 0,0,0, 503 DataType::VARCHAR); 504 505 m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("KEY_SEQ"), 506 ColumnValue::NO_NULLS, 507 1,1,0, 508 DataType::INTEGER); 509 m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("UPDATE_RULE"), 510 ColumnValue::NO_NULLS, 511 1,1,0, 512 DataType::INTEGER); 513 m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DELETE_RULE"), 514 ColumnValue::NO_NULLS, 515 1,1,0, 516 DataType::INTEGER); 517 m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FK_NAME"), 518 ColumnValue::NULLABLE, 519 0,0,0, 520 DataType::VARCHAR); 521 m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PK_NAME"), 522 ColumnValue::NULLABLE, 523 0,0,0, 524 DataType::VARCHAR); 525 m_mColumns[14] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DEFERRABILITY"), 526 ColumnValue::NO_NULLS, 527 1,1,0, 528 DataType::INTEGER); 529 } 530 // ------------------------------------------------------------------------- 531 void ODatabaseMetaDataResultSetMetaData::setTypeInfoMap() 532 { 533 m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE_NAME"), 534 ColumnValue::NO_NULLS, 535 0,0,0, 536 DataType::VARCHAR); 537 m_mColumns[2] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DATA_TYPE"), 538 ColumnValue::NO_NULLS, 539 1,1,0, 540 DataType::INTEGER); 541 m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRECISION"), 542 ColumnValue::NO_NULLS, 543 1,1,0, 544 DataType::INTEGER); 545 m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("LITERAL_PREFIX"), 546 ColumnValue::NULLABLE, 547 0,0,0, 548 DataType::VARCHAR); 549 m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("LITERAL_SUFFIX"), 550 ColumnValue::NULLABLE, 551 0,0,0, 552 DataType::VARCHAR); 553 m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("CREATE_PARAMS"), 554 ColumnValue::NULLABLE, 555 0,0,0, 556 DataType::VARCHAR); 557 m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"), 558 ColumnValue::NO_NULLS, 559 1,1,0, 560 DataType::INTEGER); 561 m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("CASE_SENSITIVE"), 562 ColumnValue::NO_NULLS, 563 1,1,0, 564 DataType::BIT); 565 m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SEARCHABLE"), 566 ColumnValue::NO_NULLS, 567 1,1,0, 568 DataType::INTEGER); 569 m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("UNSIGNED_ATTRIBUTE"), 570 ColumnValue::NO_NULLS, 571 1,1,0, 572 DataType::BIT); 573 m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("FIXED_PREC_SCALE"), 574 ColumnValue::NO_NULLS, 575 1,1,0, 576 DataType::BIT); 577 m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("AUTO_INCREMENT"), 578 ColumnValue::NO_NULLS, 579 1,1,0, 580 DataType::BIT); 581 m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("LOCAL_TYPE_NAME"), 582 ColumnValue::NO_NULLS, 583 0,0,0, 584 DataType::VARCHAR); 585 m_mColumns[14] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("MINIMUM_SCALE"), 586 ColumnValue::NO_NULLS, 587 0,0,0, 588 DataType::INTEGER); 589 m_mColumns[15] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("MAXIMUM_SCALE"), 590 ColumnValue::NO_NULLS, 591 0,0,0, 592 DataType::INTEGER); 593 m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATA_TYPE"), 594 ColumnValue::NO_NULLS, 595 1,1,0, 596 DataType::INTEGER); 597 m_mColumns[17] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATETIME_SUB"), 598 ColumnValue::NO_NULLS, 599 1,1,0, 600 DataType::INTEGER); 601 m_mColumns[18] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NUM_PREC_RADIX"), 602 ColumnValue::NO_NULLS, 603 1,1,0, 604 DataType::INTEGER); 605 } 606 // ------------------------------------------------------------------------- 607 void ODatabaseMetaDataResultSetMetaData::setProceduresMap() 608 { 609 setProcedureNameMap(); 610 m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("RESERVED1"), 611 ColumnValue::NULLABLE, 612 0,0,0, 613 DataType::VARCHAR); 614 m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("RESERVED2"), 615 ColumnValue::NULLABLE, 616 0,0,0, 617 DataType::VARCHAR); 618 m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("RESERVED3"), 619 ColumnValue::NULLABLE, 620 0,0,0, 621 DataType::VARCHAR); 622 m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"), 623 ColumnValue::NULLABLE, 624 0,0,0, 625 DataType::VARCHAR); 626 m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PROCEDURE_TYPE"), 627 ColumnValue::NO_NULLS, 628 1,1,0, 629 DataType::INTEGER); 630 } 631 // ------------------------------------------------------------------------- 632 void ODatabaseMetaDataResultSetMetaData::setTableTypes() 633 { 634 m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_TYPE"), 635 ColumnValue::NULLABLE, 636 0,0,0, 637 DataType::VARCHAR); 638 } 639 // ------------------------------------------------------------------------- 640 void ODatabaseMetaDataResultSetMetaData::setCatalogsMap() 641 { 642 m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_CAT"), 643 ColumnValue::NULLABLE, 644 0,0,0, 645 DataType::VARCHAR); 646 } 647 // ------------------------------------------------------------------------- 648 void ODatabaseMetaDataResultSetMetaData::setSchemasMap() 649 { 650 m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TABLE_SCHEM"), 651 ColumnValue::NULLABLE, 652 0,0,0, 653 DataType::VARCHAR); 654 } 655 // ------------------------------------------------------------------------- 656 void ODatabaseMetaDataResultSetMetaData::setVersionColumnsMap() 657 { 658 m_mColumns[1] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SCOPE"), 659 ColumnValue::NO_NULLS, 660 0,0,0, 661 DataType::INTEGER); 662 m_mColumns[2] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_NAME"), 663 ColumnValue::NO_NULLS, 664 0,0,0, 665 DataType::VARCHAR); 666 m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DATA_TYPE"), 667 ColumnValue::NO_NULLS, 668 0,0,0, 669 DataType::INTEGER); 670 m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE_NAME"), 671 ColumnValue::NO_NULLS, 672 0,0,0, 673 DataType::VARCHAR); 674 m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_SIZE"), 675 ColumnValue::NO_NULLS, 676 0,0,0, 677 DataType::INTEGER); 678 m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("BUFFER_LENGTH"), 679 ColumnValue::NO_NULLS, 680 0,0,0, 681 DataType::INTEGER); 682 m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("DECIMAL_DIGITS"), 683 ColumnValue::NULLABLE, 684 0,0,0, 685 DataType::INTEGER); 686 m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PSEUDO_COLUMN"), 687 ColumnValue::NO_NULLS, 688 0,0,0, 689 DataType::INTEGER); 690 } 691 692 693