bump product version to 4.1.6.2
[LibreOffice.git] / connectivity / source / drivers / macab / MacabDatabaseMetaData.cxx
bloba832c33faec743291a257b684b4c2c575d63c56a
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 "MacabDatabaseMetaData.hxx"
22 #include "MacabAddressBook.hxx"
23 #include "MacabHeader.hxx"
24 #include "MacabGroup.hxx"
25 #include "macabutilities.hxx"
27 #include "MacabDriver.hxx"
28 #include "FDatabaseMetaDataResultSet.hxx"
29 #include "OTypeInfo.hxx"
30 #include <com/sun/star/sdbc/ColumnValue.hpp>
31 #include <com/sun/star/sdbc/ResultSetType.hpp>
32 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
34 #include <vector>
36 using namespace connectivity::macab;
37 using namespace com::sun::star::uno;
38 using namespace com::sun::star::lang;
39 using namespace com::sun::star::beans;
40 using namespace com::sun::star::sdbc;
42 MacabDatabaseMetaData::MacabDatabaseMetaData(MacabConnection* _pCon)
43 : m_xConnection(_pCon),
44 m_bUseCatalog(sal_True)
46 OSL_ENSURE(_pCon,"MacabDatabaseMetaData::MacabDatabaseMetaData: No connection set!");
48 osl_atomic_increment( &m_refCount );
49 m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
50 osl_atomic_decrement( &m_refCount );
52 // -------------------------------------------------------------------------
53 MacabDatabaseMetaData::~MacabDatabaseMetaData()
56 // -------------------------------------------------------------------------
57 OUString SAL_CALL MacabDatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException)
59 OUString aVal;
60 if (m_bUseCatalog)
61 { // do some special here for you database
64 return aVal;
66 // -------------------------------------------------------------------------
67 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
69 sal_Int32 nValue = 0; // 0 means no limit
70 return nValue;
72 // -------------------------------------------------------------------------
73 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
75 sal_Int32 nValue = 0; // 0 means no limit
76 return nValue;
78 // -------------------------------------------------------------------------
79 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
81 sal_Int32 nValue = 0; // 0 means no limit
82 return nValue;
84 // -------------------------------------------------------------------------
85 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
87 sal_Int32 nValue = 0; // 0 means no limit
88 return nValue;
90 // -------------------------------------------------------------------------
91 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
93 sal_Int32 nValue = 0; // 0 means no limit
94 return nValue;
96 // -------------------------------------------------------------------------
97 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
99 sal_Int32 nValue = 0; // 0 means no limit
100 return nValue;
102 // -------------------------------------------------------------------------
103 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
105 sal_Int32 nValue = 0; // 0 means no limit
106 return nValue;
108 // -------------------------------------------------------------------------
109 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
111 sal_Int32 nValue = 0; // 0 means no limit
112 return nValue;
114 // -------------------------------------------------------------------------
115 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
117 sal_Int32 nValue = 0; // 0 means no limit
118 return nValue;
120 // -------------------------------------------------------------------------
121 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
123 sal_Int32 nValue = 0; // 0 means no limit
124 return nValue;
126 // -------------------------------------------------------------------------
127 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
129 sal_Int32 nValue = 0; // 0 means no limit
130 return nValue;
132 // -------------------------------------------------------------------------
133 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException)
135 // MaxTablesInSelect describes how many tables can participate in the FROM part of a given SELECT statement,
136 // currently, the resultset/statement implementations can cope with one table only
137 sal_Int32 nValue = 1;
138 return nValue;
140 // -------------------------------------------------------------------------
141 sal_Bool SAL_CALL MacabDatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
143 return sal_False;
145 // -------------------------------------------------------------------------
146 sal_Bool SAL_CALL MacabDatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
148 return sal_False;
150 // -------------------------------------------------------------------------
151 sal_Bool SAL_CALL MacabDatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
153 return sal_False;
155 // -------------------------------------------------------------------------
156 sal_Bool SAL_CALL MacabDatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
158 return sal_False;
160 // -------------------------------------------------------------------------
161 sal_Bool SAL_CALL MacabDatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
163 return sal_False;
165 // -------------------------------------------------------------------------
166 sal_Bool SAL_CALL MacabDatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
168 return sal_False;
170 // -------------------------------------------------------------------------
171 sal_Bool SAL_CALL MacabDatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
173 return sal_False;
175 // -------------------------------------------------------------------------
176 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException)
178 return sal_False;
180 // -------------------------------------------------------------------------
181 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException)
183 return sal_False;
185 // -------------------------------------------------------------------------
186 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
188 sal_Int32 nValue = 0; // 0 means no limit
189 return nValue;
191 // -------------------------------------------------------------------------
192 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
194 return sal_False;
196 // -------------------------------------------------------------------------
197 OUString SAL_CALL MacabDatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
199 OUString aVal;
200 if (m_bUseCatalog)
203 return aVal;
205 // -------------------------------------------------------------------------
206 OUString SAL_CALL MacabDatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException)
208 // normally this is "
209 OUString aVal("\"");
210 return aVal;
212 // -------------------------------------------------------------------------
213 OUString SAL_CALL MacabDatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
215 OUString aVal;
216 return aVal;
218 // -------------------------------------------------------------------------
219 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
221 return sal_False;
223 // -------------------------------------------------------------------------
224 sal_Bool SAL_CALL MacabDatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException)
226 sal_Bool bValue = sal_False;
227 if (m_bUseCatalog)
230 return bValue;
232 // -------------------------------------------------------------------------
233 sal_Bool SAL_CALL MacabDatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
235 return sal_True;
237 // -------------------------------------------------------------------------
238 sal_Bool SAL_CALL MacabDatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
240 return sal_True;
242 // -------------------------------------------------------------------------
243 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
245 return sal_True;
247 // -------------------------------------------------------------------------
248 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
250 return sal_True;
252 // -------------------------------------------------------------------------
253 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
255 return sal_False;
257 // -------------------------------------------------------------------------
258 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
260 return sal_False;
262 // -------------------------------------------------------------------------
263 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
265 return sal_False;
267 // -------------------------------------------------------------------------
268 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
270 return sal_False;
272 // -------------------------------------------------------------------------
273 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
275 return sal_False;
277 // -------------------------------------------------------------------------
278 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
280 return sal_False;
282 // -------------------------------------------------------------------------
283 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 ) throw(SQLException, RuntimeException)
285 return sal_False;
287 // -------------------------------------------------------------------------
288 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException)
290 return sal_False;
292 // -------------------------------------------------------------------------
293 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
295 return sal_False;
297 // -------------------------------------------------------------------------
298 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
300 return sal_True; // should be supported at least
302 // -------------------------------------------------------------------------
303 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
305 return sal_False;
307 // -------------------------------------------------------------------------
308 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
310 return sal_False;
312 // -------------------------------------------------------------------------
313 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException)
315 return sal_False;
317 // -------------------------------------------------------------------------
318 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException)
320 return sal_False;
322 // -------------------------------------------------------------------------
323 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
325 return sal_False;
327 // -------------------------------------------------------------------------
328 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException)
330 return sal_False;
332 // -------------------------------------------------------------------------
333 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
335 return sal_False;
337 // -------------------------------------------------------------------------
338 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException)
340 sal_Int32 nValue = 0; // 0 means no limit
341 return nValue;
343 // -------------------------------------------------------------------------
344 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
346 sal_Int32 nValue = 0; // 0 means no limit
347 return nValue;
349 // -------------------------------------------------------------------------
350 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
352 sal_Int32 nValue = 0; // 0 means no limit
353 return nValue;
355 // -------------------------------------------------------------------------
356 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
358 return sal_False;
360 // -------------------------------------------------------------------------
361 sal_Bool SAL_CALL MacabDatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
363 return sal_False;
365 // -------------------------------------------------------------------------
366 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
368 return sal_False;
370 // -------------------------------------------------------------------------
371 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
373 return sal_False;
375 // -------------------------------------------------------------------------
376 sal_Bool SAL_CALL MacabDatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
378 return sal_False;
380 // -------------------------------------------------------------------------
381 sal_Bool SAL_CALL MacabDatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
383 // for the moment, we have read-only addresses, but this might change in the future
384 return sal_True;
386 // -------------------------------------------------------------------------
387 sal_Bool SAL_CALL MacabDatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
389 return sal_False;
391 // -------------------------------------------------------------------------
392 sal_Bool SAL_CALL MacabDatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
394 return sal_False;
396 // -------------------------------------------------------------------------
397 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
399 return sal_False;
401 // -------------------------------------------------------------------------
402 sal_Bool SAL_CALL MacabDatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
404 return sal_False;
406 // -------------------------------------------------------------------------
407 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
409 return sal_False;
411 // -------------------------------------------------------------------------
412 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
414 return sal_False;
416 // -------------------------------------------------------------------------
417 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsConvert( sal_Int32, sal_Int32 ) throw(SQLException, RuntimeException)
419 return sal_False;
421 // -------------------------------------------------------------------------
422 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
424 return sal_False;
426 // -------------------------------------------------------------------------
427 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
429 return sal_False;
431 // -------------------------------------------------------------------------
432 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
434 return sal_False;
436 // -------------------------------------------------------------------------
437 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
439 return sal_False;
441 // -------------------------------------------------------------------------
442 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
444 return sal_False;
446 // -------------------------------------------------------------------------
447 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
449 return sal_False;
451 // -------------------------------------------------------------------------
452 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
454 return sal_False;
456 // -------------------------------------------------------------------------
457 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
459 return sal_False;
461 // -------------------------------------------------------------------------
462 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
464 return sal_False;
466 // -------------------------------------------------------------------------
467 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
469 return sal_False;
471 // -------------------------------------------------------------------------
472 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
474 return sal_False;
476 // -------------------------------------------------------------------------
477 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
479 return sal_False;
481 // -------------------------------------------------------------------------
482 sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
484 return sal_False;
486 // -------------------------------------------------------------------------
487 sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
489 return sal_False;
491 // -------------------------------------------------------------------------
492 sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
494 return sal_False;
496 // -------------------------------------------------------------------------
497 sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
499 return sal_False;
501 // -------------------------------------------------------------------------
502 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
504 return sal_False;
506 // -------------------------------------------------------------------------
507 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
509 return sal_False;
511 // -------------------------------------------------------------------------
512 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
514 return sal_False;
516 // -------------------------------------------------------------------------
517 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
519 return sal_False;
521 // -------------------------------------------------------------------------
522 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
524 return sal_False;
526 // -------------------------------------------------------------------------
527 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
529 return sal_False;
531 // -------------------------------------------------------------------------
532 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
534 return sal_False;
536 // -------------------------------------------------------------------------
537 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
539 return sal_False;
541 // -------------------------------------------------------------------------
542 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
544 return sal_False;
546 // -------------------------------------------------------------------------
547 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
549 return sal_False;
551 // -------------------------------------------------------------------------
552 OUString SAL_CALL MacabDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
554 // if someday we support more than the default address book,
555 // this method should return the URL which was used to create it
556 OUString aValue( "sdbc:address:macab:" );
557 return aValue;
559 // -------------------------------------------------------------------------
560 OUString SAL_CALL MacabDatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
562 OUString aValue;
563 return aValue;
565 // -------------------------------------------------------------------------
566 OUString SAL_CALL MacabDatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
568 OUString aValue( "macab" );
569 return aValue;
571 // -------------------------------------------------------------------------
572 OUString SAL_CALL MacabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
574 OUString aValue(MACAB_DRIVER_VERSION);
575 return aValue;
577 // -------------------------------------------------------------------------
578 OUString SAL_CALL MacabDatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
580 OUString aValue;
581 return aValue;
583 // -------------------------------------------------------------------------
584 OUString SAL_CALL MacabDatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
586 OUString aValue;
587 return aValue;
589 // -------------------------------------------------------------------------
590 OUString SAL_CALL MacabDatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
592 OUString aValue;
593 return aValue;
595 // -------------------------------------------------------------------------
596 OUString SAL_CALL MacabDatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
598 OUString aValue;
599 return aValue;
601 // -------------------------------------------------------------------------
602 sal_Int32 SAL_CALL MacabDatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
604 return MACAB_DRIVER_VERSION_MAJOR;
606 // -------------------------------------------------------------------------
607 sal_Int32 SAL_CALL MacabDatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
609 return TransactionIsolation::NONE;
611 // -------------------------------------------------------------------------
612 sal_Int32 SAL_CALL MacabDatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
614 return MACAB_DRIVER_VERSION_MINOR;
616 // -------------------------------------------------------------------------
617 OUString SAL_CALL MacabDatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
619 OUString aValue;
620 return aValue;
622 // -------------------------------------------------------------------------
623 OUString SAL_CALL MacabDatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
625 OUString aValue;
626 return aValue;
628 // -------------------------------------------------------------------------
629 OUString SAL_CALL MacabDatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
631 return OUString();
633 // -------------------------------------------------------------------------
634 OUString SAL_CALL MacabDatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
636 return OUString();
638 // -------------------------------------------------------------------------
639 OUString SAL_CALL MacabDatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
641 return OUString();
643 // -------------------------------------------------------------------------
644 OUString SAL_CALL MacabDatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
646 return OUString();
648 // -------------------------------------------------------------------------
649 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
651 return sal_False;
653 // -------------------------------------------------------------------------
654 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
656 return sal_False;
658 // -------------------------------------------------------------------------
659 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
661 return sal_True;
663 // -------------------------------------------------------------------------
664 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
666 return sal_False;
668 // -------------------------------------------------------------------------
669 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
671 return sal_False;
673 // -------------------------------------------------------------------------
674 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
676 sal_Int32 nValue = 0; // 0 means no limit
677 return nValue;
679 // -------------------------------------------------------------------------
680 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
682 sal_Int32 nValue = 0; // 0 means no limit
683 return nValue;
685 // -------------------------------------------------------------------------
686 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
688 sal_Int32 nValue = 0; // 0 means no limit
689 return nValue;
691 // -------------------------------------------------------------------------
692 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
694 sal_Int32 nValue = 0; // 0 means no limit
695 return nValue;
697 // -------------------------------------------------------------------------
698 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
700 switch (setType)
702 case ResultSetType::FORWARD_ONLY:
703 case ResultSetType::SCROLL_INSENSITIVE:
704 return sal_True;
706 return sal_False;
708 // -------------------------------------------------------------------------
709 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 ) throw(SQLException, RuntimeException)
711 switch (setType)
713 case ResultSetType::FORWARD_ONLY:
714 case ResultSetType::SCROLL_INSENSITIVE:
715 return sal_True;
717 return sal_False;
719 // -------------------------------------------------------------------------
720 sal_Bool SAL_CALL MacabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
722 return sal_False;
724 // -------------------------------------------------------------------------
725 sal_Bool SAL_CALL MacabDatabaseMetaData::ownDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
727 return sal_False;
729 // -------------------------------------------------------------------------
730 sal_Bool SAL_CALL MacabDatabaseMetaData::ownInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
732 return sal_False;
734 // -------------------------------------------------------------------------
735 sal_Bool SAL_CALL MacabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
737 return sal_False;
739 // -------------------------------------------------------------------------
740 sal_Bool SAL_CALL MacabDatabaseMetaData::othersDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
742 return sal_False;
744 // -------------------------------------------------------------------------
745 sal_Bool SAL_CALL MacabDatabaseMetaData::othersInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
747 return sal_False;
749 // -------------------------------------------------------------------------
750 sal_Bool SAL_CALL MacabDatabaseMetaData::updatesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
752 return sal_False;
754 // -------------------------------------------------------------------------
755 sal_Bool SAL_CALL MacabDatabaseMetaData::deletesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
757 return sal_False;
759 // -------------------------------------------------------------------------
760 sal_Bool SAL_CALL MacabDatabaseMetaData::insertsAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
762 return sal_False;
764 // -------------------------------------------------------------------------
765 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
767 return sal_False;
769 // -------------------------------------------------------------------------
770 Reference< XConnection > SAL_CALL MacabDatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException)
772 return (Reference< XConnection >) m_xConnection.get();
774 // -------------------------------------------------------------------------
775 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
777 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
778 Reference< XResultSet > xRef = pResult;
780 static ODatabaseMetaDataResultSet::ORows aRows;
781 static const OUString aTable("TABLE");
783 if (aRows.empty())
785 ODatabaseMetaDataResultSet::ORow aRow(2);
786 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
787 aRow[1] = new ORowSetValueDecorator(aTable);
788 aRows.push_back(aRow);
790 pResult->setRows(aRows);
791 return xRef;
793 // -------------------------------------------------------------------------
794 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException)
796 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
797 Reference< XResultSet > xRef = pResult;
799 static ODatabaseMetaDataResultSet::ORows aRows;
800 if (aRows.empty())
802 ODatabaseMetaDataResultSet::ORow aRow(19);
804 // We support four types: char, timestamp, integer, float
805 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
806 aRow[1] = new ORowSetValueDecorator(OUString("CHAR"));
807 aRow[2] = new ORowSetValueDecorator(DataType::CHAR);
808 aRow[3] = new ORowSetValueDecorator((sal_Int32) 254);
809 aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
810 aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
811 aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
812 aRow[7] = new ORowSetValueDecorator((sal_Int32) ColumnValue::NULLABLE);
813 aRow[8] = ODatabaseMetaDataResultSet::get1Value();
814 aRow[9] = new ORowSetValueDecorator((sal_Int32) ColumnSearch::CHAR);
815 aRow[10] = ODatabaseMetaDataResultSet::get1Value();
816 aRow[11] = ODatabaseMetaDataResultSet::get0Value();
817 aRow[12] = ODatabaseMetaDataResultSet::get0Value();
818 aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
819 aRow[14] = ODatabaseMetaDataResultSet::get0Value();
820 aRow[15] = ODatabaseMetaDataResultSet::get0Value();
821 aRow[16] = ODatabaseMetaDataResultSet::getEmptyValue();
822 aRow[17] = ODatabaseMetaDataResultSet::getEmptyValue();
823 aRow[18] = new ORowSetValueDecorator((sal_Int32) 10);
825 aRows.push_back(aRow);
827 aRow[1] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
828 aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
829 aRow[3] = new ORowSetValueDecorator((sal_Int32)19);
830 aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
831 aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
832 aRows.push_back(aRow);
834 aRow[1] = new ORowSetValueDecorator(OUString("INTEGER"));
835 aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
836 aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
837 aRow[15] = new ORowSetValueDecorator((sal_Int32)20);
838 aRows.push_back(aRow);
840 aRow[1] = new ORowSetValueDecorator(OUString("FLOAT"));
841 aRow[2] = new ORowSetValueDecorator(DataType::FLOAT);
842 aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
843 aRow[15] = new ORowSetValueDecorator((sal_Int32)15);
844 aRows.push_back(aRow);
846 pResult->setRows(aRows);
847 return xRef;
849 // -------------------------------------------------------------------------
850 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException)
852 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCatalogs );
854 // -----------------------------------------------------------------------------
855 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException)
857 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eSchemas );
859 // -------------------------------------------------------------------------
860 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumnPrivileges(
861 const Any&, const OUString&, const OUString&,
862 const OUString& ) throw(SQLException, RuntimeException)
864 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumnPrivileges );
866 // -------------------------------------------------------------------------
867 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumns(
868 const Any&,
869 const OUString&,
870 const OUString& tableNamePattern,
871 const OUString& columnNamePattern) throw(SQLException, RuntimeException)
873 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
874 Reference< XResultSet > xRef = pResult;
875 MacabRecords *aRecords;
876 OUString sTableName;
878 aRecords = m_xConnection->getAddressBook()->getMacabRecordsMatch(tableNamePattern);
880 ODatabaseMetaDataResultSet::ORows aRows;
881 if(aRecords != NULL)
883 MacabHeader *aHeader = aRecords->getHeader();
884 sTableName = aRecords->getName();
886 ODatabaseMetaDataResultSet::ORow aRow(19);
888 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
889 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
890 aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
891 aRow[3] = new ORowSetValueDecorator(sTableName);
892 aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
893 aRow[9] = ODatabaseMetaDataResultSet::get0Value();
894 aRow[10] = new ORowSetValueDecorator((sal_Int32) 10);
895 aRow[11] = ODatabaseMetaDataResultSet::get1Value();
896 aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
897 aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
898 aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
899 aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
900 aRow[16] = new ORowSetValueDecorator((sal_Int32) 254);
901 aRow[18] = new ORowSetValueDecorator(OUString("YES"));
903 sal_Int32 nPosition = 1;
904 OUString sName;
906 MacabHeader::iterator aField;
908 for ( aField = aHeader->begin();
909 aField != aHeader->end();
910 ++aField, ++nPosition)
913 sName = CFStringToOUString((CFStringRef) (*aField)->value);
914 if (match(columnNamePattern, sName, '\0'))
916 aRow[4] = new ORowSetValueDecorator(sName);
917 aRow[17] = new ORowSetValueDecorator(nPosition);
918 switch((*aField)->type)
920 case kABStringProperty:
921 aRow[5] = new ORowSetValueDecorator(DataType::CHAR);
922 aRow[6] = new ORowSetValueDecorator(OUString("CHAR"));
923 aRow[7] = new ORowSetValueDecorator((sal_Int32) 256);
924 aRows.push_back(aRow);
925 break;
926 case kABDateProperty:
927 aRow[5] = new ORowSetValueDecorator(DataType::TIMESTAMP);
928 aRow[6] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
929 aRows.push_back(aRow);
930 break;
931 case kABIntegerProperty:
932 aRow[5] = new ORowSetValueDecorator(DataType::INTEGER);
933 aRow[6] = new ORowSetValueDecorator(OUString("INTEGER"));
934 aRow[7] = new ORowSetValueDecorator((sal_Int32) 20);
935 aRows.push_back(aRow);
936 break;
937 case kABRealProperty:
938 aRow[5] = new ORowSetValueDecorator(DataType::FLOAT);
939 aRow[6] = new ORowSetValueDecorator(OUString("FLOAT"));
940 aRow[7] = new ORowSetValueDecorator((sal_Int32) 15);
941 aRows.push_back(aRow);
942 break;
943 default:
945 // shouldn't happen -- throw an error...?
950 pResult->setRows(aRows);
951 return xRef;
953 // -------------------------------------------------------------------------
954 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTables(
955 const Any&,
956 const OUString&,
957 const OUString&,
958 const Sequence< OUString >& types) throw(SQLException, RuntimeException)
960 ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
961 Reference< XResultSet > xRef = pResult;
963 // check whether we have tables in the requested types
964 // for the moment, we answer only the "TABLE" table type
965 // when no types are given at all, we return all the tables
966 static const OUString aTable("TABLE");
967 sal_Bool bTableFound = sal_False;
968 const OUString* p = types.getConstArray(),
969 * pEnd = p + types.getLength();
971 if (p == pEnd)
973 bTableFound = sal_True;
975 else while (p < pEnd)
977 if (match(*p, aTable, '\0'))
979 bTableFound = sal_True;
980 break;
982 p++;
984 if (!bTableFound)
985 return xRef;
987 static ODatabaseMetaDataResultSet::ORows aRows;
989 if (aRows.empty())
991 ODatabaseMetaDataResultSet::ORow aRow(6);
993 MacabRecords *xRecords = m_xConnection->getAddressBook()->getMacabRecords();
994 ::std::vector<MacabGroup *> xGroups = m_xConnection->getAddressBook()->getMacabGroups();
995 sal_Int32 i, nGroups;
996 nGroups = xGroups.size();
998 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
999 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
1000 aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
1001 aRow[3] = new ORowSetValueDecorator(xRecords->getName());
1002 aRow[4] = new ORowSetValueDecorator(aTable);
1003 aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
1004 aRows.push_back(aRow);
1006 for(i = 0; i < nGroups; i++)
1008 aRow[3] = new ORowSetValueDecorator(xGroups[i]->getName());
1009 aRows.push_back(aRow);
1012 pResult->setRows(aRows);
1013 return xRef;
1015 // -------------------------------------------------------------------------
1016 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getProcedureColumns(
1017 const Any&, const OUString&,
1018 const OUString&, const OUString& ) throw(SQLException, RuntimeException)
1020 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedureColumns );
1022 // -------------------------------------------------------------------------
1023 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getProcedures(
1024 const Any&, const OUString&,
1025 const OUString& ) throw(SQLException, RuntimeException)
1027 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedures );
1029 // -------------------------------------------------------------------------
1030 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getVersionColumns(
1031 const Any&, const OUString&, const OUString& table ) throw(SQLException, RuntimeException)
1033 ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
1034 Reference< XResultSet > xRef = pResult;
1036 ODatabaseMetaDataResultSet::ORows aRows;
1038 if (m_xConnection->getAddressBook()->getMacabRecords(table) != NULL)
1040 ODatabaseMetaDataResultSet::ORow aRow( 9 );
1042 OUString sName = CFStringToOUString(kABModificationDateProperty);
1044 aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
1045 aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
1046 aRow[2] = new ORowSetValueDecorator(sName);
1047 aRow[3] = new ORowSetValueDecorator(DataType::TIMESTAMP);
1048 aRow[4] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
1050 aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
1051 aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
1052 aRow[7] = ODatabaseMetaDataResultSet::getEmptyValue();
1053 aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
1055 aRows.push_back(aRow);
1057 pResult->setRows(aRows);
1058 return xRef;
1060 // -------------------------------------------------------------------------
1061 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getExportedKeys(
1062 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException)
1064 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eExportedKeys );
1066 // -------------------------------------------------------------------------
1067 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getImportedKeys(
1068 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException)
1070 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eImportedKeys );
1072 // -------------------------------------------------------------------------
1073 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getPrimaryKeys(
1074 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException)
1076 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::ePrimaryKeys );
1078 // -------------------------------------------------------------------------
1079 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getIndexInfo(
1080 const Any&, const OUString&, const OUString&,
1081 sal_Bool, sal_Bool ) throw(SQLException, RuntimeException)
1083 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eIndexInfo );
1085 // -------------------------------------------------------------------------
1086 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getBestRowIdentifier(
1087 const Any&, const OUString&, const OUString&, sal_Int32,
1088 sal_Bool ) throw(SQLException, RuntimeException)
1090 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eBestRowIdentifier );
1092 // -------------------------------------------------------------------------
1093 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTablePrivileges(
1094 const Any&, const OUString&, const OUString& ) throw(SQLException, RuntimeException)
1096 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
1098 // -------------------------------------------------------------------------
1099 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getCrossReference(
1100 const Any&, const OUString&,
1101 const OUString&, const Any&,
1102 const OUString&, const OUString& ) throw(SQLException, RuntimeException)
1104 return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCrossReference );
1106 // -------------------------------------------------------------------------
1107 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getUDTs( const Any&, const OUString&, const OUString&, const Sequence< sal_Int32 >& ) throw(SQLException, RuntimeException)
1109 OSL_FAIL("Not implemented yet!");
1110 throw SQLException();
1112 // -----------------------------------------------------------------------------
1114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */