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
),
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
)
62 { // do some special here for you database
68 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException
, RuntimeException
, std::exception
)
70 sal_Int32 nValue
= 0; // 0 means no limit
74 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxRowSize( ) throw(SQLException
, RuntimeException
, std::exception
)
76 sal_Int32 nValue
= 0; // 0 means no limit
80 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
82 sal_Int32 nValue
= 0; // 0 means no limit
86 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException
, RuntimeException
, std::exception
)
88 sal_Int32 nValue
= 0; // 0 means no limit
92 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
94 sal_Int32 nValue
= 0; // 0 means no limit
98 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException
, RuntimeException
, std::exception
)
100 sal_Int32 nValue
= 0; // 0 means no limit
104 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
106 sal_Int32 nValue
= 0; // 0 means no limit
110 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxConnections( ) throw(SQLException
, RuntimeException
, std::exception
)
112 sal_Int32 nValue
= 0; // 0 means no limit
116 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException
, RuntimeException
, std::exception
)
118 sal_Int32 nValue
= 0; // 0 means no limit
122 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxStatementLength( ) throw(SQLException
, RuntimeException
, std::exception
)
124 sal_Int32 nValue
= 0; // 0 means no limit
128 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxTableNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
130 sal_Int32 nValue
= 0; // 0 means no limit
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;
142 sal_Bool SAL_CALL
KabDatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException
, RuntimeException
, std::exception
)
147 sal_Bool SAL_CALL
KabDatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
152 sal_Bool SAL_CALL
KabDatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
157 sal_Bool SAL_CALL
KabDatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
162 sal_Bool SAL_CALL
KabDatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
167 sal_Bool SAL_CALL
KabDatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
172 sal_Bool SAL_CALL
KabDatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
177 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException
, RuntimeException
, std::exception
)
182 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException
, RuntimeException
, std::exception
)
187 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxIndexLength( ) throw(SQLException
, RuntimeException
, std::exception
)
189 sal_Int32 nValue
= 0; // 0 means no limit
193 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException
, RuntimeException
, std::exception
)
198 OUString SAL_CALL
KabDatabaseMetaData::getCatalogTerm( ) throw(SQLException
, RuntimeException
, std::exception
)
207 OUString SAL_CALL
KabDatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException
, RuntimeException
, std::exception
)
209 // normally this is "
214 OUString SAL_CALL
KabDatabaseMetaData::getExtraNameCharacters( ) throw(SQLException
, RuntimeException
, std::exception
)
220 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException
, RuntimeException
, std::exception
)
225 sal_Bool SAL_CALL
KabDatabaseMetaData::isCatalogAtStart( ) throw(SQLException
, RuntimeException
, std::exception
)
234 sal_Bool SAL_CALL
KabDatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException
, RuntimeException
, std::exception
)
239 sal_Bool SAL_CALL
KabDatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException
, RuntimeException
, std::exception
)
244 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException
, RuntimeException
, std::exception
)
249 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException
, RuntimeException
, std::exception
)
254 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsPositionedDelete( ) throw(SQLException
, RuntimeException
, std::exception
)
259 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException
, RuntimeException
, std::exception
)
264 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException
, RuntimeException
, std::exception
)
269 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException
, RuntimeException
, std::exception
)
274 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException
, RuntimeException
, std::exception
)
279 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException
, RuntimeException
, std::exception
)
284 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
289 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException
, RuntimeException
, std::exception
)
294 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException
, RuntimeException
, std::exception
)
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
)
309 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
314 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
319 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
324 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
329 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException
, RuntimeException
, std::exception
)
334 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOuterJoins( ) throw(SQLException
, RuntimeException
, std::exception
)
339 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxStatements( ) throw(SQLException
, RuntimeException
, std::exception
)
341 sal_Int32 nValue
= 0; // 0 means no limit
345 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
347 sal_Int32 nValue
= 0; // 0 means no limit
351 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
353 sal_Int32 nValue
= 0; // 0 means no limit
357 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsTransactions( ) throw(SQLException
, RuntimeException
, std::exception
)
362 sal_Bool SAL_CALL
KabDatabaseMetaData::allProceduresAreCallable( ) throw(SQLException
, RuntimeException
, std::exception
)
367 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsStoredProcedures( ) throw(SQLException
, RuntimeException
, std::exception
)
372 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException
, RuntimeException
, std::exception
)
377 sal_Bool SAL_CALL
KabDatabaseMetaData::allTablesAreSelectable( ) throw(SQLException
, RuntimeException
, std::exception
)
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
388 sal_Bool SAL_CALL
KabDatabaseMetaData::usesLocalFiles( ) throw(SQLException
, RuntimeException
, std::exception
)
393 sal_Bool SAL_CALL
KabDatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException
, RuntimeException
, std::exception
)
398 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsTypeConversion( ) throw(SQLException
, RuntimeException
, std::exception
)
403 sal_Bool SAL_CALL
KabDatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException
, RuntimeException
, std::exception
)
408 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsColumnAliasing( ) throw(SQLException
, RuntimeException
, std::exception
)
413 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException
, RuntimeException
, std::exception
)
418 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsConvert( sal_Int32
, sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
423 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException
, RuntimeException
, std::exception
)
428 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsGroupBy( ) throw(SQLException
, RuntimeException
, std::exception
)
433 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException
, RuntimeException
, std::exception
)
438 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException
, RuntimeException
, std::exception
)
443 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException
, RuntimeException
, std::exception
)
448 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException
, RuntimeException
, std::exception
)
453 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException
, RuntimeException
, std::exception
)
458 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException
, RuntimeException
, std::exception
)
463 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsUnion( ) throw(SQLException
, RuntimeException
, std::exception
)
468 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsUnionAll( ) throw(SQLException
, RuntimeException
, std::exception
)
473 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
478 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException
, RuntimeException
, std::exception
)
483 sal_Bool SAL_CALL
KabDatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException
, RuntimeException
, std::exception
)
488 sal_Bool SAL_CALL
KabDatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException
, RuntimeException
, std::exception
)
493 sal_Bool SAL_CALL
KabDatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException
, RuntimeException
, std::exception
)
498 sal_Bool SAL_CALL
KabDatabaseMetaData::nullsAreSortedLow( ) throw(SQLException
, RuntimeException
, std::exception
)
503 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException
, RuntimeException
, std::exception
)
508 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
513 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException
, RuntimeException
, std::exception
)
518 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException
, RuntimeException
, std::exception
)
523 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException
, RuntimeException
, std::exception
)
528 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException
, RuntimeException
, std::exception
)
533 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException
, RuntimeException
, std::exception
)
538 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException
, RuntimeException
, std::exception
)
543 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException
, RuntimeException
, std::exception
)
548 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException
, RuntimeException
, std::exception
)
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:" );
561 OUString SAL_CALL
KabDatabaseMetaData::getUserName( ) throw(SQLException
, RuntimeException
, std::exception
)
567 OUString SAL_CALL
KabDatabaseMetaData::getDriverName( ) throw(SQLException
, RuntimeException
, std::exception
)
569 OUString
aValue( "kab" );
573 OUString SAL_CALL
KabDatabaseMetaData::getDriverVersion() throw(SQLException
, RuntimeException
, std::exception
)
575 OUString
aValue(KAB_DRIVER_VERSION
);
579 OUString SAL_CALL
KabDatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException
, RuntimeException
, std::exception
)
585 OUString SAL_CALL
KabDatabaseMetaData::getDatabaseProductName( ) throw(SQLException
, RuntimeException
, std::exception
)
591 OUString SAL_CALL
KabDatabaseMetaData::getProcedureTerm( ) throw(SQLException
, RuntimeException
, std::exception
)
597 OUString SAL_CALL
KabDatabaseMetaData::getSchemaTerm( ) throw(SQLException
, RuntimeException
, std::exception
)
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
)
624 OUString SAL_CALL
KabDatabaseMetaData::getSearchStringEscape( ) throw(SQLException
, RuntimeException
, std::exception
)
630 OUString SAL_CALL
KabDatabaseMetaData::getStringFunctions( ) throw(SQLException
, RuntimeException
, std::exception
)
635 OUString SAL_CALL
KabDatabaseMetaData::getTimeDateFunctions( ) throw(SQLException
, RuntimeException
, std::exception
)
640 OUString SAL_CALL
KabDatabaseMetaData::getSystemFunctions( ) throw(SQLException
, RuntimeException
, std::exception
)
645 OUString SAL_CALL
KabDatabaseMetaData::getNumericFunctions( ) throw(SQLException
, RuntimeException
, std::exception
)
650 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException
, RuntimeException
, std::exception
)
655 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException
, RuntimeException
, std::exception
)
660 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException
, RuntimeException
, std::exception
)
665 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException
, RuntimeException
, std::exception
)
670 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException
, RuntimeException
, std::exception
)
675 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException
, RuntimeException
, std::exception
)
677 sal_Int32 nValue
= 0; // 0 means no limit
681 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException
, RuntimeException
, std::exception
)
683 sal_Int32 nValue
= 0; // 0 means no limit
687 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException
, RuntimeException
, std::exception
)
689 sal_Int32 nValue
= 0; // 0 means no limit
693 sal_Int32 SAL_CALL
KabDatabaseMetaData::getMaxUserNameLength( ) throw(SQLException
, RuntimeException
, std::exception
)
695 sal_Int32 nValue
= 0; // 0 means no limit
699 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsResultSetType( sal_Int32 setType
) throw(SQLException
, RuntimeException
, std::exception
)
703 case ResultSetType::FORWARD_ONLY
:
704 case ResultSetType::SCROLL_INSENSITIVE
:
710 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType
, sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
714 case ResultSetType::FORWARD_ONLY
:
715 case ResultSetType::SCROLL_INSENSITIVE
:
721 sal_Bool SAL_CALL
KabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
726 sal_Bool SAL_CALL
KabDatabaseMetaData::ownDeletesAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
731 sal_Bool SAL_CALL
KabDatabaseMetaData::ownInsertsAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
736 sal_Bool SAL_CALL
KabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
741 sal_Bool SAL_CALL
KabDatabaseMetaData::othersDeletesAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
746 sal_Bool SAL_CALL
KabDatabaseMetaData::othersInsertsAreVisible( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
751 sal_Bool SAL_CALL
KabDatabaseMetaData::updatesAreDetected( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
756 sal_Bool SAL_CALL
KabDatabaseMetaData::deletesAreDetected( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
761 sal_Bool SAL_CALL
KabDatabaseMetaData::insertsAreDetected( sal_Int32
) throw(SQLException
, RuntimeException
, std::exception
)
766 sal_Bool SAL_CALL
KabDatabaseMetaData::supportsBatchUpdates( ) throw(SQLException
, RuntimeException
, std::exception
)
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
;
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
);
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
;
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
827 pResult
->setRows(aRows
);
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(
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;
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
);
918 Reference
< XResultSet
> SAL_CALL
KabDatabaseMetaData::getTables(
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();
939 else while (p
< pEnd
)
941 if (match(*p
, aTable
, '\0'))
951 static ODatabaseMetaDataResultSet::ORows aRows
;
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
);
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
);
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: */