update emoji autocorrect entries from po-files
[LibreOffice.git] / connectivity / source / drivers / kab / KDatabaseMetaData.cxx
blob6f909a1f1c663c900239caf1b6ee806f2058baf2
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(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("Address Book");
55 return aAddressBookTableName;
58 OUString SAL_CALL KabDatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException, std::exception)
60 OUString aVal;
61 if (m_bUseCatalog)
62 { // do some special here for you database
65 return aVal;
68 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException, std::exception)
70 sal_Int32 nValue = 0; // 0 means no limit
71 return nValue;
74 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException, std::exception)
76 sal_Int32 nValue = 0; // 0 means no limit
77 return nValue;
80 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException, std::exception)
82 sal_Int32 nValue = 0; // 0 means no limit
83 return nValue;
86 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException, std::exception)
88 sal_Int32 nValue = 0; // 0 means no limit
89 return nValue;
92 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException, std::exception)
94 sal_Int32 nValue = 0; // 0 means no limit
95 return nValue;
98 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException, std::exception)
100 sal_Int32 nValue = 0; // 0 means no limit
101 return nValue;
104 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException, std::exception)
106 sal_Int32 nValue = 0; // 0 means no limit
107 return nValue;
110 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException, std::exception)
112 sal_Int32 nValue = 0; // 0 means no limit
113 return nValue;
116 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException, std::exception)
118 sal_Int32 nValue = 0; // 0 means no limit
119 return nValue;
122 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException, std::exception)
124 sal_Int32 nValue = 0; // 0 means no limit
125 return nValue;
128 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException, std::exception)
130 sal_Int32 nValue = 0; // 0 means no limit
131 return nValue;
134 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException, std::exception)
136 // MaxTablesInSelect describes how many tables can participate in the FROM part of a given SELECT statement,
137 // currently, the resultset/statement implementations can cope with one table only
138 sal_Int32 nValue = 1;
139 return nValue;
142 sal_Bool SAL_CALL KabDatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException, std::exception)
144 return sal_False;
147 sal_Bool SAL_CALL KabDatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
149 return sal_False;
152 sal_Bool SAL_CALL KabDatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
154 return sal_False;
157 sal_Bool SAL_CALL KabDatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
159 return sal_False;
162 sal_Bool SAL_CALL KabDatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
164 return sal_False;
167 sal_Bool SAL_CALL KabDatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
169 return sal_False;
172 sal_Bool SAL_CALL KabDatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
174 return sal_False;
177 sal_Bool SAL_CALL KabDatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException, std::exception)
179 return sal_False;
182 sal_Bool SAL_CALL KabDatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException, std::exception)
184 return sal_False;
187 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException, std::exception)
189 sal_Int32 nValue = 0; // 0 means no limit
190 return nValue;
193 sal_Bool SAL_CALL KabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException, std::exception)
195 return sal_False;
198 OUString SAL_CALL KabDatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException, std::exception)
200 OUString aVal;
201 if (m_bUseCatalog)
204 return aVal;
207 OUString SAL_CALL KabDatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException, std::exception)
209 // normally this is "
210 OUString aVal("\"");
211 return aVal;
214 OUString SAL_CALL KabDatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException, std::exception)
216 OUString aVal;
217 return aVal;
220 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException, std::exception)
222 return sal_False;
225 sal_Bool SAL_CALL KabDatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException, std::exception)
227 bool bValue = false;
228 if (m_bUseCatalog)
231 return bValue;
234 sal_Bool SAL_CALL KabDatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException, std::exception)
236 return sal_True;
239 sal_Bool SAL_CALL KabDatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException, std::exception)
241 return sal_True;
244 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException, std::exception)
246 return sal_True;
249 sal_Bool SAL_CALL KabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException, std::exception)
251 return sal_True;
254 sal_Bool SAL_CALL KabDatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException, std::exception)
256 return sal_False;
259 sal_Bool SAL_CALL KabDatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException, std::exception)
261 return sal_False;
264 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException, std::exception)
266 return sal_False;
269 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException, std::exception)
271 return sal_False;
274 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException, std::exception)
276 return sal_False;
279 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException, std::exception)
281 return sal_False;
284 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
286 return sal_False;
289 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException, std::exception)
291 return sal_False;
294 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException, std::exception)
296 return sal_False;
299 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException, std::exception)
301 return sal_True; // should be supported at least
304 sal_Bool SAL_CALL KabDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException, std::exception)
306 return sal_False;
309 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException, std::exception)
311 return sal_False;
314 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException, std::exception)
316 return sal_False;
319 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException, std::exception)
321 return sal_False;
324 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException, std::exception)
326 return sal_False;
329 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException, std::exception)
331 return sal_False;
334 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
336 return sal_False;
339 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException, std::exception)
341 sal_Int32 nValue = 0; // 0 means no limit
342 return nValue;
345 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException, std::exception)
347 sal_Int32 nValue = 0; // 0 means no limit
348 return nValue;
351 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException, std::exception)
353 sal_Int32 nValue = 0; // 0 means no limit
354 return nValue;
357 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException, std::exception)
359 return sal_False;
362 sal_Bool SAL_CALL KabDatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException, std::exception)
364 return sal_False;
367 sal_Bool SAL_CALL KabDatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException, std::exception)
369 return sal_False;
372 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException, std::exception)
374 return sal_False;
377 sal_Bool SAL_CALL KabDatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException, std::exception)
379 return sal_False;
382 sal_Bool SAL_CALL KabDatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException, std::exception)
384 // for the moment, we have read-only addresses, but this might change in the future
385 return sal_True;
388 sal_Bool SAL_CALL KabDatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException, std::exception)
390 return sal_False;
393 sal_Bool SAL_CALL KabDatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException, std::exception)
395 return sal_False;
398 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException, std::exception)
400 return sal_False;
403 sal_Bool SAL_CALL KabDatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException, std::exception)
405 return sal_False;
408 sal_Bool SAL_CALL KabDatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException, std::exception)
410 return sal_False;
413 sal_Bool SAL_CALL KabDatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException, std::exception)
415 return sal_False;
418 sal_Bool SAL_CALL KabDatabaseMetaData::supportsConvert( sal_Int32, sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
420 return sal_False;
423 sal_Bool SAL_CALL KabDatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException, std::exception)
425 return sal_False;
428 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException, std::exception)
430 return sal_False;
433 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException, std::exception)
435 return sal_False;
438 sal_Bool SAL_CALL KabDatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException, std::exception)
440 return sal_False;
443 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException, std::exception)
445 return sal_False;
448 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException, std::exception)
450 return sal_False;
453 sal_Bool SAL_CALL KabDatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException, std::exception)
455 return sal_False;
458 sal_Bool SAL_CALL KabDatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException, std::exception)
460 return sal_False;
463 sal_Bool SAL_CALL KabDatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException, std::exception)
465 return sal_False;
468 sal_Bool SAL_CALL KabDatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException, std::exception)
470 return sal_False;
473 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
475 return sal_False;
478 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException, std::exception)
480 return sal_False;
483 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException, std::exception)
485 return sal_False;
488 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException, std::exception)
490 return sal_False;
493 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException, std::exception)
495 return sal_False;
498 sal_Bool SAL_CALL KabDatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException, std::exception)
500 return sal_False;
503 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException, std::exception)
505 return sal_False;
508 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException, std::exception)
510 return sal_False;
513 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException, std::exception)
515 return sal_False;
518 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException, std::exception)
520 return sal_False;
523 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException, std::exception)
525 return sal_False;
528 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException, std::exception)
530 return sal_False;
533 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException, std::exception)
535 return sal_False;
538 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException, std::exception)
540 return sal_False;
543 sal_Bool SAL_CALL KabDatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException, std::exception)
545 return sal_False;
548 sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException, std::exception)
550 return sal_False;
553 OUString SAL_CALL KabDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException, std::exception)
555 // if someday we support more than the default address book,
556 // this method should return the URL which was used to create it
557 OUString aValue( "sdbc:address:kab:" );
558 return aValue;
561 OUString SAL_CALL KabDatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException, std::exception)
563 OUString aValue;
564 return aValue;
567 OUString SAL_CALL KabDatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException, std::exception)
569 OUString aValue( "kab" );
570 return aValue;
573 OUString SAL_CALL KabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException, std::exception)
575 OUString aValue(KAB_DRIVER_VERSION);
576 return aValue;
579 OUString SAL_CALL KabDatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException, std::exception)
581 OUString aValue;
582 return aValue;
585 OUString SAL_CALL KabDatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException, std::exception)
587 OUString aValue;
588 return aValue;
591 OUString SAL_CALL KabDatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException, std::exception)
593 OUString aValue;
594 return aValue;
597 OUString SAL_CALL KabDatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException, std::exception)
599 OUString aValue;
600 return aValue;
603 sal_Int32 SAL_CALL KabDatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException, std::exception)
605 return KAB_DRIVER_VERSION_MAJOR;
608 sal_Int32 SAL_CALL KabDatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException, std::exception)
610 return TransactionIsolation::NONE;
613 sal_Int32 SAL_CALL KabDatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException, std::exception)
615 return KAB_DRIVER_VERSION_MINOR;
618 OUString SAL_CALL KabDatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException, std::exception)
620 OUString aValue;
621 return aValue;
624 OUString SAL_CALL KabDatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException, std::exception)
626 OUString aValue;
627 return aValue;
630 OUString SAL_CALL KabDatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException, std::exception)
632 return OUString();
635 OUString SAL_CALL KabDatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException, std::exception)
637 return OUString();
640 OUString SAL_CALL KabDatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException, std::exception)
642 return OUString();
645 OUString SAL_CALL KabDatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException, std::exception)
647 return OUString();
650 sal_Bool SAL_CALL KabDatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
652 return sal_False;
655 sal_Bool SAL_CALL KabDatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
657 return sal_False;
660 sal_Bool SAL_CALL KabDatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException, std::exception)
662 return sal_True;
665 sal_Bool SAL_CALL KabDatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
667 return sal_False;
670 sal_Bool SAL_CALL KabDatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException, std::exception)
672 return sal_False;
675 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException, std::exception)
677 sal_Int32 nValue = 0; // 0 means no limit
678 return nValue;
681 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException, std::exception)
683 sal_Int32 nValue = 0; // 0 means no limit
684 return nValue;
687 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException, std::exception)
689 sal_Int32 nValue = 0; // 0 means no limit
690 return nValue;
693 sal_Int32 SAL_CALL KabDatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException, std::exception)
695 sal_Int32 nValue = 0; // 0 means no limit
696 return nValue;
699 sal_Bool SAL_CALL KabDatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException, std::exception)
701 switch (setType)
703 case ResultSetType::FORWARD_ONLY:
704 case ResultSetType::SCROLL_INSENSITIVE:
705 return sal_True;
707 return sal_False;
710 sal_Bool SAL_CALL KabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
712 switch (setType)
714 case ResultSetType::FORWARD_ONLY:
715 case ResultSetType::SCROLL_INSENSITIVE:
716 return sal_True;
718 return sal_False;
721 sal_Bool SAL_CALL KabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
723 return sal_False;
726 sal_Bool SAL_CALL KabDatabaseMetaData::ownDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
728 return sal_False;
731 sal_Bool SAL_CALL KabDatabaseMetaData::ownInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
733 return sal_False;
736 sal_Bool SAL_CALL KabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
738 return sal_False;
741 sal_Bool SAL_CALL KabDatabaseMetaData::othersDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
743 return sal_False;
746 sal_Bool SAL_CALL KabDatabaseMetaData::othersInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
748 return sal_False;
751 sal_Bool SAL_CALL KabDatabaseMetaData::updatesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
753 return sal_False;
756 sal_Bool SAL_CALL KabDatabaseMetaData::deletesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
758 return sal_False;
761 sal_Bool SAL_CALL KabDatabaseMetaData::insertsAreDetected( sal_Int32 ) throw(SQLException, RuntimeException, std::exception)
763 return sal_False;
766 sal_Bool SAL_CALL KabDatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException, std::exception)
768 return sal_False;
771 Reference< XConnection > SAL_CALL KabDatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException, std::exception)
773 return m_xConnection.get();
776 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException, std::exception)
778 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
779 Reference< XResultSet > xRef = pResult;
781 static ODatabaseMetaDataResultSet::ORows aRows;
783 if (aRows.empty())
785 ODatabaseMetaDataResultSet::ORow aRow(2);
786 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
787 aRow[1] = new ORowSetValueDecorator(OUString("TABLE"));
788 aRows.push_back(aRow);
790 pResult->setRows(aRows);
791 return xRef;
794 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException, std::exception)
796 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
797 Reference< XResultSet > xRef = pResult;
799 static ODatabaseMetaDataResultSet::ORows aRows;
800 if (aRows.empty())
802 ODatabaseMetaDataResultSet::ORow aRow(19);
804 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
805 aRow[1] = new ORowSetValueDecorator(OUString("CHAR"));
806 aRow[2] = new ORowSetValueDecorator(DataType::CHAR);
807 aRow[3] = new ORowSetValueDecorator((sal_Int32) 254);
808 aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
809 aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
810 aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
811 aRow[7] = new ORowSetValueDecorator((sal_Int32) ColumnValue::NULLABLE);
812 aRow[8] = ODatabaseMetaDataResultSet::get1Value();
813 aRow[9] = new ORowSetValueDecorator((sal_Int32) ColumnSearch::CHAR);
814 aRow[10] = ODatabaseMetaDataResultSet::get1Value();
815 aRow[11] = ODatabaseMetaDataResultSet::get0Value();
816 aRow[12] = ODatabaseMetaDataResultSet::get0Value();
817 aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
818 aRow[14] = ODatabaseMetaDataResultSet::get0Value();
819 aRow[15] = ODatabaseMetaDataResultSet::get0Value();
820 aRow[16] = ODatabaseMetaDataResultSet::getEmptyValue();
821 aRow[17] = ODatabaseMetaDataResultSet::getEmptyValue();
822 aRow[18] = new ORowSetValueDecorator((sal_Int32) 10);
823 aRows.push_back(aRow);
824 // Much more types might appear in KDE address books
825 // To be completed
827 pResult->setRows(aRows);
828 return xRef;
831 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException, std::exception)
833 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCatalogs );
836 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException, std::exception)
838 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eSchemas );
841 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumnPrivileges(
842 const Any&, const OUString&, const OUString&,
843 const OUString& ) throw(SQLException, RuntimeException, std::exception)
845 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumnPrivileges );
848 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumns(
849 const Any&,
850 const OUString&,
851 const OUString& tableNamePattern,
852 const OUString& columnNamePattern) throw(SQLException, RuntimeException, std::exception)
854 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
855 Reference< XResultSet > xRef = pResult;
857 ODatabaseMetaDataResultSet::ORows aRows;
859 if (match(tableNamePattern, getAddressBookTableName(), '\0'))
861 ODatabaseMetaDataResultSet::ORow aRow(19);
863 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
864 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
865 aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
866 aRow[3] = new ORowSetValueDecorator(getAddressBookTableName());
867 aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
868 aRow[9] = ODatabaseMetaDataResultSet::get0Value();
869 aRow[10] = new ORowSetValueDecorator((sal_Int32) 10);
870 aRow[11] = ODatabaseMetaDataResultSet::get1Value();
871 aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
872 aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
873 aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
874 aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
875 aRow[16] = new ORowSetValueDecorator((sal_Int32) 254);
876 aRow[18] = new ORowSetValueDecorator(OUString("YES"));
878 sal_Int32 nPosition = 1;
879 QString aQtName;
880 OUString sName;
882 aQtName = ::KABC::Addressee::revisionLabel();
883 sName = (const sal_Unicode *) aQtName.ucs2();
884 if (match(columnNamePattern, sName, '\0'))
886 aRow[4] = new ORowSetValueDecorator(sName);
887 aRow[5] = new ORowSetValueDecorator(DataType::TIMESTAMP);
888 aRow[6] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
889 aRow[17] = new ORowSetValueDecorator(nPosition++);
890 aRows.push_back(aRow);
893 ::KABC::Field::List aFields = ::KABC::Field::allFields();
894 ::KABC::Field::List::iterator aField;
896 for ( aField = aFields.begin();
897 aField != aFields.end();
898 ++aField, ++nPosition)
900 aQtName = (*aField)->label();
901 sName = (const sal_Unicode *) aQtName.ucs2();
902 if (match(columnNamePattern, sName, '\0'))
904 aRow[4] = new ORowSetValueDecorator(sName);
905 aRow[5] = new ORowSetValueDecorator(DataType::CHAR);
906 aRow[6] = new ORowSetValueDecorator(OUString("CHAR"));
907 aRow[7] = new ORowSetValueDecorator((sal_Int32) 256);
908 // Might be VARCHAR and not CHAR[256]...
909 aRow[17] = new ORowSetValueDecorator(nPosition);
910 aRows.push_back(aRow);
914 pResult->setRows(aRows);
915 return xRef;
918 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTables(
919 const Any&,
920 const OUString&,
921 const OUString&,
922 const Sequence< OUString >& types) throw(SQLException, RuntimeException, std::exception)
924 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
925 Reference< XResultSet > xRef = pResult;
927 // check whether we have tables in the requested types
928 // for the moment, we answer only the "TABLE" table type
929 // when no types are given at all, we return all the tables
930 static const OUString aTable("TABLE");
931 bool bTableFound = false;
932 const OUString* p = types.getConstArray(),
933 * pEnd = p + types.getLength();
935 if (p == pEnd)
937 bTableFound = true;
939 else while (p < pEnd)
941 if (match(*p, aTable, '\0'))
943 bTableFound = true;
944 break;
946 p++;
948 if (!bTableFound)
949 return xRef;
951 static ODatabaseMetaDataResultSet::ORows aRows;
953 if (aRows.empty())
955 ODatabaseMetaDataResultSet::ORow aRow(6);
957 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
958 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
959 aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
960 aRow[3] = new ORowSetValueDecorator(getAddressBookTableName());
961 aRow[4] = new ORowSetValueDecorator(aTable);
962 aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
963 aRows.push_back(aRow);
965 pResult->setRows(aRows);
966 return xRef;
969 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getProcedureColumns(
970 const Any&, const OUString&,
971 const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
973 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedureColumns );
976 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getProcedures(
977 const Any&, const OUString&,
978 const OUString& ) throw(SQLException, RuntimeException, std::exception)
980 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedures );
983 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getVersionColumns(
984 const Any&, const OUString&, const OUString& table ) throw(SQLException, RuntimeException, std::exception)
986 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
988 Reference< XResultSet > xRef = pResult;
990 ODatabaseMetaDataResultSet::ORows aRows;
992 if (table == getAddressBookTableName())
994 ODatabaseMetaDataResultSet::ORow aRow( 9 );
995 QString aQtName = ::KABC::Addressee::revisionLabel();
996 OUString sName = (const sal_Unicode *) aQtName.ucs2();
998 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
999 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
1001 aRow[2] = new ORowSetValueDecorator(sName);
1002 aRow[3] = new ORowSetValueDecorator(DataType::TIMESTAMP);
1003 aRow[4] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
1005 aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
1006 aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
1007 aRow[7] = ODatabaseMetaDataResultSet::getEmptyValue();
1008 aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
1010 aRows.push_back(aRow);
1012 pResult->setRows(aRows);
1013 return xRef;
1016 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getExportedKeys(
1017 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
1019 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eExportedKeys );
1022 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getImportedKeys(
1023 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
1025 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eImportedKeys );
1028 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getPrimaryKeys(
1029 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
1031 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::ePrimaryKeys );
1034 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getIndexInfo(
1035 const Any&, const OUString&, const OUString&,
1036 sal_Bool, sal_Bool ) throw(SQLException, RuntimeException, std::exception)
1038 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eIndexInfo );
1041 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getBestRowIdentifier(
1042 const Any&, const OUString&, const OUString&, sal_Int32,
1043 sal_Bool ) throw(SQLException, RuntimeException, std::exception)
1045 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eBestRowIdentifier );
1048 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTablePrivileges(
1049 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
1051 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
1054 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getCrossReference(
1055 const Any&, const OUString&,
1056 const OUString&, const Any&,
1057 const OUString&, const OUString& ) throw(SQLException, RuntimeException, std::exception)
1059 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCrossReference );
1062 Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getUDTs( const Any&, const OUString&, const OUString&, const Sequence< sal_Int32 >& ) throw(SQLException, RuntimeException, std::exception)
1064 OSL_FAIL("Not implemented yet!");
1065 throw SQLException();
1069 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */