Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / kab / KDatabaseMetaData.cxx
blob5e4b2fbaaf40e9929c56f0cb9a78f0b7079e3a48
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "KDatabaseMetaData.hxx"
22 #include "kfields.hxx"
23 #include "KDEInit.h"
24 #include <shell/kde_headers.h>
25 #include "FDatabaseMetaDataResultSet.hxx"
26 #include "OTypeInfo.hxx"
27 #include <com/sun/star/sdbc/ColumnValue.hpp>
28 #include <com/sun/star/sdbc/ResultSetType.hpp>
29 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
31 using namespace connectivity::kab;
32 using namespace com::sun::star::uno;
33 using namespace com::sun::star::lang;
34 using namespace com::sun::star::beans;
35 using namespace com::sun::star::sdbc;
37 KabDatabaseMetaData::KabDatabaseMetaData(KabConnection* _pCon)
38 : m_xConnection(_pCon),
39 m_bUseCatalog(sal_True)
41 OSL_ENSURE(_pCon,"KabDatabaseMetaData::KabDatabaseMetaData: No connection set!");
43 osl_atomic_increment( &m_refCount );
44 m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
45 osl_atomic_decrement( &m_refCount );
48 KabDatabaseMetaData::~KabDatabaseMetaData()
52 const OUString & KabDatabaseMetaData::getAddressBookTableName()
54 static const OUString aAddressBookTableName
55 (OUString::createFromAscii( i18n("Address Book") ));
57 return aAddressBookTableName;
60 OUString SAL_CALL KabDatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException, std::exception)
62 OUString aVal;
63 if (m_bUseCatalog)
64 { // do some special here for you database
67 return aVal;
70 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException, std::exception)
72 sal_Int32 nValue = 0; // 0 means no limit
73 return nValue;
76 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException, std::exception)
78 sal_Int32 nValue = 0; // 0 means no limit
79 return nValue;
82 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException, std::exception)
84 sal_Int32 nValue = 0; // 0 means no limit
85 return nValue;
88 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException, std::exception)
90 sal_Int32 nValue = 0; // 0 means no limit
91 return nValue;
94 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException, std::exception)
96 sal_Int32 nValue = 0; // 0 means no limit
97 return nValue;
100 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException, std::exception)
102 sal_Int32 nValue = 0; // 0 means no limit
103 return nValue;
106 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException, std::exception)
108 sal_Int32 nValue = 0; // 0 means no limit
109 return nValue;
112 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException, std::exception)
114 sal_Int32 nValue = 0; // 0 means no limit
115 return nValue;
118 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException, std::exception)
120 sal_Int32 nValue = 0; // 0 means no limit
121 return nValue;
124 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException, std::exception)
126 sal_Int32 nValue = 0; // 0 means no limit
127 return nValue;
130 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException, std::exception)
132 sal_Int32 nValue = 0; // 0 means no limit
133 return nValue;
136 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException, std::exception)
138 // MaxTablesInSelect describes how many tables can participate in the FROM part of a given SELECT statement,
139 // currently, the resultset/statement implementations can cope with one table only
140 sal_Int32 nValue = 1;
141 return nValue;
144 sal_Bool SAL_CALL KabDatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException, std::exception)
146 return sal_False;
149 sal_Bool SAL_CALL KabDatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
151 return sal_False;
154 sal_Bool SAL_CALL KabDatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
156 return sal_False;
159 sal_Bool SAL_CALL KabDatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
161 return sal_False;
164 sal_Bool SAL_CALL KabDatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
166 return sal_False;
169 sal_Bool SAL_CALL KabDatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
171 return sal_False;
174 sal_Bool SAL_CALL KabDatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
176 return sal_False;
179 sal_Bool SAL_CALL KabDatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException, std::exception)
181 return sal_False;
184 sal_Bool SAL_CALL KabDatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException, std::exception)
186 return sal_False;
189 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException, std::exception)
191 sal_Int32 nValue = 0; // 0 means no limit
192 return nValue;
195 sal_Bool SAL_CALL KabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException, std::exception)
197 return sal_False;
200 OUString SAL_CALL KabDatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException, std::exception)
202 OUString aVal;
203 if (m_bUseCatalog)
206 return aVal;
209 OUString SAL_CALL KabDatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException, std::exception)
211 // normally this is "
212 OUString aVal("\"");
213 return aVal;
216 OUString SAL_CALL KabDatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException, std::exception)
218 OUString aVal;
219 return aVal;
222 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException, std::exception)
224 return sal_False;
227 sal_Bool SAL_CALL KabDatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException, std::exception)
229 sal_Bool bValue = sal_False;
230 if (m_bUseCatalog)
233 return bValue;
236 sal_Bool SAL_CALL KabDatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException, std::exception)
238 return sal_True;
241 sal_Bool SAL_CALL KabDatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException, std::exception)
243 return sal_True;
246 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException, std::exception)
248 return sal_True;
251 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException, std::exception)
253 return sal_True;
256 sal_Bool SAL_CALL KabDatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException, std::exception)
258 return sal_False;
261 sal_Bool SAL_CALL KabDatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException, std::exception)
263 return sal_False;
266 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException, std::exception)
268 return sal_False;
271 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException, std::exception)
273 return sal_False;
276 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException, std::exception)
278 return sal_False;
281 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException, std::exception)
283 return sal_False;
286 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
288 return sal_False;
291 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException, std::exception)
293 return sal_False;
296 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException, std::exception)
298 return sal_False;
301 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException, std::exception)
303 return sal_True; // should be supported at least
306 sal_Bool SAL_CALL KabDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException, std::exception)
308 return sal_False;
311 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException, std::exception)
313 return sal_False;
316 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException, std::exception)
318 return sal_False;
321 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException, std::exception)
323 return sal_False;
326 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException, std::exception)
328 return sal_False;
331 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException, std::exception)
333 return sal_False;
336 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
338 return sal_False;
341 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException, std::exception)
343 sal_Int32 nValue = 0; // 0 means no limit
344 return nValue;
347 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException, std::exception)
349 sal_Int32 nValue = 0; // 0 means no limit
350 return nValue;
353 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException, std::exception)
355 sal_Int32 nValue = 0; // 0 means no limit
356 return nValue;
359 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException, std::exception)
361 return sal_False;
364 sal_Bool SAL_CALL KabDatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException, std::exception)
366 return sal_False;
369 sal_Bool SAL_CALL KabDatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException, std::exception)
371 return sal_False;
374 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException, std::exception)
376 return sal_False;
379 sal_Bool SAL_CALL KabDatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException, std::exception)
381 return sal_False;
384 sal_Bool SAL_CALL KabDatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException, std::exception)
386 // for the moment, we have read-only addresses, but this might change in the future
387 return sal_True;
390 sal_Bool SAL_CALL KabDatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException, std::exception)
392 return sal_False;
395 sal_Bool SAL_CALL KabDatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException, std::exception)
397 return sal_False;
400 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException, std::exception)
402 return sal_False;
405 sal_Bool SAL_CALL KabDatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException, std::exception)
407 return sal_False;
410 sal_Bool SAL_CALL KabDatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException, std::exception)
412 return sal_False;
415 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException, std::exception)
417 return sal_False;
420 sal_Bool SAL_CALL KabDatabaseMetaData::supportsConvert( sal_Int32, sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
422 return sal_False;
425 sal_Bool SAL_CALL KabDatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException, std::exception)
427 return sal_False;
430 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException, std::exception)
432 return sal_False;
435 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException, std::exception)
437 return sal_False;
440 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException, std::exception)
442 return sal_False;
445 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException, std::exception)
447 return sal_False;
450 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException, std::exception)
452 return sal_False;
455 sal_Bool SAL_CALL KabDatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException, std::exception)
457 return sal_False;
460 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException, std::exception)
462 return sal_False;
465 sal_Bool SAL_CALL KabDatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException, std::exception)
467 return sal_False;
470 sal_Bool SAL_CALL KabDatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException, std::exception)
472 return sal_False;
475 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
477 return sal_False;
480 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
482 return sal_False;
485 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException, std::exception)
487 return sal_False;
490 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException, std::exception)
492 return sal_False;
495 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException, std::exception)
497 return sal_False;
500 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException, std::exception)
502 return sal_False;
505 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException, std::exception)
507 return sal_False;
510 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException, std::exception)
512 return sal_False;
515 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException, std::exception)
517 return sal_False;
520 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException, std::exception)
522 return sal_False;
525 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException, std::exception)
527 return sal_False;
530 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException, std::exception)
532 return sal_False;
535 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException, std::exception)
537 return sal_False;
540 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException, std::exception)
542 return sal_False;
545 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException, std::exception)
547 return sal_False;
550 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException, std::exception)
552 return sal_False;
555 OUString SAL_CALL KabDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException, std::exception)
557 // if someday we support more than the default address book,
558 // this method should return the URL which was used to create it
559 OUString aValue( "sdbc:address:kab:" );
560 return aValue;
563 OUString SAL_CALL KabDatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException, std::exception)
565 OUString aValue;
566 return aValue;
569 OUString SAL_CALL KabDatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException, std::exception)
571 OUString aValue( "kab" );
572 return aValue;
575 OUString SAL_CALL KabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException, std::exception)
577 OUString aValue(KAB_DRIVER_VERSION);
578 return aValue;
581 OUString SAL_CALL KabDatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException, std::exception)
583 OUString aValue;
584 return aValue;
587 OUString SAL_CALL KabDatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException, std::exception)
589 OUString aValue;
590 return aValue;
593 OUString SAL_CALL KabDatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException, std::exception)
595 OUString aValue;
596 return aValue;
599 OUString SAL_CALL KabDatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException, std::exception)
601 OUString aValue;
602 return aValue;
605 sal_Int32 SAL_CALL KabDatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException, std::exception)
607 return KAB_DRIVER_VERSION_MAJOR;
610 sal_Int32 SAL_CALL KabDatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException, std::exception)
612 return TransactionIsolation::NONE;
615 sal_Int32 SAL_CALL KabDatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException, std::exception)
617 return KAB_DRIVER_VERSION_MINOR;
620 OUString SAL_CALL KabDatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException, std::exception)
622 OUString aValue;
623 return aValue;
626 OUString SAL_CALL KabDatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException, std::exception)
628 OUString aValue;
629 return aValue;
632 OUString SAL_CALL KabDatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException, std::exception)
634 return OUString();
637 OUString SAL_CALL KabDatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException, std::exception)
639 return OUString();
642 OUString SAL_CALL KabDatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException, std::exception)
644 return OUString();
647 OUString SAL_CALL KabDatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException, std::exception)
649 return OUString();
652 sal_Bool SAL_CALL KabDatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
654 return sal_False;
657 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
659 return sal_False;
662 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
664 return sal_True;
667 sal_Bool SAL_CALL KabDatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
669 return sal_False;
672 sal_Bool SAL_CALL KabDatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
674 return sal_False;
677 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException, std::exception)
679 sal_Int32 nValue = 0; // 0 means no limit
680 return nValue;
683 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException, std::exception)
685 sal_Int32 nValue = 0; // 0 means no limit
686 return nValue;
689 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException, std::exception)
691 sal_Int32 nValue = 0; // 0 means no limit
692 return nValue;
695 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException, std::exception)
697 sal_Int32 nValue = 0; // 0 means no limit
698 return nValue;
701 sal_Bool SAL_CALL KabDatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException, std::exception)
703 switch (setType)
705 case ResultSetType::FORWARD_ONLY:
706 case ResultSetType::SCROLL_INSENSITIVE:
707 return sal_True;
709 return sal_False;
712 sal_Bool SAL_CALL KabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
714 switch (setType)
716 case ResultSetType::FORWARD_ONLY:
717 case ResultSetType::SCROLL_INSENSITIVE:
718 return sal_True;
720 return sal_False;
723 sal_Bool SAL_CALL KabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
725 return sal_False;
728 sal_Bool SAL_CALL KabDatabaseMetaData::ownDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
730 return sal_False;
733 sal_Bool SAL_CALL KabDatabaseMetaData::ownInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
735 return sal_False;
738 sal_Bool SAL_CALL KabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
740 return sal_False;
743 sal_Bool SAL_CALL KabDatabaseMetaData::othersDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
745 return sal_False;
748 sal_Bool SAL_CALL KabDatabaseMetaData::othersInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
750 return sal_False;
753 sal_Bool SAL_CALL KabDatabaseMetaData::updatesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
755 return sal_False;
758 sal_Bool SAL_CALL KabDatabaseMetaData::deletesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
760 return sal_False;
763 sal_Bool SAL_CALL KabDatabaseMetaData::insertsAreDetected( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
765 return sal_False;
768 sal_Bool SAL_CALL KabDatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException, std::exception)
770 return sal_False;
773 Reference< XConnection > SAL_CALL KabDatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException, std::exception)
775 return (Reference< XConnection >) m_xConnection.get();
778 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException, std::exception)
780 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
781 Reference< XResultSet > xRef = pResult;
783 static ODatabaseMetaDataResultSet::ORows aRows;
784 static const OUString aTable("TABLE");
786 if (aRows.empty())
788 ODatabaseMetaDataResultSet::ORow aRow(2);
789 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
790 aRow[1] = new ORowSetValueDecorator(aTable);
791 aRows.push_back(aRow);
793 pResult->setRows(aRows);
794 return xRef;
797 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException, std::exception)
799 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
800 Reference< XResultSet > xRef = pResult;
802 static ODatabaseMetaDataResultSet::ORows aRows;
803 if (aRows.empty())
805 ODatabaseMetaDataResultSet::ORow aRow(19);
807 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
808 aRow[1] = new ORowSetValueDecorator(OUString("CHAR"));
809 aRow[2] = new ORowSetValueDecorator(DataType::CHAR);
810 aRow[3] = new ORowSetValueDecorator((sal_Int32) 254);
811 aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
812 aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
813 aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
814 aRow[7] = new ORowSetValueDecorator((sal_Int32) ColumnValue::NULLABLE);
815 aRow[8] = ODatabaseMetaDataResultSet::get1Value();
816 aRow[9] = new ORowSetValueDecorator((sal_Int32) ColumnSearch::CHAR);
817 aRow[10] = ODatabaseMetaDataResultSet::get1Value();
818 aRow[11] = ODatabaseMetaDataResultSet::get0Value();
819 aRow[12] = ODatabaseMetaDataResultSet::get0Value();
820 aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
821 aRow[14] = ODatabaseMetaDataResultSet::get0Value();
822 aRow[15] = ODatabaseMetaDataResultSet::get0Value();
823 aRow[16] = ODatabaseMetaDataResultSet::getEmptyValue();
824 aRow[17] = ODatabaseMetaDataResultSet::getEmptyValue();
825 aRow[18] = new ORowSetValueDecorator((sal_Int32) 10);
826 aRows.push_back(aRow);
827 // Much more types might appear in KDE address books
828 // To be completed
830 pResult->setRows(aRows);
831 return xRef;
834 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException, std::exception)
836 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCatalogs );
839 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException, std::exception)
841 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eSchemas );
844 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumnPrivileges(
845 const Any&, const OUString&, const OUString&,
846 const OUString& ) throw(SQLException, RuntimeException, std::exception)
848 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumnPrivileges );
851 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumns(
852 const Any&,
853 const OUString&,
854 const OUString& tableNamePattern,
855 const OUString& columnNamePattern) throw(SQLException, RuntimeException, std::exception)
857 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
858 Reference< XResultSet > xRef = pResult;
860 ODatabaseMetaDataResultSet::ORows aRows;
862 if (match(tableNamePattern, getAddressBookTableName(), '\0'))
864 ODatabaseMetaDataResultSet::ORow aRow(19);
866 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
867 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
868 aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
869 aRow[3] = new ORowSetValueDecorator(getAddressBookTableName());
870 aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
871 aRow[9] = ODatabaseMetaDataResultSet::get0Value();
872 aRow[10] = new ORowSetValueDecorator((sal_Int32) 10);
873 aRow[11] = ODatabaseMetaDataResultSet::get1Value();
874 aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
875 aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
876 aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
877 aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
878 aRow[16] = new ORowSetValueDecorator((sal_Int32) 254);
879 aRow[18] = new ORowSetValueDecorator(OUString("YES"));
881 sal_Int32 nPosition = 1;
882 QString aQtName;
883 OUString sName;
885 aQtName = ::KABC::Addressee::revisionLabel();
886 sName = (const sal_Unicode *) aQtName.ucs2();
887 if (match(columnNamePattern, sName, '\0'))
889 aRow[4] = new ORowSetValueDecorator(sName);
890 aRow[5] = new ORowSetValueDecorator(DataType::TIMESTAMP);
891 aRow[6] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
892 aRow[17] = new ORowSetValueDecorator(nPosition++);
893 aRows.push_back(aRow);
896 ::KABC::Field::List aFields = ::KABC::Field::allFields();
897 ::KABC::Field::List::iterator aField;
899 for ( aField = aFields.begin();
900 aField != aFields.end();
901 ++aField, ++nPosition)
903 aQtName = (*aField)->label();
904 sName = (const sal_Unicode *) aQtName.ucs2();
905 if (match(columnNamePattern, sName, '\0'))
907 aRow[4] = new ORowSetValueDecorator(sName);
908 aRow[5] = new ORowSetValueDecorator(DataType::CHAR);
909 aRow[6] = new ORowSetValueDecorator(OUString("CHAR"));
910 aRow[7] = new ORowSetValueDecorator((sal_Int32) 256);
911 // Might be VARCHAR and not CHAR[256]...
912 aRow[17] = new ORowSetValueDecorator(nPosition);
913 aRows.push_back(aRow);
917 pResult->setRows(aRows);
918 return xRef;
921 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTables(
922 const Any&,
923 const OUString&,
924 const OUString&,
925 const Sequence< OUString >& types) throw(SQLException, RuntimeException, std::exception)
927 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
928 Reference< XResultSet > xRef = pResult;
930 // check whether we have tables in the requested types
931 // for the moment, we answer only the "TABLE" table type
932 // when no types are given at all, we return all the tables
933 static const OUString aTable("TABLE");
934 sal_Bool bTableFound = sal_False;
935 const OUString* p = types.getConstArray(),
936 * pEnd = p + types.getLength();
938 if (p == pEnd)
940 bTableFound = sal_True;
942 else while (p < pEnd)
944 if (match(*p, aTable, '\0'))
946 bTableFound = sal_True;
947 break;
949 p++;
951 if (!bTableFound)
952 return xRef;
954 static ODatabaseMetaDataResultSet::ORows aRows;
956 if (aRows.empty())
958 ODatabaseMetaDataResultSet::ORow aRow(6);
960 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
961 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
962 aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
963 aRow[3] = new ORowSetValueDecorator(getAddressBookTableName());
964 aRow[4] = new ORowSetValueDecorator(aTable);
965 aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
966 aRows.push_back(aRow);
968 pResult->setRows(aRows);
969 return xRef;
972 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getProcedureColumns(
973 const Any&, const OUString&,
974 const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
976 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedureColumns );
979 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getProcedures(
980 const Any&, const OUString&,
981 const OUString& ) throw(SQLException, RuntimeException, std::exception)
983 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedures );
986 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getVersionColumns(
987 const Any&, const OUString&, const OUString& table ) throw(SQLException, RuntimeException, std::exception)
989 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
991 Reference< XResultSet > xRef = pResult;
993 ODatabaseMetaDataResultSet::ORows aRows;
995 if (table == getAddressBookTableName())
997 ODatabaseMetaDataResultSet::ORow aRow( 9 );
998 QString aQtName = ::KABC::Addressee::revisionLabel();
999 OUString sName = (const sal_Unicode *) aQtName.ucs2();
1001 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
1002 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
1004 aRow[2] = new ORowSetValueDecorator(sName);
1005 aRow[3] = new ORowSetValueDecorator(DataType::TIMESTAMP);
1006 aRow[4] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
1008 aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
1009 aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
1010 aRow[7] = ODatabaseMetaDataResultSet::getEmptyValue();
1011 aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
1013 aRows.push_back(aRow);
1015 pResult->setRows(aRows);
1016 return xRef;
1019 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getExportedKeys(
1020 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
1022 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eExportedKeys );
1025 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getImportedKeys(
1026 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
1028 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eImportedKeys );
1031 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getPrimaryKeys(
1032 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
1034 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::ePrimaryKeys );
1037 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getIndexInfo(
1038 const Any&, const OUString&, const OUString&,
1039 sal_Bool, sal_Bool ) throw(SQLException, RuntimeException, std::exception)
1041 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eIndexInfo );
1044 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getBestRowIdentifier(
1045 const Any&, const OUString&, const OUString&, sal_Int32,
1046 sal_Bool ) throw(SQLException, RuntimeException, std::exception)
1048 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eBestRowIdentifier );
1051 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTablePrivileges(
1052 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
1054 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
1057 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getCrossReference(
1058 const Any&, const OUString&,
1059 const OUString&, const Any&,
1060 const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
1062 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCrossReference );
1065 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getUDTs( const Any&, const OUString&, const OUString&, const Sequence< sal_Int32 >& ) throw(SQLException, RuntimeException, std::exception)
1067 OSL_FAIL("Not implemented yet!");
1068 throw SQLException();
1072 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */