xref: /AOO41X/main/connectivity/source/drivers/kab/KDatabaseMetaData.cxx (revision 9b5730f6ddef7eb82608ca4d31dc0d7678e652cf)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_connectivity.hxx"
26 
27 #include "KDatabaseMetaData.hxx"
28 #include "kfields.hxx"
29 #include "KDEInit.h"
30 #include <shell/kde_headers.h>
31 #include "FDatabaseMetaDataResultSet.hxx"
32 #include "OTypeInfo.hxx"
33 #include <com/sun/star/sdbc/ColumnValue.hpp>
34 #include <com/sun/star/sdbc/ResultSetType.hpp>
35 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
36 
37 using namespace connectivity::kab;
38 using namespace com::sun::star::uno;
39 using namespace com::sun::star::lang;
40 using namespace com::sun::star::beans;
41 using namespace com::sun::star::sdbc;
42 
KabDatabaseMetaData(KabConnection * _pCon)43 KabDatabaseMetaData::KabDatabaseMetaData(KabConnection* _pCon)
44         : m_xConnection(_pCon),
45           m_bUseCatalog(sal_True)
46 {
47     OSL_ENSURE(_pCon,"KabDatabaseMetaData::KabDatabaseMetaData: No connection set!");
48 
49     osl_incrementInterlockedCount( &m_refCount );
50     m_bUseCatalog   = !(usesLocalFiles() || usesLocalFilePerTable());
51     osl_decrementInterlockedCount( &m_refCount );
52 }
53 // -------------------------------------------------------------------------
~KabDatabaseMetaData()54 KabDatabaseMetaData::~KabDatabaseMetaData()
55 {
56 }
57 // -------------------------------------------------------------------------
getAddressBookTableName()58 const ::rtl::OUString & KabDatabaseMetaData::getAddressBookTableName()
59 {
60     static const ::rtl::OUString aAddressBookTableName
61         (::rtl::OUString::createFromAscii( i18n("Address Book") ));
62 
63     return aAddressBookTableName;
64 }
65 // -------------------------------------------------------------------------
getCatalogSeparator()66 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getCatalogSeparator(  ) throw(SQLException, RuntimeException)
67 {
68     ::rtl::OUString aVal;
69     if (m_bUseCatalog)
70     { // do some special here for you database
71     }
72 
73     return aVal;
74 }
75 // -------------------------------------------------------------------------
getMaxBinaryLiteralLength()76 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxBinaryLiteralLength(  ) throw(SQLException, RuntimeException)
77 {
78     sal_Int32 nValue = 0; // 0 means no limit
79     return nValue;
80 }
81 // -------------------------------------------------------------------------
getMaxRowSize()82 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxRowSize(  ) throw(SQLException, RuntimeException)
83 {
84     sal_Int32 nValue = 0; // 0 means no limit
85     return nValue;
86 }
87 // -------------------------------------------------------------------------
getMaxCatalogNameLength()88 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCatalogNameLength(  ) throw(SQLException, RuntimeException)
89 {
90     sal_Int32 nValue = 0; // 0 means no limit
91     return nValue;
92 }
93 // -------------------------------------------------------------------------
getMaxCharLiteralLength()94 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCharLiteralLength(  ) throw(SQLException, RuntimeException)
95 {
96     sal_Int32 nValue = 0; // 0 means no limit
97     return nValue;
98 }
99 // -------------------------------------------------------------------------
getMaxColumnNameLength()100 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnNameLength(  ) throw(SQLException, RuntimeException)
101 {
102     sal_Int32 nValue = 0; // 0 means no limit
103     return nValue;
104 }
105 // -------------------------------------------------------------------------
getMaxColumnsInIndex()106 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInIndex(  ) throw(SQLException, RuntimeException)
107 {
108     sal_Int32 nValue = 0; // 0 means no limit
109     return nValue;
110 }
111 // -------------------------------------------------------------------------
getMaxCursorNameLength()112 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCursorNameLength(  ) throw(SQLException, RuntimeException)
113 {
114     sal_Int32 nValue = 0; // 0 means no limit
115     return nValue;
116 }
117 // -------------------------------------------------------------------------
getMaxConnections()118 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxConnections(  ) throw(SQLException, RuntimeException)
119 {
120     sal_Int32 nValue = 0; // 0 means no limit
121     return nValue;
122 }
123 // -------------------------------------------------------------------------
getMaxColumnsInTable()124 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInTable(  ) throw(SQLException, RuntimeException)
125 {
126     sal_Int32 nValue = 0; // 0 means no limit
127     return nValue;
128 }
129 // -------------------------------------------------------------------------
getMaxStatementLength()130 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxStatementLength(  ) throw(SQLException, RuntimeException)
131 {
132     sal_Int32 nValue = 0; // 0 means no limit
133     return nValue;
134 }
135 // -------------------------------------------------------------------------
getMaxTableNameLength()136 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxTableNameLength(  ) throw(SQLException, RuntimeException)
137 {
138     sal_Int32 nValue = 0; // 0 means no limit
139     return nValue;
140 }
141 // -------------------------------------------------------------------------
getMaxTablesInSelect()142 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxTablesInSelect(  ) throw(SQLException, RuntimeException)
143 {
144     // MaxTablesInSelect describes how many tables can participate in the FROM part of a given SELECT statement,
145     // currently, the resultset/statement implementations can cope with one table only
146     sal_Int32 nValue = 1;
147     return nValue;
148 }
149 // -------------------------------------------------------------------------
doesMaxRowSizeIncludeBlobs()150 sal_Bool SAL_CALL KabDatabaseMetaData::doesMaxRowSizeIncludeBlobs(  ) throw(SQLException, RuntimeException)
151 {
152     return sal_False;
153 }
154 // -------------------------------------------------------------------------
storesLowerCaseQuotedIdentifiers()155 sal_Bool SAL_CALL KabDatabaseMetaData::storesLowerCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
156 {
157     return sal_False;
158 }
159 // -------------------------------------------------------------------------
storesLowerCaseIdentifiers()160 sal_Bool SAL_CALL KabDatabaseMetaData::storesLowerCaseIdentifiers(  ) throw(SQLException, RuntimeException)
161 {
162     return sal_False;
163 }
164 // -------------------------------------------------------------------------
storesMixedCaseQuotedIdentifiers()165 sal_Bool SAL_CALL KabDatabaseMetaData::storesMixedCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
166 {
167     return sal_False;
168 }
169 // -------------------------------------------------------------------------
storesMixedCaseIdentifiers()170 sal_Bool SAL_CALL KabDatabaseMetaData::storesMixedCaseIdentifiers(  ) throw(SQLException, RuntimeException)
171 {
172     return sal_False;
173 }
174 // -------------------------------------------------------------------------
storesUpperCaseQuotedIdentifiers()175 sal_Bool SAL_CALL KabDatabaseMetaData::storesUpperCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
176 {
177     return sal_False;
178 }
179 // -------------------------------------------------------------------------
storesUpperCaseIdentifiers()180 sal_Bool SAL_CALL KabDatabaseMetaData::storesUpperCaseIdentifiers(  ) throw(SQLException, RuntimeException)
181 {
182     return sal_False;
183 }
184 // -------------------------------------------------------------------------
supportsAlterTableWithAddColumn()185 sal_Bool SAL_CALL KabDatabaseMetaData::supportsAlterTableWithAddColumn(  ) throw(SQLException, RuntimeException)
186 {
187     return sal_False;
188 }
189 // -------------------------------------------------------------------------
supportsAlterTableWithDropColumn()190 sal_Bool SAL_CALL KabDatabaseMetaData::supportsAlterTableWithDropColumn(  ) throw(SQLException, RuntimeException)
191 {
192     return sal_False;
193 }
194 // -------------------------------------------------------------------------
getMaxIndexLength()195 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxIndexLength(  ) throw(SQLException, RuntimeException)
196 {
197     sal_Int32 nValue = 0; // 0 means no limit
198     return nValue;
199 }
200 // -------------------------------------------------------------------------
supportsNonNullableColumns()201 sal_Bool SAL_CALL KabDatabaseMetaData::supportsNonNullableColumns(  ) throw(SQLException, RuntimeException)
202 {
203     return sal_False;
204 }
205 // -------------------------------------------------------------------------
getCatalogTerm()206 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getCatalogTerm(  ) throw(SQLException, RuntimeException)
207 {
208     ::rtl::OUString aVal;
209     if (m_bUseCatalog)
210     {
211     }
212     return aVal;
213 }
214 // -------------------------------------------------------------------------
getIdentifierQuoteString()215 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getIdentifierQuoteString(  ) throw(SQLException, RuntimeException)
216 {
217     // normally this is "
218     ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("\"");
219     return aVal;
220 }
221 // -------------------------------------------------------------------------
getExtraNameCharacters()222 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getExtraNameCharacters(  ) throw(SQLException, RuntimeException)
223 {
224     ::rtl::OUString aVal;
225     return aVal;
226 }
227 // -------------------------------------------------------------------------
supportsDifferentTableCorrelationNames()228 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDifferentTableCorrelationNames(  ) throw(SQLException, RuntimeException)
229 {
230     return sal_False;
231 }
232 // -------------------------------------------------------------------------
isCatalogAtStart()233 sal_Bool SAL_CALL KabDatabaseMetaData::isCatalogAtStart(  ) throw(SQLException, RuntimeException)
234 {
235     sal_Bool bValue = sal_False;
236     if (m_bUseCatalog)
237     {
238     }
239     return bValue;
240 }
241 // -------------------------------------------------------------------------
dataDefinitionIgnoredInTransactions()242 sal_Bool SAL_CALL KabDatabaseMetaData::dataDefinitionIgnoredInTransactions(  ) throw(SQLException, RuntimeException)
243 {
244     return sal_True;
245 }
246 // -------------------------------------------------------------------------
dataDefinitionCausesTransactionCommit()247 sal_Bool SAL_CALL KabDatabaseMetaData::dataDefinitionCausesTransactionCommit(  ) throw(SQLException, RuntimeException)
248 {
249     return sal_True;
250 }
251 // -------------------------------------------------------------------------
supportsDataManipulationTransactionsOnly()252 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDataManipulationTransactionsOnly(  ) throw(SQLException, RuntimeException)
253 {
254     return sal_True;
255 }
256 // -------------------------------------------------------------------------
supportsDataDefinitionAndDataManipulationTransactions()257 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions(  ) throw(SQLException, RuntimeException)
258 {
259     return sal_True;
260 }
261 // -------------------------------------------------------------------------
supportsPositionedDelete()262 sal_Bool SAL_CALL KabDatabaseMetaData::supportsPositionedDelete(  ) throw(SQLException, RuntimeException)
263 {
264     return sal_False;
265 }
266 // -------------------------------------------------------------------------
supportsPositionedUpdate()267 sal_Bool SAL_CALL KabDatabaseMetaData::supportsPositionedUpdate(  ) throw(SQLException, RuntimeException)
268 {
269     return sal_False;
270 }
271 // -------------------------------------------------------------------------
supportsOpenStatementsAcrossRollback()272 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenStatementsAcrossRollback(  ) throw(SQLException, RuntimeException)
273 {
274     return sal_False;
275 }
276 // -------------------------------------------------------------------------
supportsOpenStatementsAcrossCommit()277 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenStatementsAcrossCommit(  ) throw(SQLException, RuntimeException)
278 {
279     return sal_False;
280 }
281 // -------------------------------------------------------------------------
supportsOpenCursorsAcrossCommit()282 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenCursorsAcrossCommit(  ) throw(SQLException, RuntimeException)
283 {
284     return sal_False;
285 }
286 // -------------------------------------------------------------------------
supportsOpenCursorsAcrossRollback()287 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenCursorsAcrossRollback(  ) throw(SQLException, RuntimeException)
288 {
289     return sal_False;
290 }
291 // -------------------------------------------------------------------------
supportsTransactionIsolationLevel(sal_Int32)292 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 ) throw(SQLException, RuntimeException)
293 {
294     return sal_False;
295 }
296 // -------------------------------------------------------------------------
supportsSchemasInDataManipulation()297 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInDataManipulation(  ) throw(SQLException, RuntimeException)
298 {
299     return sal_False;
300 }
301 // -------------------------------------------------------------------------
supportsANSI92FullSQL()302 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92FullSQL(  ) throw(SQLException, RuntimeException)
303 {
304     return sal_False;
305 }
306 // -------------------------------------------------------------------------
supportsANSI92EntryLevelSQL()307 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92EntryLevelSQL(  ) throw(SQLException, RuntimeException)
308 {
309     return sal_True; // should be supported at least
310 }
311 // -------------------------------------------------------------------------
supportsIntegrityEnhancementFacility()312 sal_Bool SAL_CALL KabDatabaseMetaData::supportsIntegrityEnhancementFacility(  ) throw(SQLException, RuntimeException)
313 {
314     return sal_False;
315 }
316 // -------------------------------------------------------------------------
supportsSchemasInIndexDefinitions()317 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInIndexDefinitions(  ) throw(SQLException, RuntimeException)
318 {
319     return sal_False;
320 }
321 // -------------------------------------------------------------------------
supportsSchemasInTableDefinitions()322 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInTableDefinitions(  ) throw(SQLException, RuntimeException)
323 {
324     return sal_False;
325 }
326 // -------------------------------------------------------------------------
supportsCatalogsInTableDefinitions()327 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInTableDefinitions(  ) throw(SQLException, RuntimeException)
328 {
329     return sal_False;
330 }
331 // -------------------------------------------------------------------------
supportsCatalogsInIndexDefinitions()332 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInIndexDefinitions(  ) throw(SQLException, RuntimeException)
333 {
334     return sal_False;
335 }
336 // -------------------------------------------------------------------------
supportsCatalogsInDataManipulation()337 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInDataManipulation(  ) throw(SQLException, RuntimeException)
338 {
339     return sal_False;
340 }
341 // -------------------------------------------------------------------------
supportsOuterJoins()342 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOuterJoins(  ) throw(SQLException, RuntimeException)
343 {
344     return sal_False;
345 }
346 // -------------------------------------------------------------------------
getMaxStatements()347 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxStatements(  ) throw(SQLException, RuntimeException)
348 {
349     sal_Int32 nValue = 0; // 0 means no limit
350     return nValue;
351 }
352 // -------------------------------------------------------------------------
getMaxProcedureNameLength()353 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxProcedureNameLength(  ) throw(SQLException, RuntimeException)
354 {
355     sal_Int32 nValue = 0; // 0 means no limit
356     return nValue;
357 }
358 // -------------------------------------------------------------------------
getMaxSchemaNameLength()359 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxSchemaNameLength(  ) throw(SQLException, RuntimeException)
360 {
361     sal_Int32 nValue = 0; // 0 means no limit
362     return nValue;
363 }
364 // -------------------------------------------------------------------------
supportsTransactions()365 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTransactions(  ) throw(SQLException, RuntimeException)
366 {
367     return sal_False;
368 }
369 // -------------------------------------------------------------------------
allProceduresAreCallable()370 sal_Bool SAL_CALL KabDatabaseMetaData::allProceduresAreCallable(  ) throw(SQLException, RuntimeException)
371 {
372     return sal_False;
373 }
374 // -------------------------------------------------------------------------
supportsStoredProcedures()375 sal_Bool SAL_CALL KabDatabaseMetaData::supportsStoredProcedures(  ) throw(SQLException, RuntimeException)
376 {
377     return sal_False;
378 }
379 // -------------------------------------------------------------------------
supportsSelectForUpdate()380 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSelectForUpdate(  ) throw(SQLException, RuntimeException)
381 {
382     return sal_False;
383 }
384 // -------------------------------------------------------------------------
allTablesAreSelectable()385 sal_Bool SAL_CALL KabDatabaseMetaData::allTablesAreSelectable(  ) throw(SQLException, RuntimeException)
386 {
387     return sal_False;
388 }
389 // -------------------------------------------------------------------------
isReadOnly()390 sal_Bool SAL_CALL KabDatabaseMetaData::isReadOnly(  ) throw(SQLException, RuntimeException)
391 {
392     // for the moment, we have read-only addresses, but this might change in the future
393     return sal_True;
394 }
395 // -------------------------------------------------------------------------
usesLocalFiles()396 sal_Bool SAL_CALL KabDatabaseMetaData::usesLocalFiles(  ) throw(SQLException, RuntimeException)
397 {
398     return sal_False;
399 }
400 // -------------------------------------------------------------------------
usesLocalFilePerTable()401 sal_Bool SAL_CALL KabDatabaseMetaData::usesLocalFilePerTable(  ) throw(SQLException, RuntimeException)
402 {
403     return sal_False;
404 }
405 // -------------------------------------------------------------------------
supportsTypeConversion()406 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTypeConversion(  ) throw(SQLException, RuntimeException)
407 {
408     return sal_False;
409 }
410 // -------------------------------------------------------------------------
nullPlusNonNullIsNull()411 sal_Bool SAL_CALL KabDatabaseMetaData::nullPlusNonNullIsNull(  ) throw(SQLException, RuntimeException)
412 {
413     return sal_False;
414 }
415 // -------------------------------------------------------------------------
supportsColumnAliasing()416 sal_Bool SAL_CALL KabDatabaseMetaData::supportsColumnAliasing(  ) throw(SQLException, RuntimeException)
417 {
418     return sal_False;
419 }
420 // -------------------------------------------------------------------------
supportsTableCorrelationNames()421 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTableCorrelationNames(  ) throw(SQLException, RuntimeException)
422 {
423     return sal_False;
424 }
425 // -------------------------------------------------------------------------
supportsConvert(sal_Int32,sal_Int32)426 sal_Bool SAL_CALL KabDatabaseMetaData::supportsConvert( sal_Int32, sal_Int32 ) throw(SQLException, RuntimeException)
427 {
428     return sal_False;
429 }
430 // -------------------------------------------------------------------------
supportsExpressionsInOrderBy()431 sal_Bool SAL_CALL KabDatabaseMetaData::supportsExpressionsInOrderBy(  ) throw(SQLException, RuntimeException)
432 {
433     return sal_False;
434 }
435 // -------------------------------------------------------------------------
supportsGroupBy()436 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupBy(  ) throw(SQLException, RuntimeException)
437 {
438     return sal_False;
439 }
440 // -------------------------------------------------------------------------
supportsGroupByBeyondSelect()441 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupByBeyondSelect(  ) throw(SQLException, RuntimeException)
442 {
443     return sal_False;
444 }
445 // -------------------------------------------------------------------------
supportsGroupByUnrelated()446 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupByUnrelated(  ) throw(SQLException, RuntimeException)
447 {
448     return sal_False;
449 }
450 // -------------------------------------------------------------------------
supportsMultipleTransactions()451 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMultipleTransactions(  ) throw(SQLException, RuntimeException)
452 {
453     return sal_False;
454 }
455 // -------------------------------------------------------------------------
supportsMultipleResultSets()456 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMultipleResultSets(  ) throw(SQLException, RuntimeException)
457 {
458     return sal_False;
459 }
460 // -------------------------------------------------------------------------
supportsLikeEscapeClause()461 sal_Bool SAL_CALL KabDatabaseMetaData::supportsLikeEscapeClause(  ) throw(SQLException, RuntimeException)
462 {
463     return sal_False;
464 }
465 // -------------------------------------------------------------------------
supportsOrderByUnrelated()466 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOrderByUnrelated(  ) throw(SQLException, RuntimeException)
467 {
468     return sal_False;
469 }
470 // -------------------------------------------------------------------------
supportsUnion()471 sal_Bool SAL_CALL KabDatabaseMetaData::supportsUnion(  ) throw(SQLException, RuntimeException)
472 {
473     return sal_False;
474 }
475 // -------------------------------------------------------------------------
supportsUnionAll()476 sal_Bool SAL_CALL KabDatabaseMetaData::supportsUnionAll(  ) throw(SQLException, RuntimeException)
477 {
478     return sal_False;
479 }
480 // -------------------------------------------------------------------------
supportsMixedCaseIdentifiers()481 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMixedCaseIdentifiers(  ) throw(SQLException, RuntimeException)
482 {
483     return sal_False;
484 }
485 // -------------------------------------------------------------------------
supportsMixedCaseQuotedIdentifiers()486 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMixedCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
487 {
488     return sal_False;
489 }
490 // -------------------------------------------------------------------------
nullsAreSortedAtEnd()491 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedAtEnd(  ) throw(SQLException, RuntimeException)
492 {
493     return sal_False;
494 }
495 // -------------------------------------------------------------------------
nullsAreSortedAtStart()496 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedAtStart(  ) throw(SQLException, RuntimeException)
497 {
498     return sal_False;
499 }
500 // -------------------------------------------------------------------------
nullsAreSortedHigh()501 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedHigh(  ) throw(SQLException, RuntimeException)
502 {
503     return sal_False;
504 }
505 // -------------------------------------------------------------------------
nullsAreSortedLow()506 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedLow(  ) throw(SQLException, RuntimeException)
507 {
508     return sal_False;
509 }
510 // -------------------------------------------------------------------------
supportsSchemasInProcedureCalls()511 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInProcedureCalls(  ) throw(SQLException, RuntimeException)
512 {
513     return sal_False;
514 }
515 // -------------------------------------------------------------------------
supportsSchemasInPrivilegeDefinitions()516 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions(  ) throw(SQLException, RuntimeException)
517 {
518     return sal_False;
519 }
520 // -------------------------------------------------------------------------
supportsCatalogsInProcedureCalls()521 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInProcedureCalls(  ) throw(SQLException, RuntimeException)
522 {
523     return sal_False;
524 }
525 // -------------------------------------------------------------------------
supportsCatalogsInPrivilegeDefinitions()526 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions(  ) throw(SQLException, RuntimeException)
527 {
528     return sal_False;
529 }
530 // -------------------------------------------------------------------------
supportsCorrelatedSubqueries()531 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCorrelatedSubqueries(  ) throw(SQLException, RuntimeException)
532 {
533     return sal_False;
534 }
535 // -------------------------------------------------------------------------
supportsSubqueriesInComparisons()536 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInComparisons(  ) throw(SQLException, RuntimeException)
537 {
538     return sal_False;
539 }
540 // -------------------------------------------------------------------------
supportsSubqueriesInExists()541 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInExists(  ) throw(SQLException, RuntimeException)
542 {
543     return sal_False;
544 }
545 // -------------------------------------------------------------------------
supportsSubqueriesInIns()546 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInIns(  ) throw(SQLException, RuntimeException)
547 {
548     return sal_False;
549 }
550 // -------------------------------------------------------------------------
supportsSubqueriesInQuantifieds()551 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInQuantifieds(  ) throw(SQLException, RuntimeException)
552 {
553     return sal_False;
554 }
555 // -------------------------------------------------------------------------
supportsANSI92IntermediateSQL()556 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92IntermediateSQL(  ) throw(SQLException, RuntimeException)
557 {
558     return sal_False;
559 }
560 // -------------------------------------------------------------------------
getURL()561 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getURL(  ) throw(SQLException, RuntimeException)
562 {
563     // if someday we support more than the default address book,
564     // this method should return the URL which was used to create it
565     ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:address:kab:");
566     return aValue;
567 }
568 // -------------------------------------------------------------------------
getUserName()569 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getUserName(  ) throw(SQLException, RuntimeException)
570 {
571     ::rtl::OUString aValue;
572     return aValue;
573 }
574 // -------------------------------------------------------------------------
getDriverName()575 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getDriverName(  ) throw(SQLException, RuntimeException)
576 {
577     ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("kab");
578     return aValue;
579 }
580 // -------------------------------------------------------------------------
getDriverVersion()581 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
582 {
583     ::rtl::OUString aValue = ::rtl::OUString::createFromAscii(KAB_DRIVER_VERSION);
584     return aValue;
585 }
586 // -------------------------------------------------------------------------
getDatabaseProductVersion()587 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getDatabaseProductVersion(  ) throw(SQLException, RuntimeException)
588 {
589     ::rtl::OUString aValue;
590     return aValue;
591 }
592 // -------------------------------------------------------------------------
getDatabaseProductName()593 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getDatabaseProductName(  ) throw(SQLException, RuntimeException)
594 {
595     ::rtl::OUString aValue;
596     return aValue;
597 }
598 // -------------------------------------------------------------------------
getProcedureTerm()599 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getProcedureTerm(  ) throw(SQLException, RuntimeException)
600 {
601     ::rtl::OUString aValue;
602     return aValue;
603 }
604 // -------------------------------------------------------------------------
getSchemaTerm()605 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getSchemaTerm(  ) throw(SQLException, RuntimeException)
606 {
607     ::rtl::OUString aValue;
608     return aValue;
609 }
610 // -------------------------------------------------------------------------
getDriverMajorVersion()611 sal_Int32 SAL_CALL KabDatabaseMetaData::getDriverMajorVersion(  ) throw(RuntimeException)
612 {
613     return KAB_DRIVER_VERSION_MAJOR;
614 }
615 // -------------------------------------------------------------------------
getDefaultTransactionIsolation()616 sal_Int32 SAL_CALL KabDatabaseMetaData::getDefaultTransactionIsolation(  ) throw(SQLException, RuntimeException)
617 {
618     return TransactionIsolation::NONE;
619 }
620 // -------------------------------------------------------------------------
getDriverMinorVersion()621 sal_Int32 SAL_CALL KabDatabaseMetaData::getDriverMinorVersion(  ) throw(RuntimeException)
622 {
623     return KAB_DRIVER_VERSION_MINOR;
624 }
625 // -------------------------------------------------------------------------
getSQLKeywords()626 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getSQLKeywords(  ) throw(SQLException, RuntimeException)
627 {
628     ::rtl::OUString aValue;
629     return aValue;
630 }
631 // -------------------------------------------------------------------------
getSearchStringEscape()632 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getSearchStringEscape(  ) throw(SQLException, RuntimeException)
633 {
634     ::rtl::OUString aValue;
635     return aValue;
636 }
637 // -------------------------------------------------------------------------
getStringFunctions()638 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getStringFunctions(  ) throw(SQLException, RuntimeException)
639 {
640     return ::rtl::OUString();
641 }
642 // -------------------------------------------------------------------------
getTimeDateFunctions()643 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getTimeDateFunctions(  ) throw(SQLException, RuntimeException)
644 {
645     return ::rtl::OUString();
646 }
647 // -------------------------------------------------------------------------
getSystemFunctions()648 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getSystemFunctions(  ) throw(SQLException, RuntimeException)
649 {
650     return ::rtl::OUString();
651 }
652 // -------------------------------------------------------------------------
getNumericFunctions()653 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getNumericFunctions(  ) throw(SQLException, RuntimeException)
654 {
655     return ::rtl::OUString();
656 }
657 // -------------------------------------------------------------------------
supportsExtendedSQLGrammar()658 sal_Bool SAL_CALL KabDatabaseMetaData::supportsExtendedSQLGrammar(  ) throw(SQLException, RuntimeException)
659 {
660     return sal_False;
661 }
662 // -------------------------------------------------------------------------
supportsCoreSQLGrammar()663 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCoreSQLGrammar(  ) throw(SQLException, RuntimeException)
664 {
665     return sal_False;
666 }
667 // -------------------------------------------------------------------------
supportsMinimumSQLGrammar()668 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMinimumSQLGrammar(  ) throw(SQLException, RuntimeException)
669 {
670     return sal_True;
671 }
672 // -------------------------------------------------------------------------
supportsFullOuterJoins()673 sal_Bool SAL_CALL KabDatabaseMetaData::supportsFullOuterJoins(  ) throw(SQLException, RuntimeException)
674 {
675     return sal_False;
676 }
677 // -------------------------------------------------------------------------
supportsLimitedOuterJoins()678 sal_Bool SAL_CALL KabDatabaseMetaData::supportsLimitedOuterJoins(  ) throw(SQLException, RuntimeException)
679 {
680     return sal_False;
681 }
682 // -------------------------------------------------------------------------
getMaxColumnsInGroupBy()683 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInGroupBy(  ) throw(SQLException, RuntimeException)
684 {
685     sal_Int32 nValue = 0; // 0 means no limit
686     return nValue;
687 }
688 // -------------------------------------------------------------------------
getMaxColumnsInOrderBy()689 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInOrderBy(  ) throw(SQLException, RuntimeException)
690 {
691     sal_Int32 nValue = 0; // 0 means no limit
692     return nValue;
693 }
694 // -------------------------------------------------------------------------
getMaxColumnsInSelect()695 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInSelect(  ) throw(SQLException, RuntimeException)
696 {
697     sal_Int32 nValue = 0; // 0 means no limit
698     return nValue;
699 }
700 // -------------------------------------------------------------------------
getMaxUserNameLength()701 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxUserNameLength(  ) throw(SQLException, RuntimeException)
702 {
703     sal_Int32 nValue = 0; // 0 means no limit
704     return nValue;
705 }
706 // -------------------------------------------------------------------------
supportsResultSetType(sal_Int32 setType)707 sal_Bool SAL_CALL KabDatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
708 {
709     switch (setType)
710     {
711         case ResultSetType::FORWARD_ONLY:
712         case ResultSetType::SCROLL_INSENSITIVE:
713             return sal_True;
714     }
715     return sal_False;
716 }
717 // -------------------------------------------------------------------------
supportsResultSetConcurrency(sal_Int32 setType,sal_Int32)718 sal_Bool SAL_CALL KabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 ) throw(SQLException, RuntimeException)
719 {
720     switch (setType)
721     {
722         case ResultSetType::FORWARD_ONLY:
723         case ResultSetType::SCROLL_INSENSITIVE:
724             return sal_True;
725     }
726     return sal_False;
727 }
728 // -------------------------------------------------------------------------
ownUpdatesAreVisible(sal_Int32)729 sal_Bool SAL_CALL KabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
730 {
731     return sal_False;
732 }
733 // -------------------------------------------------------------------------
ownDeletesAreVisible(sal_Int32)734 sal_Bool SAL_CALL KabDatabaseMetaData::ownDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
735 {
736     return sal_False;
737 }
738 // -------------------------------------------------------------------------
ownInsertsAreVisible(sal_Int32)739 sal_Bool SAL_CALL KabDatabaseMetaData::ownInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
740 {
741     return sal_False;
742 }
743 // -------------------------------------------------------------------------
othersUpdatesAreVisible(sal_Int32)744 sal_Bool SAL_CALL KabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
745 {
746     return sal_False;
747 }
748 // -------------------------------------------------------------------------
othersDeletesAreVisible(sal_Int32)749 sal_Bool SAL_CALL KabDatabaseMetaData::othersDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
750 {
751     return sal_False;
752 }
753 // -------------------------------------------------------------------------
othersInsertsAreVisible(sal_Int32)754 sal_Bool SAL_CALL KabDatabaseMetaData::othersInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
755 {
756     return sal_False;
757 }
758 // -------------------------------------------------------------------------
updatesAreDetected(sal_Int32)759 sal_Bool SAL_CALL KabDatabaseMetaData::updatesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
760 {
761     return sal_False;
762 }
763 // -------------------------------------------------------------------------
deletesAreDetected(sal_Int32)764 sal_Bool SAL_CALL KabDatabaseMetaData::deletesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
765 {
766     return sal_False;
767 }
768 // -------------------------------------------------------------------------
insertsAreDetected(sal_Int32)769 sal_Bool SAL_CALL KabDatabaseMetaData::insertsAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
770 {
771     return sal_False;
772 }
773 // -------------------------------------------------------------------------
supportsBatchUpdates()774 sal_Bool SAL_CALL KabDatabaseMetaData::supportsBatchUpdates(  ) throw(SQLException, RuntimeException)
775 {
776     return sal_False;
777 }
778 // -------------------------------------------------------------------------
getConnection()779 Reference< XConnection > SAL_CALL KabDatabaseMetaData::getConnection(  ) throw(SQLException, RuntimeException)
780 {
781     return (Reference< XConnection >) m_xConnection.get();
782 }
783 // -------------------------------------------------------------------------
getTableTypes()784 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTableTypes(  ) throw(SQLException, RuntimeException)
785 {
786     ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
787     Reference< XResultSet > xRef = pResult;
788 
789     static ODatabaseMetaDataResultSet::ORows aRows;
790     static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE"));
791 
792     if (aRows.empty())
793     {
794         ODatabaseMetaDataResultSet::ORow aRow(2);
795         aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
796         aRow[1] = new ORowSetValueDecorator(aTable);
797         aRows.push_back(aRow);
798     }
799     pResult->setRows(aRows);
800     return xRef;
801 }
802 // -------------------------------------------------------------------------
getTypeInfo()803 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTypeInfo(  ) throw(SQLException, RuntimeException)
804 {
805     ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
806     Reference< XResultSet > xRef = pResult;
807 
808     static ODatabaseMetaDataResultSet::ORows aRows;
809     if (aRows.empty())
810     {
811         ODatabaseMetaDataResultSet::ORow aRow(19);
812 
813         aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
814         aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"));
815         aRow[2] = new ORowSetValueDecorator(DataType::CHAR);
816         aRow[3] = new ORowSetValueDecorator((sal_Int32) 254);
817         aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
818         aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
819         aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
820         aRow[7] = new ORowSetValueDecorator((sal_Int32) ColumnValue::NULLABLE);
821         aRow[8] = ODatabaseMetaDataResultSet::get1Value();
822         aRow[9] = new ORowSetValueDecorator((sal_Int32) ColumnSearch::CHAR);
823         aRow[10] = ODatabaseMetaDataResultSet::get1Value();
824         aRow[11] = ODatabaseMetaDataResultSet::get0Value();
825         aRow[12] = ODatabaseMetaDataResultSet::get0Value();
826         aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
827         aRow[14] = ODatabaseMetaDataResultSet::get0Value();
828         aRow[15] = ODatabaseMetaDataResultSet::get0Value();
829         aRow[16] = ODatabaseMetaDataResultSet::getEmptyValue();
830         aRow[17] = ODatabaseMetaDataResultSet::getEmptyValue();
831         aRow[18] = new ORowSetValueDecorator((sal_Int32) 10);
832         aRows.push_back(aRow);
833 // Much more types might appear in KDE address books
834 // To be completed
835     }
836     pResult->setRows(aRows);
837     return xRef;
838 }
839 // -------------------------------------------------------------------------
getCatalogs()840 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getCatalogs(  ) throw(SQLException, RuntimeException)
841 {
842     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCatalogs );
843 }
844 // -----------------------------------------------------------------------------
getSchemas()845 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getSchemas(  ) throw(SQLException, RuntimeException)
846 {
847     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eSchemas );
848 }
849 // -------------------------------------------------------------------------
getColumnPrivileges(const Any &,const::rtl::OUString &,const::rtl::OUString &,const::rtl::OUString &)850 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumnPrivileges(
851     const Any&, const ::rtl::OUString&, const ::rtl::OUString&,
852     const ::rtl::OUString& ) throw(SQLException, RuntimeException)
853 {
854     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumnPrivileges );
855 }
856 // -------------------------------------------------------------------------
getColumns(const Any &,const::rtl::OUString &,const::rtl::OUString & tableNamePattern,const::rtl::OUString & columnNamePattern)857 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumns(
858     const Any&,
859     const ::rtl::OUString&,
860     const ::rtl::OUString& tableNamePattern,
861     const ::rtl::OUString& columnNamePattern) throw(SQLException, RuntimeException)
862 {
863     ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
864     Reference< XResultSet > xRef = pResult;
865 
866     ODatabaseMetaDataResultSet::ORows aRows;
867 
868     if (match(tableNamePattern, getAddressBookTableName(), '\0'))
869     {
870         ODatabaseMetaDataResultSet::ORow aRow(19);
871 
872         aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
873         aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
874         aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
875         aRow[3] = new ORowSetValueDecorator(getAddressBookTableName());
876         aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
877         aRow[9] = ODatabaseMetaDataResultSet::get0Value();
878         aRow[10] = new ORowSetValueDecorator((sal_Int32) 10);
879         aRow[11] = ODatabaseMetaDataResultSet::get1Value();
880         aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
881         aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
882         aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
883         aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
884         aRow[16] = new ORowSetValueDecorator((sal_Int32) 254);
885         aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES"));
886 
887         sal_Int32 nPosition = 1;
888         QString aQtName;
889         ::rtl::OUString sName;
890 
891         aQtName = ::KABC::Addressee::revisionLabel();
892         sName = (const sal_Unicode *) aQtName.ucs2();
893         if (match(columnNamePattern, sName, '\0'))
894         {
895             aRow[4] = new ORowSetValueDecorator(sName);
896             aRow[5] = new ORowSetValueDecorator(DataType::TIMESTAMP);
897             aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP"));
898             aRow[17] = new ORowSetValueDecorator(nPosition++);
899             aRows.push_back(aRow);
900         }
901 
902         ::KABC::Field::List aFields = ::KABC::Field::allFields();
903         ::KABC::Field::List::iterator aField;
904 
905         for (   aField = aFields.begin();
906                 aField != aFields.end();
907                 ++aField, ++nPosition)
908         {
909             aQtName = (*aField)->label();
910             sName = (const sal_Unicode *) aQtName.ucs2();
911             if (match(columnNamePattern, sName, '\0'))
912             {
913                 aRow[4] = new ORowSetValueDecorator(sName);
914                 aRow[5] = new ORowSetValueDecorator(DataType::CHAR);
915                 aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"));
916                 aRow[7] = new ORowSetValueDecorator((sal_Int32) 256);
917 // Might be VARCHAR and not CHAR[256]...
918                 aRow[17] = new ORowSetValueDecorator(nPosition);
919                 aRows.push_back(aRow);
920             }
921         }
922     }
923     pResult->setRows(aRows);
924     return xRef;
925 }
926 // -------------------------------------------------------------------------
getTables(const Any &,const::rtl::OUString &,const::rtl::OUString &,const Sequence<::rtl::OUString> & types)927 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTables(
928     const Any&,
929     const ::rtl::OUString&,
930     const ::rtl::OUString&,
931     const Sequence< ::rtl::OUString >& types) throw(SQLException, RuntimeException)
932 {
933     ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
934     Reference< XResultSet > xRef = pResult;
935 
936     // check whether we have tables in the requested types
937     // for the moment, we answer only the "TABLE" table type
938     // when no types are given at all, we return all the tables
939     static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE"));
940     sal_Bool bTableFound = sal_False;
941     const ::rtl::OUString* p = types.getConstArray(),
942                          * pEnd = p + types.getLength();
943 
944     if (p == pEnd)
945     {
946         bTableFound = sal_True;
947     }
948     else while (p < pEnd)
949     {
950         if (match(*p, aTable, '\0'))
951         {
952             bTableFound = sal_True;
953             break;
954         }
955         p++;
956     }
957     if (!bTableFound)
958         return xRef;
959 
960     static ODatabaseMetaDataResultSet::ORows aRows;
961 
962     if (aRows.empty())
963     {
964         ODatabaseMetaDataResultSet::ORow aRow(6);
965 
966         aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
967         aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
968         aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
969         aRow[3] = new ORowSetValueDecorator(getAddressBookTableName());
970         aRow[4] = new ORowSetValueDecorator(aTable);
971         aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
972         aRows.push_back(aRow);
973     }
974     pResult->setRows(aRows);
975     return xRef;
976 }
977 // -------------------------------------------------------------------------
getProcedureColumns(const Any &,const::rtl::OUString &,const::rtl::OUString &,const::rtl::OUString &)978 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getProcedureColumns(
979     const Any&, const ::rtl::OUString&,
980     const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
981 {
982     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedureColumns );
983 }
984 // -------------------------------------------------------------------------
getProcedures(const Any &,const::rtl::OUString &,const::rtl::OUString &)985 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getProcedures(
986     const Any&, const ::rtl::OUString&,
987     const ::rtl::OUString& ) throw(SQLException, RuntimeException)
988 {
989     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedures );
990 }
991 // -------------------------------------------------------------------------
getVersionColumns(const Any &,const::rtl::OUString &,const::rtl::OUString & table)992 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getVersionColumns(
993     const Any&, const ::rtl::OUString&, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
994 {
995     ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
996 
997     Reference< XResultSet > xRef = pResult;
998 
999     ODatabaseMetaDataResultSet::ORows aRows;
1000 
1001     if (table == getAddressBookTableName())
1002     {
1003         ODatabaseMetaDataResultSet::ORow aRow( 9 );
1004         QString aQtName = ::KABC::Addressee::revisionLabel();
1005         ::rtl::OUString sName = (const sal_Unicode *) aQtName.ucs2();
1006 
1007         aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
1008         aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
1009 
1010         aRow[2] = new ORowSetValueDecorator(sName);
1011         aRow[3] = new ORowSetValueDecorator(DataType::TIMESTAMP);
1012         aRow[4] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP"));
1013 
1014         aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
1015         aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
1016         aRow[7] = ODatabaseMetaDataResultSet::getEmptyValue();
1017         aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
1018 
1019         aRows.push_back(aRow);
1020     }
1021     pResult->setRows(aRows);
1022     return xRef;
1023 }
1024 // -------------------------------------------------------------------------
getExportedKeys(const Any &,const::rtl::OUString &,const::rtl::OUString &)1025 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getExportedKeys(
1026     const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1027 {
1028     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eExportedKeys );
1029 }
1030 // -------------------------------------------------------------------------
getImportedKeys(const Any &,const::rtl::OUString &,const::rtl::OUString &)1031 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getImportedKeys(
1032     const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1033 {
1034     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eImportedKeys );
1035 }
1036 // -------------------------------------------------------------------------
getPrimaryKeys(const Any &,const::rtl::OUString &,const::rtl::OUString &)1037 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getPrimaryKeys(
1038     const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1039 {
1040     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::ePrimaryKeys );
1041 }
1042 // -------------------------------------------------------------------------
getIndexInfo(const Any &,const::rtl::OUString &,const::rtl::OUString &,sal_Bool,sal_Bool)1043 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getIndexInfo(
1044     const Any&, const ::rtl::OUString&, const ::rtl::OUString&,
1045     sal_Bool, sal_Bool ) throw(SQLException, RuntimeException)
1046 {
1047     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eIndexInfo );
1048 }
1049 // -------------------------------------------------------------------------
getBestRowIdentifier(const Any &,const::rtl::OUString &,const::rtl::OUString &,sal_Int32,sal_Bool)1050 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getBestRowIdentifier(
1051     const Any&, const ::rtl::OUString&, const ::rtl::OUString&, sal_Int32,
1052     sal_Bool ) throw(SQLException, RuntimeException)
1053 {
1054     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eBestRowIdentifier );
1055 }
1056 // -------------------------------------------------------------------------
getTablePrivileges(const Any &,const::rtl::OUString &,const::rtl::OUString &)1057 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTablePrivileges(
1058     const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1059 {
1060     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
1061 }
1062 // -------------------------------------------------------------------------
getCrossReference(const Any &,const::rtl::OUString &,const::rtl::OUString &,const Any &,const::rtl::OUString &,const::rtl::OUString &)1063 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getCrossReference(
1064     const Any&, const ::rtl::OUString&,
1065     const ::rtl::OUString&, const Any&,
1066     const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1067 {
1068     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCrossReference );
1069 }
1070 // -------------------------------------------------------------------------
getUDTs(const Any &,const::rtl::OUString &,const::rtl::OUString &,const Sequence<sal_Int32> &)1071 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getUDTs( const Any&, const ::rtl::OUString&, const ::rtl::OUString&, const Sequence< sal_Int32 >& ) throw(SQLException, RuntimeException)
1072 {
1073     OSL_ENSURE(0,"Not implemented yet!");
1074     throw SQLException();
1075 }
1076 // -----------------------------------------------------------------------------
1077