1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
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
)
64 { // do some special here for you database
70 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException
, RuntimeException
, std::exception
)
72 sal_Int32 nValue
= 0; // 0 means no limit
76 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxRowSize( ) throw(SQLException
, RuntimeException
, std::exception
)
78 sal_Int32 nValue
= 0; // 0 means no limit
82 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
84 sal_Int32 nValue
= 0; // 0 means no limit
88 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException
, RuntimeException
, std::exception
)
90 sal_Int32 nValue
= 0; // 0 means no limit
94 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
96 sal_Int32 nValue
= 0; // 0 means no limit
100 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException
, RuntimeException
, std::exception
)
102 sal_Int32 nValue
= 0; // 0 means no limit
106 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
108 sal_Int32 nValue
= 0; // 0 means no limit
112 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxConnections( ) throw(SQLException
, RuntimeException
, std::exception
)
114 sal_Int32 nValue
= 0; // 0 means no limit
118 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException
, RuntimeException
, std::exception
)
120 sal_Int32 nValue
= 0; // 0 means no limit
124 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxStatementLength( ) throw(SQLException
, RuntimeException
, std::exception
)
126 sal_Int32 nValue
= 0; // 0 means no limit
130 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxTableNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
132 sal_Int32 nValue
= 0; // 0 means no limit
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;
144 sal_Bool SAL_CALL
KabDatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException
, RuntimeException
, std::exception
)
149 sal_Bool SAL_CALL
KabDatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
154 sal_Bool SAL_CALL
KabDatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
159 sal_Bool SAL_CALL
KabDatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
164 sal_Bool SAL_CALL
KabDatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
169 sal_Bool SAL_CALL
KabDatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
174 sal_Bool SAL_CALL
KabDatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
179 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException
, RuntimeException
, std::exception
)
184 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException
, RuntimeException
, std::exception
)
189 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxIndexLength( ) throw(SQLException
, RuntimeException
, std::exception
)
191 sal_Int32 nValue
= 0; // 0 means no limit
195 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException
, RuntimeException
, std::exception
)
200 OUString SAL_CALL
KabDatabaseMetaData::getCatalogTerm( ) throw(SQLException
, RuntimeException
, std::exception
)
209 OUString SAL_CALL
KabDatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException
, RuntimeException
, std::exception
)
211 // normally this is "
216 OUString SAL_CALL
KabDatabaseMetaData::getExtraNameCharacters( ) throw(SQLException
, RuntimeException
, std::exception
)
222 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException
, RuntimeException
, std::exception
)
227 sal_Bool SAL_CALL
KabDatabaseMetaData::isCatalogAtStart( ) throw(SQLException
, RuntimeException
, std::exception
)
229 sal_Bool bValue
= sal_False
;
236 sal_Bool SAL_CALL
KabDatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException
, RuntimeException
, std::exception
)
241 sal_Bool SAL_CALL
KabDatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException
, RuntimeException
, std::exception
)
246 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException
, RuntimeException
, std::exception
)
251 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException
, RuntimeException
, std::exception
)
256 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsPositionedDelete( ) throw(SQLException
, RuntimeException
, std::exception
)
261 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException
, RuntimeException
, std::exception
)
266 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException
, RuntimeException
, std::exception
)
271 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException
, RuntimeException
, std::exception
)
276 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException
, RuntimeException
, std::exception
)
281 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException
, RuntimeException
, std::exception
)
286 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
291 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException
, RuntimeException
, std::exception
)
296 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException
, RuntimeException
, std::exception
)
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
)
311 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
316 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
321 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
326 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
331 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException
, RuntimeException
, std::exception
)
336 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOuterJoins( ) throw(SQLException
, RuntimeException
, std::exception
)
341 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxStatements( ) throw(SQLException
, RuntimeException
, std::exception
)
343 sal_Int32 nValue
= 0; // 0 means no limit
347 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
349 sal_Int32 nValue
= 0; // 0 means no limit
353 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
355 sal_Int32 nValue
= 0; // 0 means no limit
359 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsTransactions( ) throw(SQLException
, RuntimeException
, std::exception
)
364 sal_Bool SAL_CALL
KabDatabaseMetaData::allProceduresAreCallable( ) throw(SQLException
, RuntimeException
, std::exception
)
369 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsStoredProcedures( ) throw(SQLException
, RuntimeException
, std::exception
)
374 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException
, RuntimeException
, std::exception
)
379 sal_Bool SAL_CALL
KabDatabaseMetaData::allTablesAreSelectable( ) throw(SQLException
, RuntimeException
, std::exception
)
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
390 sal_Bool SAL_CALL
KabDatabaseMetaData::usesLocalFiles( ) throw(SQLException
, RuntimeException
, std::exception
)
395 sal_Bool SAL_CALL
KabDatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException
, RuntimeException
, std::exception
)
400 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsTypeConversion( ) throw(SQLException
, RuntimeException
, std::exception
)
405 sal_Bool SAL_CALL
KabDatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException
, RuntimeException
, std::exception
)
410 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsColumnAliasing( ) throw(SQLException
, RuntimeException
, std::exception
)
415 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException
, RuntimeException
, std::exception
)
420 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsConvert( sal_Int32
, sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
425 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException
, RuntimeException
, std::exception
)
430 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsGroupBy( ) throw(SQLException
, RuntimeException
, std::exception
)
435 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException
, RuntimeException
, std::exception
)
440 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException
, RuntimeException
, std::exception
)
445 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException
, RuntimeException
, std::exception
)
450 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException
, RuntimeException
, std::exception
)
455 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException
, RuntimeException
, std::exception
)
460 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException
, RuntimeException
, std::exception
)
465 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsUnion( ) throw(SQLException
, RuntimeException
, std::exception
)
470 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsUnionAll( ) throw(SQLException
, RuntimeException
, std::exception
)
475 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
480 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
485 sal_Bool SAL_CALL
KabDatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException
, RuntimeException
, std::exception
)
490 sal_Bool SAL_CALL
KabDatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException
, RuntimeException
, std::exception
)
495 sal_Bool SAL_CALL
KabDatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException
, RuntimeException
, std::exception
)
500 sal_Bool SAL_CALL
KabDatabaseMetaData::nullsAreSortedLow( ) throw(SQLException
, RuntimeException
, std::exception
)
505 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException
, RuntimeException
, std::exception
)
510 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
515 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException
, RuntimeException
, std::exception
)
520 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
525 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException
, RuntimeException
, std::exception
)
530 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException
, RuntimeException
, std::exception
)
535 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException
, RuntimeException
, std::exception
)
540 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException
, RuntimeException
, std::exception
)
545 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException
, RuntimeException
, std::exception
)
550 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException
, RuntimeException
, std::exception
)
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:" );
563 OUString SAL_CALL
KabDatabaseMetaData::getUserName( ) throw(SQLException
, RuntimeException
, std::exception
)
569 OUString SAL_CALL
KabDatabaseMetaData::getDriverName( ) throw(SQLException
, RuntimeException
, std::exception
)
571 OUString
aValue( "kab" );
575 OUString SAL_CALL
KabDatabaseMetaData::getDriverVersion() throw(SQLException
, RuntimeException
, std::exception
)
577 OUString
aValue(KAB_DRIVER_VERSION
);
581 OUString SAL_CALL
KabDatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException
, RuntimeException
, std::exception
)
587 OUString SAL_CALL
KabDatabaseMetaData::getDatabaseProductName( ) throw(SQLException
, RuntimeException
, std::exception
)
593 OUString SAL_CALL
KabDatabaseMetaData::getProcedureTerm( ) throw(SQLException
, RuntimeException
, std::exception
)
599 OUString SAL_CALL
KabDatabaseMetaData::getSchemaTerm( ) throw(SQLException
, RuntimeException
, std::exception
)
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
)
626 OUString SAL_CALL
KabDatabaseMetaData::getSearchStringEscape( ) throw(SQLException
, RuntimeException
, std::exception
)
632 OUString SAL_CALL
KabDatabaseMetaData::getStringFunctions( ) throw(SQLException
, RuntimeException
, std::exception
)
637 OUString SAL_CALL
KabDatabaseMetaData::getTimeDateFunctions( ) throw(SQLException
, RuntimeException
, std::exception
)
642 OUString SAL_CALL
KabDatabaseMetaData::getSystemFunctions( ) throw(SQLException
, RuntimeException
, std::exception
)
647 OUString SAL_CALL
KabDatabaseMetaData::getNumericFunctions( ) throw(SQLException
, RuntimeException
, std::exception
)
652 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException
, RuntimeException
, std::exception
)
657 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException
, RuntimeException
, std::exception
)
662 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException
, RuntimeException
, std::exception
)
667 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException
, RuntimeException
, std::exception
)
672 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException
, RuntimeException
, std::exception
)
677 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException
, RuntimeException
, std::exception
)
679 sal_Int32 nValue
= 0; // 0 means no limit
683 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException
, RuntimeException
, std::exception
)
685 sal_Int32 nValue
= 0; // 0 means no limit
689 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException
, RuntimeException
, std::exception
)
691 sal_Int32 nValue
= 0; // 0 means no limit
695 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxUserNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
697 sal_Int32 nValue
= 0; // 0 means no limit
701 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsResultSetType( sal_Int32 setType
) throw(SQLException
, RuntimeException
, std::exception
)
705 case ResultSetType::FORWARD_ONLY
:
706 case ResultSetType::SCROLL_INSENSITIVE
:
712 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType
, sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
716 case ResultSetType::FORWARD_ONLY
:
717 case ResultSetType::SCROLL_INSENSITIVE
:
723 sal_Bool SAL_CALL
KabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
728 sal_Bool SAL_CALL
KabDatabaseMetaData::ownDeletesAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
733 sal_Bool SAL_CALL
KabDatabaseMetaData::ownInsertsAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
738 sal_Bool SAL_CALL
KabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
743 sal_Bool SAL_CALL
KabDatabaseMetaData::othersDeletesAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
748 sal_Bool SAL_CALL
KabDatabaseMetaData::othersInsertsAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
753 sal_Bool SAL_CALL
KabDatabaseMetaData::updatesAreDetected( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
758 sal_Bool SAL_CALL
KabDatabaseMetaData::deletesAreDetected( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
763 sal_Bool SAL_CALL
KabDatabaseMetaData::insertsAreDetected( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
768 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsBatchUpdates( ) throw(SQLException
, RuntimeException
, std::exception
)
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");
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
);
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
;
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
830 pResult
->setRows(aRows
);
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(
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;
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
);
921 Reference
< XResultSet
> SAL_CALL
KabDatabaseMetaData::getTables(
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();
940 bTableFound
= sal_True
;
942 else while (p
< pEnd
)
944 if (match(*p
, aTable
, '\0'))
946 bTableFound
= sal_True
;
954 static ODatabaseMetaDataResultSet::ORows aRows
;
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
);
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
);
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: */