Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #include "MDatabaseMetaData.hxx"
11 : #include "FDatabaseMetaDataResultSet.hxx"
12 : #include <com/sun/star/sdbc/DataType.hpp>
13 : #include <com/sun/star/sdbc/ResultSetType.hpp>
14 : #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
15 : #include <com/sun/star/sdbc/TransactionIsolation.hpp>
16 : #include <connectivity/FValue.hxx>
17 : #include <com/sun/star/sdbc/ColumnValue.hpp>
18 : #include <com/sun/star/sdbc/ColumnSearch.hpp>
19 : #include "resource/common_res.hrc"
20 : #include <vector>
21 :
22 : #include "MDatabaseMetaDataHelper.hxx"
23 : #include "MorkParser.hxx"
24 : #include "connectivity/dbtools.hxx"
25 :
26 : using namespace dbtools;
27 : using namespace connectivity::mork;
28 : using namespace connectivity;
29 :
30 : using namespace com::sun::star::uno;
31 : using namespace com::sun::star::lang;
32 : using namespace com::sun::star::beans;
33 : using namespace com::sun::star::sdbc;
34 : using namespace com::sun::star::sdbcx;
35 :
36 :
37 : namespace connectivity
38 : {
39 : namespace mork
40 : {
41 : static sal_Int32 const s_nCOLUMN_SIZE = 256;
42 : static sal_Int32 const s_nDECIMAL_DIGITS = 0;
43 : static sal_Int32 const s_nNULLABLE = 1;
44 : static sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535;
45 : }
46 : }
47 :
48 3 : ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon)
49 3 : : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
50 3 : ,m_pConnection(_pCon)
51 : {
52 : OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
53 3 : m_pMetaDataHelper = new MDatabaseMetaDataHelper();
54 3 : }
55 : // -------------------------------------------------------------------------
56 3 : ODatabaseMetaData::~ODatabaseMetaData()
57 : {
58 1 : delete m_pMetaDataHelper;
59 2 : }
60 :
61 : // -------------------------------------------------------------------------
62 76 : ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
63 : const ::rtl::OUString& tableNamePattern,
64 : const ::rtl::OUString& columnNamePattern ) throw(SQLException)
65 : {
66 : SAL_INFO("connectivity.mork", "=> ODatabaseMetaData::getColumnRows()" );
67 : SAL_INFO("connectivity.mork", "tableNamePattern: " << tableNamePattern);
68 : SAL_INFO("connectivity.mork", "columnNamePattern: " << columnNamePattern);
69 :
70 76 : static ODatabaseMetaDataResultSet::ORows aRows;
71 76 : ODatabaseMetaDataResultSet::ORow aRow(19);
72 76 : aRows.clear();
73 :
74 76 : ::osl::MutexGuard aGuard( m_aMutex );
75 76 : ::std::vector< ::rtl::OUString > tables;
76 76 : if (!m_pMetaDataHelper->getTableStrings(m_pConnection, tables))
77 : {
78 0 : ::connectivity::SharedResources aResources;
79 : // TODO:
80 : // get better message here?
81 0 : const ::rtl::OUString sMessage = aResources.getResourceString(STR_UNKNOWN_COLUMN_TYPE);
82 0 : ::dbtools::throwGenericSQLException(sMessage ,*this);
83 : }
84 :
85 : // ****************************************************
86 : // Some entries in a row never change, so set them now
87 : // ****************************************************
88 :
89 : // Catalog
90 76 : aRow[1] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")));
91 : // Schema
92 76 : aRow[2] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")));
93 : // DATA_TYPE
94 76 : aRow[5] = new ORowSetValueDecorator(static_cast<sal_Int16>(DataType::VARCHAR));
95 : // TYPE_NAME, not used
96 76 : aRow[6] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VARCHAR")));
97 : // COLUMN_SIZE
98 76 : aRow[7] = new ORowSetValueDecorator(s_nCOLUMN_SIZE);
99 : // BUFFER_LENGTH, not used
100 76 : aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
101 : // DECIMAL_DIGITS.
102 76 : aRow[9] = new ORowSetValueDecorator(s_nDECIMAL_DIGITS);
103 : // NUM_PREC_RADIX
104 76 : aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
105 : // NULLABLE
106 76 : aRow[11] = new ORowSetValueDecorator(s_nNULLABLE);
107 : // REMARKS
108 76 : aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
109 : // COULUMN_DEF, not used
110 76 : aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
111 : // SQL_DATA_TYPE, not used
112 76 : aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
113 : // SQL_DATETIME_SUB, not used
114 76 : aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
115 : // CHAR_OCTET_LENGTH, refer to [5]
116 76 : aRow[16] = new ORowSetValueDecorator(s_nCHAR_OCTET_LENGTH);
117 : // IS_NULLABLE
118 76 : aRow[18] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("YES")));
119 :
120 : // Iterate over all tables
121 304 : for(size_t j = 0; j < tables.size(); j++ ) {
122 228 : if(match(tableNamePattern, tables[j],'\0')) {
123 : // TABLE_NAME
124 76 : aRow[3] = new ORowSetValueDecorator( tables[j] );
125 :
126 76 : const OColumnAlias& colNames = m_pConnection->getColumnAlias();
127 :
128 : SAL_INFO("connectivity.mork", "\tTableName = : " << tables[j]);
129 : // Iterate over all collumns in the table.
130 8664 : for ( OColumnAlias::AliasMap::const_iterator compare = colNames.begin();
131 5776 : compare != colNames.end();
132 : ++compare
133 : )
134 : {
135 2812 : if ( match( columnNamePattern, compare->first, '\0' ) )
136 : {
137 : SAL_INFO("connectivity.mork", "\t\tColumnNam : " << compare->first);
138 :
139 : // COLUMN_NAME
140 148 : aRow[4] = new ORowSetValueDecorator( compare->first );
141 : // ORDINAL_POSITION
142 148 : aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >( compare->second.columnPosition ) + 1 );
143 148 : aRows.push_back(aRow);
144 : }
145 : }
146 : }
147 : }
148 76 : return( aRows );
149 : }
150 : // -------------------------------------------------------------------------
151 2 : ::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
152 : {
153 2 : return ::rtl::OUString();
154 : }
155 : // -------------------------------------------------------------------------
156 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
157 : {
158 0 : sal_Int32 nValue = 65535; // 0 means no limit
159 0 : return nValue;
160 : }
161 : // -------------------------------------------------------------------------
162 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
163 : {
164 0 : sal_Int32 nValue = 0; // 0 means no limit
165 0 : return nValue;
166 : }
167 : // -------------------------------------------------------------------------
168 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
169 : {
170 0 : sal_Int32 nValue = 0; // 0 means no limit
171 0 : return nValue;
172 : }
173 : // -------------------------------------------------------------------------
174 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
175 : {
176 0 : sal_Int32 nValue = 254; // 0 means no limit
177 0 : return nValue;
178 : }
179 : // -------------------------------------------------------------------------
180 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
181 : {
182 0 : sal_Int32 nValue = 20; // 0 means no limit
183 0 : return nValue;
184 : }
185 : // -------------------------------------------------------------------------
186 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
187 : {
188 0 : sal_Int32 nValue = 0; // 0 means no limit
189 0 : return nValue;
190 : }
191 : // -------------------------------------------------------------------------
192 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
193 : {
194 0 : sal_Int32 nValue = 0; // 0 means no limit
195 0 : return nValue;
196 : }
197 : // -------------------------------------------------------------------------
198 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
199 : {
200 0 : sal_Int32 nValue = 0; // 0 means no limit
201 0 : return nValue;
202 : }
203 : // -------------------------------------------------------------------------
204 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
205 : {
206 0 : sal_Int32 nValue = 0; // 0 means no limit
207 0 : return nValue;
208 : }
209 : // -------------------------------------------------------------------------
210 0 : sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
211 : {
212 0 : return 0;
213 : }
214 : // -------------------------------------------------------------------------
215 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
216 : {
217 0 : sal_Int32 nValue = 0; // 0 means no limit
218 0 : return nValue;
219 : }
220 : // -------------------------------------------------------------------------
221 2 : sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
222 : {
223 : // We only support a single table
224 2 : return 1;
225 : }
226 : // -------------------------------------------------------------------------
227 : // -------------------------------------------------------------------------
228 0 : sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
229 : {
230 0 : return sal_False;
231 : }
232 : // -------------------------------------------------------------------------
233 0 : sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
234 : {
235 0 : return sal_False;
236 : }
237 : // -------------------------------------------------------------------------
238 0 : sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
239 : {
240 0 : return sal_False;
241 : }
242 : // -------------------------------------------------------------------------
243 0 : sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
244 : {
245 0 : return sal_False;
246 : }
247 : // -------------------------------------------------------------------------
248 0 : sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
249 : {
250 0 : return sal_False;
251 : }
252 : // -------------------------------------------------------------------------
253 0 : sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
254 : {
255 0 : return sal_False;
256 : }
257 : // -------------------------------------------------------------------------
258 0 : sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
259 : {
260 0 : return sal_False;
261 : }
262 : // -------------------------------------------------------------------------
263 0 : sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
264 : {
265 0 : return sal_False;
266 : }
267 : // -------------------------------------------------------------------------
268 0 : sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
269 : {
270 0 : return sal_False;
271 : }
272 : // -------------------------------------------------------------------------
273 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
274 : {
275 0 : sal_Int32 nValue = 0; // 0 means no limit
276 0 : return nValue;
277 : }
278 : // -------------------------------------------------------------------------
279 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
280 : {
281 0 : return sal_False;
282 : }
283 : // -------------------------------------------------------------------------
284 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
285 : {
286 0 : ::rtl::OUString aVal;
287 0 : return aVal;
288 : }
289 : // -------------------------------------------------------------------------
290 2 : ::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
291 : {
292 : // normally this is "
293 2 : return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("\""));
294 : }
295 : // -------------------------------------------------------------------------
296 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
297 : {
298 0 : ::rtl::OUString aVal;
299 0 : return aVal;
300 : }
301 : // -------------------------------------------------------------------------
302 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
303 : {
304 0 : return sal_True;
305 : }
306 : // -------------------------------------------------------------------------
307 0 : sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
308 : {
309 0 : return sal_True;
310 : }
311 : // -------------------------------------------------------------------------
312 0 : sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
313 : {
314 0 : return sal_True;
315 : }
316 : // -------------------------------------------------------------------------
317 0 : sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
318 : {
319 0 : return sal_True;
320 : }
321 : // -------------------------------------------------------------------------
322 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
323 : {
324 : //We support create table
325 0 : return sal_False;
326 : }
327 : // -------------------------------------------------------------------------
328 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
329 : {
330 0 : return sal_False;
331 : }
332 : // -------------------------------------------------------------------------
333 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
334 : {
335 0 : return sal_False;
336 : }
337 : // -------------------------------------------------------------------------
338 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
339 : {
340 0 : return sal_False;
341 : }
342 : // -------------------------------------------------------------------------
343 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
344 : {
345 0 : return sal_False;
346 : }
347 : // -------------------------------------------------------------------------
348 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
349 : {
350 0 : return sal_False;
351 : }
352 : // -------------------------------------------------------------------------
353 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
354 : {
355 0 : return sal_False;
356 : }
357 : // -------------------------------------------------------------------------
358 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
359 : {
360 0 : return sal_False;
361 : }
362 : // -------------------------------------------------------------------------
363 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException)
364 : {
365 0 : return sal_False;
366 : }
367 : // -------------------------------------------------------------------------
368 2 : sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
369 : {
370 2 : return sal_False;
371 : }
372 : // -------------------------------------------------------------------------
373 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
374 : {
375 0 : return sal_False;
376 : }
377 : // -------------------------------------------------------------------------
378 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
379 : {
380 0 : return sal_True; // should be supported at least
381 : }
382 : // -------------------------------------------------------------------------
383 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
384 : {
385 0 : return sal_False;
386 : }
387 : // -------------------------------------------------------------------------
388 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
389 : {
390 0 : return sal_False;
391 : }
392 : // -------------------------------------------------------------------------
393 0 : sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
394 : {
395 0 : return sal_False;
396 : }
397 : // -------------------------------------------------------------------------
398 0 : sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
399 : {
400 0 : return sal_False;
401 : }
402 : // -------------------------------------------------------------------------
403 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
404 : {
405 0 : return sal_False;
406 : }
407 : // -------------------------------------------------------------------------
408 2 : sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
409 : {
410 2 : return sal_False;
411 : }
412 : // -------------------------------------------------------------------------
413 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
414 : {
415 0 : return sal_False;
416 : }
417 : // -------------------------------------------------------------------------
418 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
419 : {
420 0 : return 0;// 0 means no limit
421 : }
422 : // -------------------------------------------------------------------------
423 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
424 : {
425 0 : sal_Int32 nValue = 0; // 0 means no limit
426 0 : return nValue;
427 : }
428 : // -------------------------------------------------------------------------
429 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
430 : {
431 0 : sal_Int32 nValue = 0; // 0 means no limit
432 0 : return nValue;
433 : }
434 : // -------------------------------------------------------------------------
435 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
436 : {
437 0 : return sal_False;
438 : }
439 : // -------------------------------------------------------------------------
440 0 : sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
441 : {
442 0 : return sal_False;
443 : }
444 : // -------------------------------------------------------------------------
445 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
446 : {
447 0 : return sal_False;
448 : }
449 : // -------------------------------------------------------------------------
450 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
451 : {
452 0 : return sal_False;
453 : }
454 : // -------------------------------------------------------------------------
455 0 : sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
456 : {
457 : // We allow you to select from any table.
458 0 : return sal_True;
459 : }
460 : // -------------------------------------------------------------------------
461 0 : sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
462 : {
463 : //we support insert/update/delete now
464 : //But we have to set this to return sal_True otherwise the UI will add create "table/edit table"
465 : //entry to the popup menu. We should avoid them.
466 0 : return sal_True;
467 : }
468 : // -------------------------------------------------------------------------
469 0 : sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
470 : {
471 0 : return sal_False;
472 : }
473 : // -------------------------------------------------------------------------
474 0 : sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
475 : {
476 0 : return sal_False;
477 : }
478 : // -------------------------------------------------------------------------
479 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
480 : {
481 0 : return sal_False;
482 : }
483 : // -------------------------------------------------------------------------
484 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
485 : {
486 0 : return sal_False;
487 : }
488 : // -------------------------------------------------------------------------
489 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
490 : {
491 : // Support added for this.
492 0 : return sal_True;
493 : }
494 : // -------------------------------------------------------------------------
495 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
496 : {
497 0 : return sal_False;
498 : }
499 : // -------------------------------------------------------------------------
500 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException)
501 : {
502 0 : return sal_False;
503 : }
504 : // -------------------------------------------------------------------------
505 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
506 : {
507 0 : return sal_False;
508 : }
509 : // -------------------------------------------------------------------------
510 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
511 : {
512 0 : return sal_False;
513 : }
514 : // -------------------------------------------------------------------------
515 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
516 : {
517 0 : return sal_False;
518 : }
519 : // -------------------------------------------------------------------------
520 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
521 : {
522 0 : return sal_False;
523 : }
524 : // -------------------------------------------------------------------------
525 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
526 : {
527 0 : return sal_False;
528 : }
529 : // -------------------------------------------------------------------------
530 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
531 : {
532 0 : return sal_False;
533 : }
534 : // -------------------------------------------------------------------------
535 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
536 : {
537 0 : return sal_False;
538 : }
539 : // -------------------------------------------------------------------------
540 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
541 : {
542 0 : return sal_False;
543 : }
544 : // -------------------------------------------------------------------------
545 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
546 : {
547 0 : return sal_False;
548 : }
549 : // -------------------------------------------------------------------------
550 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
551 : {
552 0 : return sal_False;
553 : }
554 : // -------------------------------------------------------------------------
555 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
556 : {
557 0 : return sal_True;
558 : }
559 : // -------------------------------------------------------------------------
560 2 : sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
561 : {
562 : // Any case may be used
563 2 : return sal_True;
564 : }
565 : // -------------------------------------------------------------------------
566 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
567 : {
568 0 : return sal_False;
569 : }
570 : // -------------------------------------------------------------------------
571 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
572 : {
573 0 : return sal_True;
574 : }
575 : // -------------------------------------------------------------------------
576 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
577 : {
578 0 : return sal_False;
579 : }
580 : // -------------------------------------------------------------------------
581 0 : sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
582 : {
583 0 : return sal_True;
584 : }
585 : // -------------------------------------------------------------------------
586 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
587 : {
588 0 : return sal_False;
589 : }
590 : // -------------------------------------------------------------------------
591 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
592 : {
593 0 : return sal_False;
594 : }
595 : // -------------------------------------------------------------------------
596 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
597 : {
598 0 : return sal_False;
599 : }
600 : // -------------------------------------------------------------------------
601 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
602 : {
603 0 : return sal_False;
604 : }
605 : // -------------------------------------------------------------------------
606 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
607 : {
608 0 : return sal_False;
609 : }
610 : // -------------------------------------------------------------------------
611 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
612 : {
613 0 : return sal_False;
614 : }
615 : // -------------------------------------------------------------------------
616 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
617 : {
618 0 : return sal_False;
619 : }
620 : // -------------------------------------------------------------------------
621 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
622 : {
623 0 : return sal_False;
624 : }
625 : // -------------------------------------------------------------------------
626 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
627 : {
628 0 : return sal_False;
629 : }
630 : // -------------------------------------------------------------------------
631 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
632 : {
633 0 : return sal_False;
634 : }
635 : // -------------------------------------------------------------------------
636 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
637 : {
638 0 : ::osl::MutexGuard aGuard( m_aMutex );
639 :
640 0 : return m_pConnection->getURL();
641 : }
642 : // -------------------------------------------------------------------------
643 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
644 : {
645 0 : ::rtl::OUString aValue;
646 0 : return aValue;
647 : }
648 : // -------------------------------------------------------------------------
649 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
650 : {
651 0 : ::rtl::OUString aValue;
652 0 : return aValue;
653 : }
654 : // -------------------------------------------------------------------------
655 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
656 : {
657 0 : ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)1);
658 0 : return aValue;
659 : }
660 : // -------------------------------------------------------------------------
661 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
662 : {
663 0 : ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)0);
664 0 : return aValue;
665 : }
666 : // -------------------------------------------------------------------------
667 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
668 : {
669 0 : ::rtl::OUString aValue;
670 0 : return aValue;
671 : }
672 : // -------------------------------------------------------------------------
673 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
674 : {
675 0 : ::rtl::OUString aValue;
676 0 : return aValue;
677 : }
678 : // -------------------------------------------------------------------------
679 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
680 : {
681 0 : ::rtl::OUString aValue;
682 0 : return aValue;
683 : }
684 : // -------------------------------------------------------------------------
685 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
686 : {
687 0 : return 1;
688 : }
689 : // -------------------------------------------------------------------------
690 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
691 : {
692 0 : return TransactionIsolation::NONE;
693 : }
694 : // -------------------------------------------------------------------------
695 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
696 : {
697 0 : return 0;
698 : }
699 : // -------------------------------------------------------------------------
700 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
701 : {
702 0 : ::rtl::OUString aValue;
703 0 : return aValue;
704 : }
705 : // -------------------------------------------------------------------------
706 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
707 : {
708 0 : ::rtl::OUString aValue;
709 0 : return aValue;
710 : }
711 : // -------------------------------------------------------------------------
712 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
713 : {
714 0 : return ::rtl::OUString();
715 : }
716 : // -------------------------------------------------------------------------
717 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
718 : {
719 0 : return ::rtl::OUString();
720 : }
721 : // -------------------------------------------------------------------------
722 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
723 : {
724 0 : return ::rtl::OUString();
725 : }
726 : // -------------------------------------------------------------------------
727 0 : ::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
728 : {
729 0 : return ::rtl::OUString();
730 : }
731 : // -------------------------------------------------------------------------
732 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
733 : {
734 0 : return sal_False;
735 : }
736 : // -------------------------------------------------------------------------
737 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
738 : {
739 0 : return sal_False;
740 : }
741 : // -------------------------------------------------------------------------
742 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
743 : {
744 0 : return sal_True;
745 : }
746 : // -------------------------------------------------------------------------
747 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
748 : {
749 0 : return sal_False;
750 : }
751 : // -------------------------------------------------------------------------
752 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
753 : {
754 0 : return sal_False;
755 : }
756 : // -------------------------------------------------------------------------
757 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
758 : {
759 0 : sal_Int32 nValue = 0; // 0 means no limit
760 0 : return nValue;
761 : }
762 : // -------------------------------------------------------------------------
763 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
764 : {
765 0 : sal_Int32 nValue = 0; // 0 means no limit
766 0 : return nValue;
767 : }
768 : // -------------------------------------------------------------------------
769 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
770 : {
771 0 : sal_Int32 nValue = 0; // 0 means no limit
772 0 : return nValue;
773 : }
774 : // -------------------------------------------------------------------------
775 0 : sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
776 : {
777 0 : sal_Int32 nValue = 0; // 0 means no limit
778 0 : return nValue;
779 : }
780 : // -------------------------------------------------------------------------
781 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
782 : {
783 0 : return sal_False;
784 : }
785 : // -------------------------------------------------------------------------
786 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException)
787 : {
788 0 : return sal_False;
789 : }
790 : // -------------------------------------------------------------------------
791 0 : sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
792 : {
793 0 : return sal_True;
794 : }
795 : // -------------------------------------------------------------------------
796 0 : sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
797 : {
798 0 : return sal_True;
799 : }
800 : // -------------------------------------------------------------------------
801 0 : sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
802 : {
803 0 : return sal_True;
804 : }
805 : // -------------------------------------------------------------------------
806 0 : sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
807 : {
808 0 : return sal_False;
809 : }
810 : // -------------------------------------------------------------------------
811 0 : sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
812 : {
813 0 : return sal_False;
814 : }
815 : // -------------------------------------------------------------------------
816 0 : sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
817 : {
818 0 : return sal_False;
819 : }
820 : // -------------------------------------------------------------------------
821 0 : sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
822 : {
823 0 : return sal_True;
824 : }
825 : // -------------------------------------------------------------------------
826 0 : sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
827 : {
828 0 : return sal_True;
829 : }
830 : // -------------------------------------------------------------------------
831 0 : sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
832 : {
833 0 : return sal_True;
834 : }
835 : // -------------------------------------------------------------------------
836 0 : sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
837 : {
838 0 : return sal_False;
839 : }
840 : // -------------------------------------------------------------------------
841 : // here follow all methods which return a resultset
842 : // the first methods is an example implementation how to use this resultset
843 : // of course you could implement it on your and you should do this because
844 : // the general way is more memory expensive
845 : // -------------------------------------------------------------------------
846 0 : Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
847 : {
848 : // there exists no possibility to get table types so we have to check
849 : static ::rtl::OUString sTableTypes[] =
850 : {
851 : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TABLE")),
852 : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VIEW"))
853 : // Currently we only support a 'TABLE' and 'VIEW' nothing more complex
854 : //
855 : // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYSTEM TABLE")),
856 : // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GLOBAL TEMPORARY")),
857 : // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LOCAL TEMPORARY")),
858 : // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ALIAS")),
859 : // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYNONYM"))
860 0 : };
861 0 : ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
862 0 : Reference< XResultSet > xRef = pResult;
863 :
864 : // here we fill the rows which should be visible when ask for data from the resultset returned here
865 0 : const sal_Int32 nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString);
866 0 : ODatabaseMetaDataResultSet::ORows aRows;
867 0 : for(sal_Int32 i=0;i < nSize;++i)
868 : {
869 0 : ODatabaseMetaDataResultSet::ORow aRow;
870 0 : aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
871 0 : aRow.push_back(new ORowSetValueDecorator(sTableTypes[i]));
872 : // bound row
873 0 : aRows.push_back(aRow);
874 0 : }
875 : // here we set the rows at the resultset
876 0 : pResult->setRows(aRows);
877 0 : return xRef;
878 : }
879 : // -------------------------------------------------------------------------
880 0 : Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
881 : {
882 : // this returns an empty resultset where the column-names are already set
883 : // in special the metadata of the resultset already returns the right columns
884 0 : ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
885 0 : Reference< XResultSet > xResultSet = pResultSet;
886 0 : static ODatabaseMetaDataResultSet::ORows aRows;
887 :
888 0 : if(aRows.empty())
889 : {
890 0 : ODatabaseMetaDataResultSet::ORow aRow;
891 0 : aRow.reserve(19);
892 0 : aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
893 0 : aRow.push_back(new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VARCHAR"))));
894 0 : aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
895 0 : aRow.push_back(new ORowSetValueDecorator((sal_Int32)s_nCHAR_OCTET_LENGTH));
896 0 : aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
897 0 : aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
898 0 : aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
899 : // aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
900 0 : aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
901 0 : aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
902 0 : aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR));
903 0 : aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
904 0 : aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
905 0 : aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
906 0 : aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
907 0 : aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
908 0 : aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
909 0 : aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
910 0 : aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
911 0 : aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
912 :
913 0 : aRows.push_back(aRow);
914 :
915 : }
916 0 : pResultSet->setRows(aRows);
917 0 : return xResultSet;
918 : }
919 : // -------------------------------------------------------------------------
920 76 : Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
921 : const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern,
922 : const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
923 : {
924 : // this returns an empty resultset where the column-names are already set
925 : // in special the metadata of the resultset already returns the right columns
926 76 : ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eColumns);
927 76 : Reference< XResultSet > xResultSet = pResultSet;
928 76 : pResultSet->setRows( getColumnRows( tableNamePattern, columnNamePattern ));
929 76 : return xResultSet;
930 : }
931 : // -------------------------------------------------------------------------
932 5 : Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
933 : const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/,
934 : const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& /*types*/ ) throw(SQLException, RuntimeException)
935 : {
936 : SAL_INFO("connectivity.mork", "=> ODatabaseMetaData::getTables()" );
937 : // this returns an empty resultset where the column-names are already set
938 : // in special the metadata of the resultset already returns the right columns
939 5 : ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
940 5 : Reference< XResultSet > xResultSet = pResultSet;
941 :
942 : // ODatabaseMetaDataResultSet::ORows aRows;
943 : // aRows = m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern );
944 : // pResultSet->setRows( aRows );
945 5 : ODatabaseMetaDataResultSet::ORows _rRows;
946 5 : if ( !m_pMetaDataHelper->getTables( m_pConnection, tableNamePattern, _rRows ) ) {
947 0 : ::connectivity::SharedResources aResources;
948 : // TODO:
949 : // get better message here?
950 0 : const ::rtl::OUString sMessage = aResources.getResourceString(STR_UNKNOWN_COLUMN_TYPE);
951 0 : ::dbtools::throwGenericSQLException(sMessage ,*this);
952 : }
953 5 : pResultSet->setRows( _rRows );
954 :
955 5 : return xResultSet;
956 : }
957 : // -------------------------------------------------------------------------
958 0 : Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
959 : const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
960 : {
961 : SAL_INFO("connectivity.mork", "=> ODatabaseMetaData::getTablePrivileges()" );
962 0 : ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTablePrivileges);
963 0 : Reference< XResultSet > xRef = pResult;
964 :
965 0 : ::std::vector< ::rtl::OUString > tables;
966 0 : if ( !m_pMetaDataHelper->getTableStrings( m_pConnection, tables) )
967 : {
968 0 : ::connectivity::SharedResources aResources;
969 : // TODO:
970 : // get better message here?
971 0 : const ::rtl::OUString sMessage = aResources.getResourceString(STR_UNKNOWN_COLUMN_TYPE);
972 0 : ::dbtools::throwGenericSQLException(sMessage ,*this);
973 : }
974 :
975 0 : ::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
976 0 : ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8);
977 0 : aRows.reserve(8);
978 0 : aRow[0] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
979 0 : aRow[1] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
980 0 : aRow[3] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
981 0 : aRow[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
982 0 : aRow[5] = new ::connectivity::ORowSetValueDecorator(getUserName());
983 0 : aRow[7] = new ::connectivity::ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NO")));
984 :
985 :
986 : // Iterate over all tables
987 0 : for(size_t j = 0; j < tables.size(); j++ ) {
988 0 : if(match(tableNamePattern, tables[j],'\0'))
989 : {
990 : // TABLE_NAME
991 0 : aRow[2] = new ORowSetValueDecorator( tables[j] );
992 :
993 : SAL_INFO("connectivity.mork", "\tTableName = : " << tables[j]);
994 :
995 0 : aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue();
996 0 : aRows.push_back(aRow);
997 0 : aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue();
998 0 : aRows.push_back(aRow);
999 0 : aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDeleteValue();
1000 0 : aRows.push_back(aRow);
1001 0 : aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getUpdateValue();
1002 0 : aRows.push_back(aRow);
1003 0 : aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getCreateValue();
1004 0 : aRows.push_back(aRow);
1005 0 : aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getReadValue();
1006 0 : aRows.push_back(aRow);
1007 0 : aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getAlterValue();
1008 0 : aRows.push_back(aRow);
1009 0 : aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDropValue();
1010 0 : aRows.push_back(aRow);
1011 : }
1012 : }
1013 0 : pResult->setRows(aRows);
1014 0 : return xRef;
1015 : }
1016 : // -------------------------------------------------------------------------
1017 0 : Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException)
1018 : {
1019 0 : return NULL;
1020 : }
1021 : // -----------------------------------------------------------------------------
1022 :
1023 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|