update dev300-m58
[ooovba.git] / connectivity / source / drivers / kab / KDatabaseMetaData.cxx
blob3d40b259513785f08456fde93f1130caea1974af
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: KDatabaseMetaData.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
34 #include "KDatabaseMetaData.hxx"
35 #include "kfields.hxx"
36 #include "KDEInit.h"
37 #include <vcl/kde_headers.h>
38 #include "FDatabaseMetaDataResultSet.hxx"
39 #include "OTypeInfo.hxx"
40 #include <com/sun/star/sdbc/ColumnValue.hpp>
41 #include <com/sun/star/sdbc/ResultSetType.hpp>
42 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
44 using namespace connectivity::kab;
45 using namespace com::sun::star::uno;
46 using namespace com::sun::star::lang;
47 using namespace com::sun::star::beans;
48 using namespace com::sun::star::sdbc;
50 KabDatabaseMetaData::KabDatabaseMetaData(KabConnection* _pCon)
51 : m_xConnection(_pCon),
52 m_bUseCatalog(sal_True)
54 OSL_ENSURE(_pCon,"KabDatabaseMetaData::KabDatabaseMetaData: No connection set!");
56 osl_incrementInterlockedCount( &m_refCount );
57 m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
58 osl_decrementInterlockedCount( &m_refCount );
60 // -------------------------------------------------------------------------
61 KabDatabaseMetaData::~KabDatabaseMetaData()
64 // -------------------------------------------------------------------------
65 const ::rtl::OUString & KabDatabaseMetaData::getAddressBookTableName()
67 static const ::rtl::OUString aAddressBookTableName
68 (::rtl::OUString::createFromAscii( i18n("Address Book") ));
70 return aAddressBookTableName;
72 // -------------------------------------------------------------------------
73 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException)
75 ::rtl::OUString aVal;
76 if (m_bUseCatalog)
77 { // do some special here for you database
80 return aVal;
82 // -------------------------------------------------------------------------
83 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
85 sal_Int32 nValue = 0; // 0 means no limit
86 return nValue;
88 // -------------------------------------------------------------------------
89 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
91 sal_Int32 nValue = 0; // 0 means no limit
92 return nValue;
94 // -------------------------------------------------------------------------
95 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
97 sal_Int32 nValue = 0; // 0 means no limit
98 return nValue;
100 // -------------------------------------------------------------------------
101 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
103 sal_Int32 nValue = 0; // 0 means no limit
104 return nValue;
106 // -------------------------------------------------------------------------
107 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
109 sal_Int32 nValue = 0; // 0 means no limit
110 return nValue;
112 // -------------------------------------------------------------------------
113 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
115 sal_Int32 nValue = 0; // 0 means no limit
116 return nValue;
118 // -------------------------------------------------------------------------
119 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
121 sal_Int32 nValue = 0; // 0 means no limit
122 return nValue;
124 // -------------------------------------------------------------------------
125 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
127 sal_Int32 nValue = 0; // 0 means no limit
128 return nValue;
130 // -------------------------------------------------------------------------
131 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
133 sal_Int32 nValue = 0; // 0 means no limit
134 return nValue;
136 // -------------------------------------------------------------------------
137 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
139 sal_Int32 nValue = 0; // 0 means no limit
140 return nValue;
142 // -------------------------------------------------------------------------
143 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
145 sal_Int32 nValue = 0; // 0 means no limit
146 return nValue;
148 // -------------------------------------------------------------------------
149 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException)
151 // MaxTablesInSelect describes how many tables can participate in the FROM part of a given SELECT statement,
152 // currently, the resultset/statement implementations can cope with one table only
153 sal_Int32 nValue = 1;
154 return nValue;
156 // -------------------------------------------------------------------------
157 sal_Bool SAL_CALL KabDatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
159 return sal_False;
161 // -------------------------------------------------------------------------
162 sal_Bool SAL_CALL KabDatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
164 return sal_False;
166 // -------------------------------------------------------------------------
167 sal_Bool SAL_CALL KabDatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
169 return sal_False;
171 // -------------------------------------------------------------------------
172 sal_Bool SAL_CALL KabDatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
174 return sal_False;
176 // -------------------------------------------------------------------------
177 sal_Bool SAL_CALL KabDatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
179 return sal_False;
181 // -------------------------------------------------------------------------
182 sal_Bool SAL_CALL KabDatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
184 return sal_False;
186 // -------------------------------------------------------------------------
187 sal_Bool SAL_CALL KabDatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
189 return sal_False;
191 // -------------------------------------------------------------------------
192 sal_Bool SAL_CALL KabDatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException)
194 return sal_False;
196 // -------------------------------------------------------------------------
197 sal_Bool SAL_CALL KabDatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException)
199 return sal_False;
201 // -------------------------------------------------------------------------
202 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
204 sal_Int32 nValue = 0; // 0 means no limit
205 return nValue;
207 // -------------------------------------------------------------------------
208 sal_Bool SAL_CALL KabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
210 return sal_False;
212 // -------------------------------------------------------------------------
213 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
215 ::rtl::OUString aVal;
216 if (m_bUseCatalog)
219 return aVal;
221 // -------------------------------------------------------------------------
222 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException)
224 // normally this is "
225 ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("\"");
226 return aVal;
228 // -------------------------------------------------------------------------
229 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
231 ::rtl::OUString aVal;
232 return aVal;
234 // -------------------------------------------------------------------------
235 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
237 return sal_False;
239 // -------------------------------------------------------------------------
240 sal_Bool SAL_CALL KabDatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException)
242 sal_Bool bValue = sal_False;
243 if (m_bUseCatalog)
246 return bValue;
248 // -------------------------------------------------------------------------
249 sal_Bool SAL_CALL KabDatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
251 return sal_True;
253 // -------------------------------------------------------------------------
254 sal_Bool SAL_CALL KabDatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
256 return sal_True;
258 // -------------------------------------------------------------------------
259 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
261 return sal_True;
263 // -------------------------------------------------------------------------
264 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
266 return sal_True;
268 // -------------------------------------------------------------------------
269 sal_Bool SAL_CALL KabDatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
271 return sal_False;
273 // -------------------------------------------------------------------------
274 sal_Bool SAL_CALL KabDatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
276 return sal_False;
278 // -------------------------------------------------------------------------
279 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
281 return sal_False;
283 // -------------------------------------------------------------------------
284 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
286 return sal_False;
288 // -------------------------------------------------------------------------
289 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
291 return sal_False;
293 // -------------------------------------------------------------------------
294 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
296 return sal_False;
298 // -------------------------------------------------------------------------
299 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 ) throw(SQLException, RuntimeException)
301 return sal_False;
303 // -------------------------------------------------------------------------
304 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException)
306 return sal_False;
308 // -------------------------------------------------------------------------
309 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
311 return sal_False;
313 // -------------------------------------------------------------------------
314 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
316 return sal_True; // should be supported at least
318 // -------------------------------------------------------------------------
319 sal_Bool SAL_CALL KabDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
321 return sal_False;
323 // -------------------------------------------------------------------------
324 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
326 return sal_False;
328 // -------------------------------------------------------------------------
329 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException)
331 return sal_False;
333 // -------------------------------------------------------------------------
334 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException)
336 return sal_False;
338 // -------------------------------------------------------------------------
339 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
341 return sal_False;
343 // -------------------------------------------------------------------------
344 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException)
346 return sal_False;
348 // -------------------------------------------------------------------------
349 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
351 return sal_False;
353 // -------------------------------------------------------------------------
354 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException)
356 sal_Int32 nValue = 0; // 0 means no limit
357 return nValue;
359 // -------------------------------------------------------------------------
360 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
362 sal_Int32 nValue = 0; // 0 means no limit
363 return nValue;
365 // -------------------------------------------------------------------------
366 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
368 sal_Int32 nValue = 0; // 0 means no limit
369 return nValue;
371 // -------------------------------------------------------------------------
372 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
374 return sal_False;
376 // -------------------------------------------------------------------------
377 sal_Bool SAL_CALL KabDatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
379 return sal_False;
381 // -------------------------------------------------------------------------
382 sal_Bool SAL_CALL KabDatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
384 return sal_False;
386 // -------------------------------------------------------------------------
387 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
389 return sal_False;
391 // -------------------------------------------------------------------------
392 sal_Bool SAL_CALL KabDatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
394 return sal_False;
396 // -------------------------------------------------------------------------
397 sal_Bool SAL_CALL KabDatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
399 // for the moment, we have read-only addresses, but this might change in the future
400 return sal_True;
402 // -------------------------------------------------------------------------
403 sal_Bool SAL_CALL KabDatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
405 return sal_False;
407 // -------------------------------------------------------------------------
408 sal_Bool SAL_CALL KabDatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
410 return sal_False;
412 // -------------------------------------------------------------------------
413 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
415 return sal_False;
417 // -------------------------------------------------------------------------
418 sal_Bool SAL_CALL KabDatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
420 return sal_False;
422 // -------------------------------------------------------------------------
423 sal_Bool SAL_CALL KabDatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
425 return sal_False;
427 // -------------------------------------------------------------------------
428 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
430 return sal_False;
432 // -------------------------------------------------------------------------
433 sal_Bool SAL_CALL KabDatabaseMetaData::supportsConvert( sal_Int32, sal_Int32 ) throw(SQLException, RuntimeException)
435 return sal_False;
437 // -------------------------------------------------------------------------
438 sal_Bool SAL_CALL KabDatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
440 return sal_False;
442 // -------------------------------------------------------------------------
443 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
445 return sal_False;
447 // -------------------------------------------------------------------------
448 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
450 return sal_False;
452 // -------------------------------------------------------------------------
453 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
455 return sal_False;
457 // -------------------------------------------------------------------------
458 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
460 return sal_False;
462 // -------------------------------------------------------------------------
463 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
465 return sal_False;
467 // -------------------------------------------------------------------------
468 sal_Bool SAL_CALL KabDatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
470 return sal_False;
472 // -------------------------------------------------------------------------
473 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
475 return sal_False;
477 // -------------------------------------------------------------------------
478 sal_Bool SAL_CALL KabDatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
480 return sal_False;
482 // -------------------------------------------------------------------------
483 sal_Bool SAL_CALL KabDatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
485 return sal_False;
487 // -------------------------------------------------------------------------
488 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
490 return sal_False;
492 // -------------------------------------------------------------------------
493 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
495 return sal_False;
497 // -------------------------------------------------------------------------
498 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
500 return sal_False;
502 // -------------------------------------------------------------------------
503 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
505 return sal_False;
507 // -------------------------------------------------------------------------
508 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
510 return sal_False;
512 // -------------------------------------------------------------------------
513 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
515 return sal_False;
517 // -------------------------------------------------------------------------
518 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
520 return sal_False;
522 // -------------------------------------------------------------------------
523 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
525 return sal_False;
527 // -------------------------------------------------------------------------
528 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
530 return sal_False;
532 // -------------------------------------------------------------------------
533 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
535 return sal_False;
537 // -------------------------------------------------------------------------
538 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
540 return sal_False;
542 // -------------------------------------------------------------------------
543 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
545 return sal_False;
547 // -------------------------------------------------------------------------
548 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
550 return sal_False;
552 // -------------------------------------------------------------------------
553 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
555 return sal_False;
557 // -------------------------------------------------------------------------
558 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
560 return sal_False;
562 // -------------------------------------------------------------------------
563 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
565 return sal_False;
567 // -------------------------------------------------------------------------
568 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
570 // if someday we support more than the default address book,
571 // this method should return the URL which was used to create it
572 ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:address:kab:");
573 return aValue;
575 // -------------------------------------------------------------------------
576 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
578 ::rtl::OUString aValue;
579 return aValue;
581 // -------------------------------------------------------------------------
582 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
584 ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("kab");
585 return aValue;
587 // -------------------------------------------------------------------------
588 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
590 ::rtl::OUString aValue = ::rtl::OUString::createFromAscii(KAB_DRIVER_VERSION);
591 return aValue;
593 // -------------------------------------------------------------------------
594 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
596 ::rtl::OUString aValue;
597 return aValue;
599 // -------------------------------------------------------------------------
600 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
602 ::rtl::OUString aValue;
603 return aValue;
605 // -------------------------------------------------------------------------
606 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
608 ::rtl::OUString aValue;
609 return aValue;
611 // -------------------------------------------------------------------------
612 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
614 ::rtl::OUString aValue;
615 return aValue;
617 // -------------------------------------------------------------------------
618 sal_Int32 SAL_CALL KabDatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
620 return KAB_DRIVER_VERSION_MAJOR;
622 // -------------------------------------------------------------------------
623 sal_Int32 SAL_CALL KabDatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
625 return TransactionIsolation::NONE;
627 // -------------------------------------------------------------------------
628 sal_Int32 SAL_CALL KabDatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
630 return KAB_DRIVER_VERSION_MINOR;
632 // -------------------------------------------------------------------------
633 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
635 ::rtl::OUString aValue;
636 return aValue;
638 // -------------------------------------------------------------------------
639 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
641 ::rtl::OUString aValue;
642 return aValue;
644 // -------------------------------------------------------------------------
645 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
647 return ::rtl::OUString();
649 // -------------------------------------------------------------------------
650 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
652 return ::rtl::OUString();
654 // -------------------------------------------------------------------------
655 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
657 return ::rtl::OUString();
659 // -------------------------------------------------------------------------
660 ::rtl::OUString SAL_CALL KabDatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
662 return ::rtl::OUString();
664 // -------------------------------------------------------------------------
665 sal_Bool SAL_CALL KabDatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
667 return sal_False;
669 // -------------------------------------------------------------------------
670 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
672 return sal_False;
674 // -------------------------------------------------------------------------
675 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
677 return sal_True;
679 // -------------------------------------------------------------------------
680 sal_Bool SAL_CALL KabDatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
682 return sal_False;
684 // -------------------------------------------------------------------------
685 sal_Bool SAL_CALL KabDatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
687 return sal_False;
689 // -------------------------------------------------------------------------
690 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
692 sal_Int32 nValue = 0; // 0 means no limit
693 return nValue;
695 // -------------------------------------------------------------------------
696 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
698 sal_Int32 nValue = 0; // 0 means no limit
699 return nValue;
701 // -------------------------------------------------------------------------
702 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
704 sal_Int32 nValue = 0; // 0 means no limit
705 return nValue;
707 // -------------------------------------------------------------------------
708 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
710 sal_Int32 nValue = 0; // 0 means no limit
711 return nValue;
713 // -------------------------------------------------------------------------
714 sal_Bool SAL_CALL KabDatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
716 switch (setType)
718 case ResultSetType::FORWARD_ONLY:
719 case ResultSetType::SCROLL_INSENSITIVE:
720 return sal_True;
722 return sal_False;
724 // -------------------------------------------------------------------------
725 sal_Bool SAL_CALL KabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 ) throw(SQLException, RuntimeException)
727 switch (setType)
729 case ResultSetType::FORWARD_ONLY:
730 case ResultSetType::SCROLL_INSENSITIVE:
731 return sal_True;
733 return sal_False;
735 // -------------------------------------------------------------------------
736 sal_Bool SAL_CALL KabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
738 return sal_False;
740 // -------------------------------------------------------------------------
741 sal_Bool SAL_CALL KabDatabaseMetaData::ownDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
743 return sal_False;
745 // -------------------------------------------------------------------------
746 sal_Bool SAL_CALL KabDatabaseMetaData::ownInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
748 return sal_False;
750 // -------------------------------------------------------------------------
751 sal_Bool SAL_CALL KabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
753 return sal_False;
755 // -------------------------------------------------------------------------
756 sal_Bool SAL_CALL KabDatabaseMetaData::othersDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
758 return sal_False;
760 // -------------------------------------------------------------------------
761 sal_Bool SAL_CALL KabDatabaseMetaData::othersInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
763 return sal_False;
765 // -------------------------------------------------------------------------
766 sal_Bool SAL_CALL KabDatabaseMetaData::updatesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
768 return sal_False;
770 // -------------------------------------------------------------------------
771 sal_Bool SAL_CALL KabDatabaseMetaData::deletesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
773 return sal_False;
775 // -------------------------------------------------------------------------
776 sal_Bool SAL_CALL KabDatabaseMetaData::insertsAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
778 return sal_False;
780 // -------------------------------------------------------------------------
781 sal_Bool SAL_CALL KabDatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
783 return sal_False;
785 // -------------------------------------------------------------------------
786 Reference< XConnection > SAL_CALL KabDatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException)
788 return (Reference< XConnection >) m_xConnection.get();
790 // -------------------------------------------------------------------------
791 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
793 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
794 Reference< XResultSet > xRef = pResult;
796 static ODatabaseMetaDataResultSet::ORows aRows;
797 static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE"));
799 if (aRows.empty())
801 ODatabaseMetaDataResultSet::ORow aRow(2);
802 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
803 aRow[1] = new ORowSetValueDecorator(aTable);
804 aRows.push_back(aRow);
806 pResult->setRows(aRows);
807 return xRef;
809 // -------------------------------------------------------------------------
810 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException)
812 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
813 Reference< XResultSet > xRef = pResult;
815 static ODatabaseMetaDataResultSet::ORows aRows;
816 if (aRows.empty())
818 ODatabaseMetaDataResultSet::ORow aRow(19);
820 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
821 aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"));
822 aRow[2] = new ORowSetValueDecorator(DataType::CHAR);
823 aRow[3] = new ORowSetValueDecorator((sal_Int32) 254);
824 aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
825 aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
826 aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
827 aRow[7] = new ORowSetValueDecorator((sal_Int32) ColumnValue::NULLABLE);
828 aRow[8] = ODatabaseMetaDataResultSet::get1Value();
829 aRow[9] = new ORowSetValueDecorator((sal_Int32) ColumnSearch::CHAR);
830 aRow[10] = ODatabaseMetaDataResultSet::get1Value();
831 aRow[11] = ODatabaseMetaDataResultSet::get0Value();
832 aRow[12] = ODatabaseMetaDataResultSet::get0Value();
833 aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
834 aRow[14] = ODatabaseMetaDataResultSet::get0Value();
835 aRow[15] = ODatabaseMetaDataResultSet::get0Value();
836 aRow[16] = ODatabaseMetaDataResultSet::getEmptyValue();
837 aRow[17] = ODatabaseMetaDataResultSet::getEmptyValue();
838 aRow[18] = new ORowSetValueDecorator((sal_Int32) 10);
839 aRows.push_back(aRow);
840 // Much more types might appear in KDE address books
841 // To be completed
843 pResult->setRows(aRows);
844 return xRef;
846 // -------------------------------------------------------------------------
847 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException)
849 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCatalogs );
851 // -----------------------------------------------------------------------------
852 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException)
854 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eSchemas );
856 // -------------------------------------------------------------------------
857 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumnPrivileges(
858 const Any&, const ::rtl::OUString&, const ::rtl::OUString&,
859 const ::rtl::OUString& ) throw(SQLException, RuntimeException)
861 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumnPrivileges );
863 // -------------------------------------------------------------------------
864 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumns(
865 const Any&,
866 const ::rtl::OUString&,
867 const ::rtl::OUString& tableNamePattern,
868 const ::rtl::OUString& columnNamePattern) throw(SQLException, RuntimeException)
870 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
871 Reference< XResultSet > xRef = pResult;
873 ODatabaseMetaDataResultSet::ORows aRows;
875 if (match(tableNamePattern, getAddressBookTableName(), '\0'))
877 ODatabaseMetaDataResultSet::ORow aRow(19);
879 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
880 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
881 aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
882 aRow[3] = new ORowSetValueDecorator(getAddressBookTableName());
883 aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
884 aRow[9] = ODatabaseMetaDataResultSet::get0Value();
885 aRow[10] = new ORowSetValueDecorator((sal_Int32) 10);
886 aRow[11] = ODatabaseMetaDataResultSet::get1Value();
887 aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
888 aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
889 aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
890 aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
891 aRow[16] = new ORowSetValueDecorator((sal_Int32) 254);
892 aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES"));
894 sal_Int32 nPosition = 1;
895 QString aQtName;
896 ::rtl::OUString sName;
898 aQtName = ::KABC::Addressee::revisionLabel();
899 sName = (const sal_Unicode *) aQtName.ucs2();
900 if (match(columnNamePattern, sName, '\0'))
902 aRow[4] = new ORowSetValueDecorator(sName);
903 aRow[5] = new ORowSetValueDecorator(DataType::TIMESTAMP);
904 aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP"));
905 aRow[17] = new ORowSetValueDecorator(nPosition++);
906 aRows.push_back(aRow);
909 ::KABC::Field::List aFields = ::KABC::Field::allFields();
910 ::KABC::Field::List::iterator aField;
912 for ( aField = aFields.begin();
913 aField != aFields.end();
914 ++aField, ++nPosition)
916 aQtName = (*aField)->label();
917 sName = (const sal_Unicode *) aQtName.ucs2();
918 if (match(columnNamePattern, sName, '\0'))
920 aRow[4] = new ORowSetValueDecorator(sName);
921 aRow[5] = new ORowSetValueDecorator(DataType::CHAR);
922 aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"));
923 aRow[7] = new ORowSetValueDecorator((sal_Int32) 256);
924 // Might be VARCHAR and not CHAR[256]...
925 aRow[17] = new ORowSetValueDecorator(nPosition);
926 aRows.push_back(aRow);
930 pResult->setRows(aRows);
931 return xRef;
933 // -------------------------------------------------------------------------
934 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTables(
935 const Any&,
936 const ::rtl::OUString&,
937 const ::rtl::OUString&,
938 const Sequence< ::rtl::OUString >& types) throw(SQLException, RuntimeException)
940 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
941 Reference< XResultSet > xRef = pResult;
943 // check whether we have tables in the requested types
944 // for the moment, we answer only the "TABLE" table type
945 // when no types are given at all, we return all the tables
946 static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE"));
947 sal_Bool bTableFound = sal_False;
948 const ::rtl::OUString* p = types.getConstArray(),
949 * pEnd = p + types.getLength();
951 if (p == pEnd)
953 bTableFound = sal_True;
955 else while (p < pEnd)
957 if (match(*p, aTable, '\0'))
959 bTableFound = sal_True;
960 break;
962 p++;
964 if (!bTableFound)
965 return xRef;
967 static ODatabaseMetaDataResultSet::ORows aRows;
969 if (aRows.empty())
971 ODatabaseMetaDataResultSet::ORow aRow(6);
973 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
974 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
975 aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
976 aRow[3] = new ORowSetValueDecorator(getAddressBookTableName());
977 aRow[4] = new ORowSetValueDecorator(aTable);
978 aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
979 aRows.push_back(aRow);
981 pResult->setRows(aRows);
982 return xRef;
984 // -------------------------------------------------------------------------
985 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getProcedureColumns(
986 const Any&, const ::rtl::OUString&,
987 const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
989 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedureColumns );
991 // -------------------------------------------------------------------------
992 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getProcedures(
993 const Any&, const ::rtl::OUString&,
994 const ::rtl::OUString& ) throw(SQLException, RuntimeException)
996 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedures );
998 // -------------------------------------------------------------------------
999 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getVersionColumns(
1000 const Any&, const ::rtl::OUString&, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
1002 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
1004 Reference< XResultSet > xRef = pResult;
1006 ODatabaseMetaDataResultSet::ORows aRows;
1008 if (table == getAddressBookTableName())
1010 ODatabaseMetaDataResultSet::ORow aRow( 9 );
1011 QString aQtName = ::KABC::Addressee::revisionLabel();
1012 ::rtl::OUString sName = (const sal_Unicode *) aQtName.ucs2();
1014 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
1015 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
1017 aRow[2] = new ORowSetValueDecorator(sName);
1018 aRow[3] = new ORowSetValueDecorator(DataType::TIMESTAMP);
1019 aRow[4] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP"));
1021 aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
1022 aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
1023 aRow[7] = ODatabaseMetaDataResultSet::getEmptyValue();
1024 aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
1026 aRows.push_back(aRow);
1028 pResult->setRows(aRows);
1029 return xRef;
1031 // -------------------------------------------------------------------------
1032 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getExportedKeys(
1033 const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1035 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eExportedKeys );
1037 // -------------------------------------------------------------------------
1038 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getImportedKeys(
1039 const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1041 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eImportedKeys );
1043 // -------------------------------------------------------------------------
1044 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getPrimaryKeys(
1045 const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1047 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::ePrimaryKeys );
1049 // -------------------------------------------------------------------------
1050 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getIndexInfo(
1051 const Any&, const ::rtl::OUString&, const ::rtl::OUString&,
1052 sal_Bool, sal_Bool ) throw(SQLException, RuntimeException)
1054 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eIndexInfo );
1056 // -------------------------------------------------------------------------
1057 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getBestRowIdentifier(
1058 const Any&, const ::rtl::OUString&, const ::rtl::OUString&, sal_Int32,
1059 sal_Bool ) throw(SQLException, RuntimeException)
1061 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eBestRowIdentifier );
1063 // -------------------------------------------------------------------------
1064 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTablePrivileges(
1065 const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1067 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
1069 // -------------------------------------------------------------------------
1070 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getCrossReference(
1071 const Any&, const ::rtl::OUString&,
1072 const ::rtl::OUString&, const Any&,
1073 const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1075 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCrossReference );
1077 // -------------------------------------------------------------------------
1078 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getUDTs( const Any&, const ::rtl::OUString&, const ::rtl::OUString&, const Sequence< sal_Int32 >& ) throw(SQLException, RuntimeException)
1080 OSL_ENSURE(0,"Not implemented yet!");
1081 throw SQLException();
1083 // -----------------------------------------------------------------------------