1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_connectivity.hxx"
30 
31 #include "MacabDatabaseMetaData.hxx"
32 #include "MacabAddressBook.hxx"
33 #include "MacabHeader.hxx"
34 #include "MacabGroup.hxx"
35 #include "macabutilities.hxx"
36 
37 #ifndef CONNECTIVITY_MACAB_DRIVER_HXX_
38 #include "MacabDriver.hxx"
39 #endif
40 #include "FDatabaseMetaDataResultSet.hxx"
41 #include "OTypeInfo.hxx"
42 #include <com/sun/star/sdbc/ColumnValue.hpp>
43 #include <com/sun/star/sdbc/ResultSetType.hpp>
44 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
45 
46 #include <vector>
47 
48 using namespace connectivity::macab;
49 using namespace com::sun::star::uno;
50 using namespace com::sun::star::lang;
51 using namespace com::sun::star::beans;
52 using namespace com::sun::star::sdbc;
53 
54 MacabDatabaseMetaData::MacabDatabaseMetaData(MacabConnection* _pCon)
55 		: m_xConnection(_pCon),
56 		  m_bUseCatalog(sal_True)
57 {
58 	OSL_ENSURE(_pCon,"MacabDatabaseMetaData::MacabDatabaseMetaData: No connection set!");
59 
60 	osl_incrementInterlockedCount( &m_refCount );
61 	m_bUseCatalog	= !(usesLocalFiles() || usesLocalFilePerTable());
62 	osl_decrementInterlockedCount( &m_refCount );
63 }
64 // -------------------------------------------------------------------------
65 MacabDatabaseMetaData::~MacabDatabaseMetaData()
66 {
67 }
68 // -------------------------------------------------------------------------
69 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getCatalogSeparator(  ) throw(SQLException, RuntimeException)
70 {
71 	::rtl::OUString aVal;
72 	if (m_bUseCatalog)
73 	{ // do some special here for you database
74 	}
75 
76 	return aVal;
77 }
78 // -------------------------------------------------------------------------
79 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxBinaryLiteralLength(  ) throw(SQLException, RuntimeException)
80 {
81 	sal_Int32 nValue = 0; // 0 means no limit
82 	return nValue;
83 }
84 // -------------------------------------------------------------------------
85 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxRowSize(  ) throw(SQLException, RuntimeException)
86 {
87 	sal_Int32 nValue = 0; // 0 means no limit
88 	return nValue;
89 }
90 // -------------------------------------------------------------------------
91 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxCatalogNameLength(  ) throw(SQLException, RuntimeException)
92 {
93 	sal_Int32 nValue = 0; // 0 means no limit
94 	return nValue;
95 }
96 // -------------------------------------------------------------------------
97 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxCharLiteralLength(  ) throw(SQLException, RuntimeException)
98 {
99 	sal_Int32 nValue = 0; // 0 means no limit
100 	return nValue;
101 }
102 // -------------------------------------------------------------------------
103 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnNameLength(  ) throw(SQLException, RuntimeException)
104 {
105 	sal_Int32 nValue = 0; // 0 means no limit
106 	return nValue;
107 }
108 // -------------------------------------------------------------------------
109 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInIndex(  ) throw(SQLException, RuntimeException)
110 {
111 	sal_Int32 nValue = 0; // 0 means no limit
112 	return nValue;
113 }
114 // -------------------------------------------------------------------------
115 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxCursorNameLength(  ) throw(SQLException, RuntimeException)
116 {
117 	sal_Int32 nValue = 0; // 0 means no limit
118 	return nValue;
119 }
120 // -------------------------------------------------------------------------
121 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxConnections(  ) throw(SQLException, RuntimeException)
122 {
123 	sal_Int32 nValue = 0; // 0 means no limit
124 	return nValue;
125 }
126 // -------------------------------------------------------------------------
127 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInTable(  ) throw(SQLException, RuntimeException)
128 {
129 	sal_Int32 nValue = 0; // 0 means no limit
130 	return nValue;
131 }
132 // -------------------------------------------------------------------------
133 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxStatementLength(  ) throw(SQLException, RuntimeException)
134 {
135 	sal_Int32 nValue = 0; // 0 means no limit
136 	return nValue;
137 }
138 // -------------------------------------------------------------------------
139 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxTableNameLength(  ) throw(SQLException, RuntimeException)
140 {
141 	sal_Int32 nValue = 0; // 0 means no limit
142 	return nValue;
143 }
144 // -------------------------------------------------------------------------
145 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxTablesInSelect(  ) throw(SQLException, RuntimeException)
146 {
147 	// MaxTablesInSelect describes how many tables can participate in the FROM part of a given SELECT statement,
148 	// currently, the resultset/statement implementations can cope with one table only
149 	sal_Int32 nValue = 1;
150 	return nValue;
151 }
152 // -------------------------------------------------------------------------
153 sal_Bool SAL_CALL MacabDatabaseMetaData::doesMaxRowSizeIncludeBlobs(  ) throw(SQLException, RuntimeException)
154 {
155 	return sal_False;
156 }
157 // -------------------------------------------------------------------------
158 sal_Bool SAL_CALL MacabDatabaseMetaData::storesLowerCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
159 {
160 	return sal_False;
161 }
162 // -------------------------------------------------------------------------
163 sal_Bool SAL_CALL MacabDatabaseMetaData::storesLowerCaseIdentifiers(  ) throw(SQLException, RuntimeException)
164 {
165 	return sal_False;
166 }
167 // -------------------------------------------------------------------------
168 sal_Bool SAL_CALL MacabDatabaseMetaData::storesMixedCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
169 {
170 	return sal_False;
171 }
172 // -------------------------------------------------------------------------
173 sal_Bool SAL_CALL MacabDatabaseMetaData::storesMixedCaseIdentifiers(  ) throw(SQLException, RuntimeException)
174 {
175 	return sal_False;
176 }
177 // -------------------------------------------------------------------------
178 sal_Bool SAL_CALL MacabDatabaseMetaData::storesUpperCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
179 {
180 	return sal_False;
181 }
182 // -------------------------------------------------------------------------
183 sal_Bool SAL_CALL MacabDatabaseMetaData::storesUpperCaseIdentifiers(  ) throw(SQLException, RuntimeException)
184 {
185 	return sal_False;
186 }
187 // -------------------------------------------------------------------------
188 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsAlterTableWithAddColumn(  ) throw(SQLException, RuntimeException)
189 {
190 	return sal_False;
191 }
192 // -------------------------------------------------------------------------
193 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsAlterTableWithDropColumn(  ) throw(SQLException, RuntimeException)
194 {
195 	return sal_False;
196 }
197 // -------------------------------------------------------------------------
198 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxIndexLength(  ) throw(SQLException, RuntimeException)
199 {
200 	sal_Int32 nValue = 0; // 0 means no limit
201 	return nValue;
202 }
203 // -------------------------------------------------------------------------
204 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsNonNullableColumns(  ) throw(SQLException, RuntimeException)
205 {
206 	return sal_False;
207 }
208 // -------------------------------------------------------------------------
209 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getCatalogTerm(  ) throw(SQLException, RuntimeException)
210 {
211 	::rtl::OUString aVal;
212 	if (m_bUseCatalog)
213 	{
214 	}
215 	return aVal;
216 }
217 // -------------------------------------------------------------------------
218 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getIdentifierQuoteString(  ) throw(SQLException, RuntimeException)
219 {
220 	// normally this is "
221 	::rtl::OUString aVal = ::rtl::OUString::createFromAscii("\"");
222 	return aVal;
223 }
224 // -------------------------------------------------------------------------
225 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getExtraNameCharacters(  ) throw(SQLException, RuntimeException)
226 {
227 	::rtl::OUString aVal;
228 	return aVal;
229 }
230 // -------------------------------------------------------------------------
231 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsDifferentTableCorrelationNames(  ) throw(SQLException, RuntimeException)
232 {
233 	return sal_False;
234 }
235 // -------------------------------------------------------------------------
236 sal_Bool SAL_CALL MacabDatabaseMetaData::isCatalogAtStart(  ) throw(SQLException, RuntimeException)
237 {
238 	sal_Bool bValue = sal_False;
239 	if (m_bUseCatalog)
240 	{
241 	}
242 	return bValue;
243 }
244 // -------------------------------------------------------------------------
245 sal_Bool SAL_CALL MacabDatabaseMetaData::dataDefinitionIgnoredInTransactions(  ) throw(SQLException, RuntimeException)
246 {
247 	return sal_True;
248 }
249 // -------------------------------------------------------------------------
250 sal_Bool SAL_CALL MacabDatabaseMetaData::dataDefinitionCausesTransactionCommit(  ) throw(SQLException, RuntimeException)
251 {
252 	return sal_True;
253 }
254 // -------------------------------------------------------------------------
255 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsDataManipulationTransactionsOnly(  ) throw(SQLException, RuntimeException)
256 {
257 	return sal_True;
258 }
259 // -------------------------------------------------------------------------
260 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions(  ) throw(SQLException, RuntimeException)
261 {
262 	return sal_True;
263 }
264 // -------------------------------------------------------------------------
265 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsPositionedDelete(  ) throw(SQLException, RuntimeException)
266 {
267 	return sal_False;
268 }
269 // -------------------------------------------------------------------------
270 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsPositionedUpdate(  ) throw(SQLException, RuntimeException)
271 {
272 	return sal_False;
273 }
274 // -------------------------------------------------------------------------
275 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenStatementsAcrossRollback(  ) throw(SQLException, RuntimeException)
276 {
277 	return sal_False;
278 }
279 // -------------------------------------------------------------------------
280 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenStatementsAcrossCommit(  ) throw(SQLException, RuntimeException)
281 {
282 	return sal_False;
283 }
284 // -------------------------------------------------------------------------
285 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenCursorsAcrossCommit(  ) throw(SQLException, RuntimeException)
286 {
287 	return sal_False;
288 }
289 // -------------------------------------------------------------------------
290 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOpenCursorsAcrossRollback(  ) throw(SQLException, RuntimeException)
291 {
292 	return sal_False;
293 }
294 // -------------------------------------------------------------------------
295 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 ) throw(SQLException, RuntimeException)
296 {
297 	return sal_False;
298 }
299 // -------------------------------------------------------------------------
300 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInDataManipulation(  ) throw(SQLException, RuntimeException)
301 {
302 	return sal_False;
303 }
304 // -------------------------------------------------------------------------
305 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsANSI92FullSQL(  ) throw(SQLException, RuntimeException)
306 {
307 	return sal_False;
308 }
309 // -------------------------------------------------------------------------
310 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsANSI92EntryLevelSQL(  ) throw(SQLException, RuntimeException)
311 {
312 	return sal_True; // should be supported at least
313 }
314 // -------------------------------------------------------------------------
315 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsIntegrityEnhancementFacility(  ) throw(SQLException, RuntimeException)
316 {
317 	return sal_False;
318 }
319 // -------------------------------------------------------------------------
320 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInIndexDefinitions(  ) throw(SQLException, RuntimeException)
321 {
322 	return sal_False;
323 }
324 // -------------------------------------------------------------------------
325 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInTableDefinitions(  ) throw(SQLException, RuntimeException)
326 {
327 	return sal_False;
328 }
329 // -------------------------------------------------------------------------
330 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInTableDefinitions(  ) throw(SQLException, RuntimeException)
331 {
332 	return sal_False;
333 }
334 // -------------------------------------------------------------------------
335 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInIndexDefinitions(  ) throw(SQLException, RuntimeException)
336 {
337 	return sal_False;
338 }
339 // -------------------------------------------------------------------------
340 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInDataManipulation(  ) throw(SQLException, RuntimeException)
341 {
342 	return sal_False;
343 }
344 // -------------------------------------------------------------------------
345 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOuterJoins(  ) throw(SQLException, RuntimeException)
346 {
347 	return sal_False;
348 }
349 // -------------------------------------------------------------------------
350 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxStatements(  ) throw(SQLException, RuntimeException)
351 {
352 	sal_Int32 nValue = 0; // 0 means no limit
353 	return nValue;
354 }
355 // -------------------------------------------------------------------------
356 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxProcedureNameLength(  ) throw(SQLException, RuntimeException)
357 {
358 	sal_Int32 nValue = 0; // 0 means no limit
359 	return nValue;
360 }
361 // -------------------------------------------------------------------------
362 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxSchemaNameLength(  ) throw(SQLException, RuntimeException)
363 {
364 	sal_Int32 nValue = 0; // 0 means no limit
365 	return nValue;
366 }
367 // -------------------------------------------------------------------------
368 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTransactions(  ) throw(SQLException, RuntimeException)
369 {
370 	return sal_False;
371 }
372 // -------------------------------------------------------------------------
373 sal_Bool SAL_CALL MacabDatabaseMetaData::allProceduresAreCallable(  ) throw(SQLException, RuntimeException)
374 {
375 	return sal_False;
376 }
377 // -------------------------------------------------------------------------
378 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsStoredProcedures(  ) throw(SQLException, RuntimeException)
379 {
380 	return sal_False;
381 }
382 // -------------------------------------------------------------------------
383 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSelectForUpdate(  ) throw(SQLException, RuntimeException)
384 {
385 	return sal_False;
386 }
387 // -------------------------------------------------------------------------
388 sal_Bool SAL_CALL MacabDatabaseMetaData::allTablesAreSelectable(  ) throw(SQLException, RuntimeException)
389 {
390 	return sal_False;
391 }
392 // -------------------------------------------------------------------------
393 sal_Bool SAL_CALL MacabDatabaseMetaData::isReadOnly(  ) throw(SQLException, RuntimeException)
394 {
395 	// for the moment, we have read-only addresses, but this might change in the future
396 	return sal_True;
397 }
398 // -------------------------------------------------------------------------
399 sal_Bool SAL_CALL MacabDatabaseMetaData::usesLocalFiles(  ) throw(SQLException, RuntimeException)
400 {
401 	return sal_False;
402 }
403 // -------------------------------------------------------------------------
404 sal_Bool SAL_CALL MacabDatabaseMetaData::usesLocalFilePerTable(  ) throw(SQLException, RuntimeException)
405 {
406 	return sal_False;
407 }
408 // -------------------------------------------------------------------------
409 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTypeConversion(  ) throw(SQLException, RuntimeException)
410 {
411 	return sal_False;
412 }
413 // -------------------------------------------------------------------------
414 sal_Bool SAL_CALL MacabDatabaseMetaData::nullPlusNonNullIsNull(  ) throw(SQLException, RuntimeException)
415 {
416 	return sal_False;
417 }
418 // -------------------------------------------------------------------------
419 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsColumnAliasing(  ) throw(SQLException, RuntimeException)
420 {
421 	return sal_False;
422 }
423 // -------------------------------------------------------------------------
424 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsTableCorrelationNames(  ) throw(SQLException, RuntimeException)
425 {
426 	return sal_False;
427 }
428 // -------------------------------------------------------------------------
429 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsConvert( sal_Int32, sal_Int32 ) throw(SQLException, RuntimeException)
430 {
431 	return sal_False;
432 }
433 // -------------------------------------------------------------------------
434 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsExpressionsInOrderBy(  ) throw(SQLException, RuntimeException)
435 {
436 	return sal_False;
437 }
438 // -------------------------------------------------------------------------
439 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsGroupBy(  ) throw(SQLException, RuntimeException)
440 {
441 	return sal_False;
442 }
443 // -------------------------------------------------------------------------
444 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsGroupByBeyondSelect(  ) throw(SQLException, RuntimeException)
445 {
446 	return sal_False;
447 }
448 // -------------------------------------------------------------------------
449 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsGroupByUnrelated(  ) throw(SQLException, RuntimeException)
450 {
451 	return sal_False;
452 }
453 // -------------------------------------------------------------------------
454 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMultipleTransactions(  ) throw(SQLException, RuntimeException)
455 {
456 	return sal_False;
457 }
458 // -------------------------------------------------------------------------
459 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMultipleResultSets(  ) throw(SQLException, RuntimeException)
460 {
461 	return sal_False;
462 }
463 // -------------------------------------------------------------------------
464 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsLikeEscapeClause(  ) throw(SQLException, RuntimeException)
465 {
466 	return sal_False;
467 }
468 // -------------------------------------------------------------------------
469 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsOrderByUnrelated(  ) throw(SQLException, RuntimeException)
470 {
471 	return sal_False;
472 }
473 // -------------------------------------------------------------------------
474 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsUnion(  ) throw(SQLException, RuntimeException)
475 {
476 	return sal_False;
477 }
478 // -------------------------------------------------------------------------
479 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsUnionAll(  ) throw(SQLException, RuntimeException)
480 {
481 	return sal_False;
482 }
483 // -------------------------------------------------------------------------
484 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMixedCaseIdentifiers(  ) throw(SQLException, RuntimeException)
485 {
486 	return sal_False;
487 }
488 // -------------------------------------------------------------------------
489 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMixedCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
490 {
491 	return sal_False;
492 }
493 // -------------------------------------------------------------------------
494 sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedAtEnd(  ) throw(SQLException, RuntimeException)
495 {
496 	return sal_False;
497 }
498 // -------------------------------------------------------------------------
499 sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedAtStart(  ) throw(SQLException, RuntimeException)
500 {
501 	return sal_False;
502 }
503 // -------------------------------------------------------------------------
504 sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedHigh(  ) throw(SQLException, RuntimeException)
505 {
506 	return sal_False;
507 }
508 // -------------------------------------------------------------------------
509 sal_Bool SAL_CALL MacabDatabaseMetaData::nullsAreSortedLow(  ) throw(SQLException, RuntimeException)
510 {
511 	return sal_False;
512 }
513 // -------------------------------------------------------------------------
514 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInProcedureCalls(  ) throw(SQLException, RuntimeException)
515 {
516 	return sal_False;
517 }
518 // -------------------------------------------------------------------------
519 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions(  ) throw(SQLException, RuntimeException)
520 {
521 	return sal_False;
522 }
523 // -------------------------------------------------------------------------
524 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInProcedureCalls(  ) throw(SQLException, RuntimeException)
525 {
526 	return sal_False;
527 }
528 // -------------------------------------------------------------------------
529 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions(  ) throw(SQLException, RuntimeException)
530 {
531 	return sal_False;
532 }
533 // -------------------------------------------------------------------------
534 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCorrelatedSubqueries(  ) throw(SQLException, RuntimeException)
535 {
536 	return sal_False;
537 }
538 // -------------------------------------------------------------------------
539 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInComparisons(  ) throw(SQLException, RuntimeException)
540 {
541 	return sal_False;
542 }
543 // -------------------------------------------------------------------------
544 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInExists(  ) throw(SQLException, RuntimeException)
545 {
546 	return sal_False;
547 }
548 // -------------------------------------------------------------------------
549 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInIns(  ) throw(SQLException, RuntimeException)
550 {
551 	return sal_False;
552 }
553 // -------------------------------------------------------------------------
554 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsSubqueriesInQuantifieds(  ) throw(SQLException, RuntimeException)
555 {
556 	return sal_False;
557 }
558 // -------------------------------------------------------------------------
559 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsANSI92IntermediateSQL(  ) throw(SQLException, RuntimeException)
560 {
561 	return sal_False;
562 }
563 // -------------------------------------------------------------------------
564 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getURL(  ) throw(SQLException, RuntimeException)
565 {
566 	// if someday we support more than the default address book,
567 	// this method should return the URL which was used to create it
568 	::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:address:macab:");
569 	return aValue;
570 }
571 // -------------------------------------------------------------------------
572 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getUserName(  ) throw(SQLException, RuntimeException)
573 {
574 	::rtl::OUString aValue;
575 	return aValue;
576 }
577 // -------------------------------------------------------------------------
578 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getDriverName(  ) throw(SQLException, RuntimeException)
579 {
580 	::rtl::OUString aValue = ::rtl::OUString::createFromAscii("macab");
581 	return aValue;
582 }
583 // -------------------------------------------------------------------------
584 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
585 {
586 	::rtl::OUString aValue = ::rtl::OUString::createFromAscii(MACAB_DRIVER_VERSION);
587 	return aValue;
588 }
589 // -------------------------------------------------------------------------
590 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getDatabaseProductVersion(  ) throw(SQLException, RuntimeException)
591 {
592 	::rtl::OUString aValue;
593 	return aValue;
594 }
595 // -------------------------------------------------------------------------
596 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getDatabaseProductName(  ) throw(SQLException, RuntimeException)
597 {
598 	::rtl::OUString aValue;
599 	return aValue;
600 }
601 // -------------------------------------------------------------------------
602 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getProcedureTerm(  ) throw(SQLException, RuntimeException)
603 {
604 	::rtl::OUString aValue;
605 	return aValue;
606 }
607 // -------------------------------------------------------------------------
608 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getSchemaTerm(  ) throw(SQLException, RuntimeException)
609 {
610 	::rtl::OUString aValue;
611 	return aValue;
612 }
613 // -------------------------------------------------------------------------
614 sal_Int32 SAL_CALL MacabDatabaseMetaData::getDriverMajorVersion(  ) throw(RuntimeException)
615 {
616 	return MACAB_DRIVER_VERSION_MAJOR;
617 }
618 // -------------------------------------------------------------------------
619 sal_Int32 SAL_CALL MacabDatabaseMetaData::getDefaultTransactionIsolation(  ) throw(SQLException, RuntimeException)
620 {
621 	return TransactionIsolation::NONE;
622 }
623 // -------------------------------------------------------------------------
624 sal_Int32 SAL_CALL MacabDatabaseMetaData::getDriverMinorVersion(  ) throw(RuntimeException)
625 {
626 	return MACAB_DRIVER_VERSION_MINOR;
627 }
628 // -------------------------------------------------------------------------
629 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getSQLKeywords(  ) throw(SQLException, RuntimeException)
630 {
631 	::rtl::OUString aValue;
632 	return aValue;
633 }
634 // -------------------------------------------------------------------------
635 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getSearchStringEscape(  ) throw(SQLException, RuntimeException)
636 {
637 	::rtl::OUString aValue;
638 	return aValue;
639 }
640 // -------------------------------------------------------------------------
641 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getStringFunctions(  ) throw(SQLException, RuntimeException)
642 {
643 	return ::rtl::OUString();
644 }
645 // -------------------------------------------------------------------------
646 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getTimeDateFunctions(  ) throw(SQLException, RuntimeException)
647 {
648 	return ::rtl::OUString();
649 }
650 // -------------------------------------------------------------------------
651 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getSystemFunctions(  ) throw(SQLException, RuntimeException)
652 {
653 	return ::rtl::OUString();
654 }
655 // -------------------------------------------------------------------------
656 ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getNumericFunctions(  ) throw(SQLException, RuntimeException)
657 {
658 	return ::rtl::OUString();
659 }
660 // -------------------------------------------------------------------------
661 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsExtendedSQLGrammar(  ) throw(SQLException, RuntimeException)
662 {
663 	return sal_False;
664 }
665 // -------------------------------------------------------------------------
666 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsCoreSQLGrammar(  ) throw(SQLException, RuntimeException)
667 {
668 	return sal_False;
669 }
670 // -------------------------------------------------------------------------
671 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsMinimumSQLGrammar(  ) throw(SQLException, RuntimeException)
672 {
673 	return sal_True;
674 }
675 // -------------------------------------------------------------------------
676 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsFullOuterJoins(  ) throw(SQLException, RuntimeException)
677 {
678 	return sal_False;
679 }
680 // -------------------------------------------------------------------------
681 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsLimitedOuterJoins(  ) throw(SQLException, RuntimeException)
682 {
683 	return sal_False;
684 }
685 // -------------------------------------------------------------------------
686 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInGroupBy(  ) throw(SQLException, RuntimeException)
687 {
688 	sal_Int32 nValue = 0; // 0 means no limit
689 	return nValue;
690 }
691 // -------------------------------------------------------------------------
692 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInOrderBy(  ) throw(SQLException, RuntimeException)
693 {
694 	sal_Int32 nValue = 0; // 0 means no limit
695 	return nValue;
696 }
697 // -------------------------------------------------------------------------
698 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxColumnsInSelect(  ) throw(SQLException, RuntimeException)
699 {
700 	sal_Int32 nValue = 0; // 0 means no limit
701 	return nValue;
702 }
703 // -------------------------------------------------------------------------
704 sal_Int32 SAL_CALL MacabDatabaseMetaData::getMaxUserNameLength(  ) throw(SQLException, RuntimeException)
705 {
706 	sal_Int32 nValue = 0; // 0 means no limit
707 	return nValue;
708 }
709 // -------------------------------------------------------------------------
710 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
711 {
712 	switch (setType)
713 	{
714 		case ResultSetType::FORWARD_ONLY:
715 		case ResultSetType::SCROLL_INSENSITIVE:
716 			return sal_True;
717 	}
718 	return sal_False;
719 }
720 // -------------------------------------------------------------------------
721 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 ) throw(SQLException, RuntimeException)
722 {
723 	switch (setType)
724 	{
725 		case ResultSetType::FORWARD_ONLY:
726 		case ResultSetType::SCROLL_INSENSITIVE:
727 			return sal_True;
728 	}
729 	return sal_False;
730 }
731 // -------------------------------------------------------------------------
732 sal_Bool SAL_CALL MacabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
733 {
734 	return sal_False;
735 }
736 // -------------------------------------------------------------------------
737 sal_Bool SAL_CALL MacabDatabaseMetaData::ownDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
738 {
739 	return sal_False;
740 }
741 // -------------------------------------------------------------------------
742 sal_Bool SAL_CALL MacabDatabaseMetaData::ownInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
743 {
744 	return sal_False;
745 }
746 // -------------------------------------------------------------------------
747 sal_Bool SAL_CALL MacabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
748 {
749 	return sal_False;
750 }
751 // -------------------------------------------------------------------------
752 sal_Bool SAL_CALL MacabDatabaseMetaData::othersDeletesAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
753 {
754 	return sal_False;
755 }
756 // -------------------------------------------------------------------------
757 sal_Bool SAL_CALL MacabDatabaseMetaData::othersInsertsAreVisible( sal_Int32 ) throw(SQLException, RuntimeException)
758 {
759 	return sal_False;
760 }
761 // -------------------------------------------------------------------------
762 sal_Bool SAL_CALL MacabDatabaseMetaData::updatesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
763 {
764 	return sal_False;
765 }
766 // -------------------------------------------------------------------------
767 sal_Bool SAL_CALL MacabDatabaseMetaData::deletesAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
768 {
769 	return sal_False;
770 }
771 // -------------------------------------------------------------------------
772 sal_Bool SAL_CALL MacabDatabaseMetaData::insertsAreDetected( sal_Int32 ) throw(SQLException, RuntimeException)
773 {
774 	return sal_False;
775 }
776 // -------------------------------------------------------------------------
777 sal_Bool SAL_CALL MacabDatabaseMetaData::supportsBatchUpdates(  ) throw(SQLException, RuntimeException)
778 {
779 	return sal_False;
780 }
781 // -------------------------------------------------------------------------
782 Reference< XConnection > SAL_CALL MacabDatabaseMetaData::getConnection(  ) throw(SQLException, RuntimeException)
783 {
784 	return (Reference< XConnection >) m_xConnection.get();
785 }
786 // -------------------------------------------------------------------------
787 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTableTypes(  ) throw(SQLException, RuntimeException)
788 {
789 	::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
790 	Reference< XResultSet > xRef = pResult;
791 
792 	static ODatabaseMetaDataResultSet::ORows aRows;
793 	static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE"));
794 
795 	if (aRows.empty())
796 	{
797 		ODatabaseMetaDataResultSet::ORow aRow(2);
798 		aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
799 		aRow[1] = new ORowSetValueDecorator(aTable);
800 		aRows.push_back(aRow);
801 	}
802 	pResult->setRows(aRows);
803 	return xRef;
804 }
805 // -------------------------------------------------------------------------
806 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTypeInfo(  ) throw(SQLException, RuntimeException)
807 {
808 	ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
809 	Reference< XResultSet > xRef = pResult;
810 
811 	static ODatabaseMetaDataResultSet::ORows aRows;
812 	if (aRows.empty())
813 	{
814 		ODatabaseMetaDataResultSet::ORow aRow(19);
815 
816 		// We support four types: char, timestamp, integer, float
817 		aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
818 		aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"));
819 		aRow[2] = new ORowSetValueDecorator(DataType::CHAR);
820 		aRow[3] = new ORowSetValueDecorator((sal_Int32) 254);
821 		aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
822 		aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
823 		aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
824 		aRow[7] = new ORowSetValueDecorator((sal_Int32) ColumnValue::NULLABLE);
825 		aRow[8] = ODatabaseMetaDataResultSet::get1Value();
826 		aRow[9] = new ORowSetValueDecorator((sal_Int32) ColumnSearch::CHAR);
827 		aRow[10] = ODatabaseMetaDataResultSet::get1Value();
828 		aRow[11] = ODatabaseMetaDataResultSet::get0Value();
829 		aRow[12] = ODatabaseMetaDataResultSet::get0Value();
830 		aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
831 		aRow[14] = ODatabaseMetaDataResultSet::get0Value();
832 		aRow[15] = ODatabaseMetaDataResultSet::get0Value();
833 		aRow[16] = ODatabaseMetaDataResultSet::getEmptyValue();
834 		aRow[17] = ODatabaseMetaDataResultSet::getEmptyValue();
835 		aRow[18] = new ORowSetValueDecorator((sal_Int32) 10);
836 
837 		aRows.push_back(aRow);
838 
839 		aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP"));
840 		aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
841 		aRow[3] = new ORowSetValueDecorator((sal_Int32)19);
842 		aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
843 		aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
844 		aRows.push_back(aRow);
845 
846 		aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("INTEGER"));
847 		aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
848 		aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
849 		aRow[15] = new ORowSetValueDecorator((sal_Int32)20);
850 		aRows.push_back(aRow);
851 
852 		aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("FLOAT"));
853 		aRow[2] = new ORowSetValueDecorator(DataType::FLOAT);
854 		aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
855 		aRow[15] = new ORowSetValueDecorator((sal_Int32)15);
856 		aRows.push_back(aRow);
857 	}
858 	pResult->setRows(aRows);
859 	return xRef;
860 }
861 // -------------------------------------------------------------------------
862 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getCatalogs(  ) throw(SQLException, RuntimeException)
863 {
864     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCatalogs );
865 }
866 // -----------------------------------------------------------------------------
867 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getSchemas(  ) throw(SQLException, RuntimeException)
868 {
869     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eSchemas );
870 }
871 // -------------------------------------------------------------------------
872 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumnPrivileges(
873 	const Any&, const ::rtl::OUString&, const ::rtl::OUString&,
874 	const ::rtl::OUString& ) throw(SQLException, RuntimeException)
875 {
876     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumnPrivileges );
877 }
878 // -------------------------------------------------------------------------
879 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumns(
880 	const Any&,
881 	const ::rtl::OUString&,
882 	const ::rtl::OUString& tableNamePattern,
883 	const ::rtl::OUString& columnNamePattern) throw(SQLException, RuntimeException)
884 {
885 	::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
886 	Reference< XResultSet > xRef = pResult;
887 	MacabRecords *aRecords;
888 	::rtl::OUString sTableName;
889 
890 	aRecords = m_xConnection->getAddressBook()->getMacabRecordsMatch(tableNamePattern);
891 
892 	ODatabaseMetaDataResultSet::ORows aRows;
893 	if(aRecords != NULL)
894 	{
895 		MacabHeader *aHeader = aRecords->getHeader();
896 		sTableName = aRecords->getName();
897 
898 		ODatabaseMetaDataResultSet::ORow aRow(19);
899 
900 		aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
901 		aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
902 		aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
903 		aRow[3] = new ORowSetValueDecorator(sTableName);
904 		aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
905 		aRow[9] = ODatabaseMetaDataResultSet::get0Value();
906 		aRow[10] = new ORowSetValueDecorator((sal_Int32) 10);
907 		aRow[11] = ODatabaseMetaDataResultSet::get1Value();
908 		aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
909 		aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
910 		aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
911 		aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
912 		aRow[16] = new ORowSetValueDecorator((sal_Int32) 254);
913 		aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES"));
914 
915 		sal_Int32 nPosition = 1;
916 		::rtl::OUString sName;
917 
918 		MacabHeader::iterator aField;
919 
920 		for (	aField = aHeader->begin();
921 				aField != aHeader->end();
922 				++aField, ++nPosition)
923 		{
924 
925 			sName = CFStringToOUString((CFStringRef) (*aField)->value);
926 			if (match(columnNamePattern, sName, '\0'))
927 			{
928 				aRow[4] = new ORowSetValueDecorator(sName);
929 				aRow[17] = new ORowSetValueDecorator(nPosition);
930 				switch((*aField)->type)
931 				{
932 					case kABStringProperty:
933 						aRow[5] = new ORowSetValueDecorator(DataType::CHAR);
934 						aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"));
935 						aRow[7] = new ORowSetValueDecorator((sal_Int32) 256);
936 						aRows.push_back(aRow);
937 						break;
938 					case kABDateProperty:
939 						aRow[5] = new ORowSetValueDecorator(DataType::TIMESTAMP);
940 						aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP"));
941 						aRows.push_back(aRow);
942 						break;
943 					case kABIntegerProperty:
944 						aRow[5] = new ORowSetValueDecorator(DataType::INTEGER);
945 						aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("INTEGER"));
946 						aRow[7] = new ORowSetValueDecorator((sal_Int32) 20);
947 						aRows.push_back(aRow);
948 						break;
949 					case kABRealProperty:
950 						aRow[5] = new ORowSetValueDecorator(DataType::FLOAT);
951 						aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("FLOAT"));
952 						aRow[7] = new ORowSetValueDecorator((sal_Int32) 15);
953 						aRows.push_back(aRow);
954 						break;
955 					default:
956 						;
957 						// shouldn't happen -- throw an error...?
958 				}
959 			}
960 		}
961 	}
962 	pResult->setRows(aRows);
963 	return xRef;
964 }
965 // -------------------------------------------------------------------------
966 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTables(
967 	const Any&,
968 	const ::rtl::OUString&,
969 	const ::rtl::OUString&,
970 	const Sequence< ::rtl::OUString >& types) throw(SQLException, RuntimeException)
971 {
972 	ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
973 	Reference< XResultSet > xRef = pResult;
974 
975 	// check whether we have tables in the requested types
976 	// for the moment, we answer only the "TABLE" table type
977 	// when no types are given at all, we return all the tables
978 	static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE"));
979 	sal_Bool bTableFound = sal_False;
980 	const ::rtl::OUString* p = types.getConstArray(),
981 	                     * pEnd = p + types.getLength();
982 
983 	if (p == pEnd)
984 	{
985 		bTableFound = sal_True;
986 	}
987 	else while (p < pEnd)
988 	{
989 		if (match(*p, aTable, '\0'))
990 		{
991 			bTableFound = sal_True;
992 			break;
993 		}
994 		p++;
995 	}
996 	if (!bTableFound)
997 		return xRef;
998 
999 	static ODatabaseMetaDataResultSet::ORows aRows;
1000 
1001 	if (aRows.empty())
1002 	{
1003 		ODatabaseMetaDataResultSet::ORow aRow(6);
1004 
1005 		MacabRecords *xRecords = m_xConnection->getAddressBook()->getMacabRecords();
1006 		::std::vector<MacabGroup *> xGroups = m_xConnection->getAddressBook()->getMacabGroups();
1007 		sal_Int32 i, nGroups;
1008 		nGroups = xGroups.size();
1009 
1010 		aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
1011 		aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
1012 		aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue();
1013 		aRow[3] = new ORowSetValueDecorator(xRecords->getName());
1014 		aRow[4] = new ORowSetValueDecorator(aTable);
1015 		aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
1016 		aRows.push_back(aRow);
1017 
1018 		for(i = 0; i < nGroups; i++)
1019 		{
1020 			aRow[3] = new ORowSetValueDecorator(xGroups[i]->getName());
1021 			aRows.push_back(aRow);
1022 		}
1023 	}
1024 	pResult->setRows(aRows);
1025 	return xRef;
1026 }
1027 // -------------------------------------------------------------------------
1028 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getProcedureColumns(
1029 	const Any&, const ::rtl::OUString&,
1030 	const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1031 {
1032     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedureColumns );
1033 }
1034 // -------------------------------------------------------------------------
1035 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getProcedures(
1036 	const Any&, const ::rtl::OUString&,
1037 	const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1038 {
1039     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eProcedures );
1040 }
1041 // -------------------------------------------------------------------------
1042 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getVersionColumns(
1043 	const Any&, const ::rtl::OUString&, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
1044 {
1045     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eVersionColumns );
1046 
1047 	::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
1048 	Reference< XResultSet > xRef = pResult;
1049 
1050 	ODatabaseMetaDataResultSet::ORows aRows;
1051 
1052 	if (m_xConnection->getAddressBook()->getMacabRecords(table) != NULL)
1053 	{
1054 		ODatabaseMetaDataResultSet::ORow aRow( 9 );
1055 
1056 		::rtl::OUString sName = CFStringToOUString(kABModificationDateProperty);
1057 
1058 		aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue();
1059 		aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue();
1060 		aRow[2] = new ORowSetValueDecorator(sName);
1061 		aRow[3] = new ORowSetValueDecorator(DataType::TIMESTAMP);
1062 		aRow[4] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP"));
1063 
1064 		aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
1065 		aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue();
1066 		aRow[7] = ODatabaseMetaDataResultSet::getEmptyValue();
1067 		aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
1068 
1069 		aRows.push_back(aRow);
1070 	}
1071 	pResult->setRows(aRows);
1072 	return xRef;
1073 }
1074 // -------------------------------------------------------------------------
1075 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getExportedKeys(
1076 	const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1077 {
1078     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eExportedKeys );
1079 }
1080 // -------------------------------------------------------------------------
1081 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getImportedKeys(
1082 	const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1083 {
1084     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eImportedKeys );
1085 }
1086 // -------------------------------------------------------------------------
1087 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getPrimaryKeys(
1088 	const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1089 {
1090     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::ePrimaryKeys );
1091 }
1092 // -------------------------------------------------------------------------
1093 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getIndexInfo(
1094 	const Any&, const ::rtl::OUString&, const ::rtl::OUString&,
1095 	sal_Bool, sal_Bool ) throw(SQLException, RuntimeException)
1096 {
1097     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eIndexInfo );
1098 }
1099 // -------------------------------------------------------------------------
1100 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getBestRowIdentifier(
1101 	const Any&, const ::rtl::OUString&, const ::rtl::OUString&, sal_Int32,
1102 	sal_Bool ) throw(SQLException, RuntimeException)
1103 {
1104     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eBestRowIdentifier );
1105 }
1106 // -------------------------------------------------------------------------
1107 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTablePrivileges(
1108 	const Any&, const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1109 {
1110     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
1111 }
1112 // -------------------------------------------------------------------------
1113 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getCrossReference(
1114 	const Any&, const ::rtl::OUString&,
1115 	const ::rtl::OUString&, const Any&,
1116 	const ::rtl::OUString&, const ::rtl::OUString& ) throw(SQLException, RuntimeException)
1117 {
1118     return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eCrossReference );
1119 }
1120 // -------------------------------------------------------------------------
1121 Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getUDTs( const Any&, const ::rtl::OUString&, const ::rtl::OUString&, const Sequence< sal_Int32 >& ) throw(SQLException, RuntimeException)
1122 {
1123 	OSL_ENSURE(0,"Not implemented yet!");
1124 	throw SQLException();
1125 }
1126 // -----------------------------------------------------------------------------
1127