1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_connectivity.hxx"
26 #include "NDatabaseMetaData.hxx"
27 #include <com/sun/star/sdbc/DataType.hpp>
28 #include <com/sun/star/sdbc/ResultSetType.hpp>
29 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
30 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
31 #include <connectivity/dbexception.hxx>
32 #include <connectivity/FValue.hxx>
33 #include <com/sun/star/sdbc/ColumnValue.hpp>
34 #include <com/sun/star/sdbc/ColumnSearch.hpp>
35 
36 #include <vector>
37 #include <string.h>
38 #include "EApi.h"
39 
40 #if OSL_DEBUG_LEVEL > 0
41 # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
42 #else /* OSL_DEBUG_LEVEL */
43 # define OUtoCStr( x ) ("dummy")
44 #endif /* OSL_DEBUG_LEVEL */
45 
46 using namespace connectivity::evoab;
47 using namespace connectivity;
48 using namespace com::sun::star::uno;
49 using namespace com::sun::star::lang;
50 using namespace com::sun::star::beans;
51 using namespace com::sun::star::sdbc;
52 using namespace com::sun::star::sdbcx;
53 
54 
55 namespace connectivity
56 {
57 	namespace evoab
58 	{
59 		static sal_Int32    const s_nCOLUMN_SIZE = 256;
60 		static sal_Int32    const s_nDECIMAL_DIGITS = 0;
61 		static sal_Int32    const s_nNULLABLE = 1;
62 		static sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535;
63 
64 		static ColumnProperty **pFields=NULL;
65 		static guint        nFields = 0;
66 
67         static const char *pBlackList[] =
68         {
69             "id",
70             "list-show-addresses",
71             "address-label-home",
72             "address-label-work",
73             "address-label-other"
74         };
75 
get_evo_addr()76     const SplitEvoColumns* get_evo_addr()
77     {
78 	    static const SplitEvoColumns evo_addr[] = {
79 		    {"addr-line1",DEFAULT_ADDR_LINE1},{"addr-line2",DEFAULT_ADDR_LINE2},{"city",DEFAULT_CITY},{"state",DEFAULT_STATE},{"country",DEFAULT_COUNTRY},{"zip",DEFAULT_ZIP},
80 		    {"work-addr-line1",WORK_ADDR_LINE1},{"work-addr-line2",WORK_ADDR_LINE2},{"work-city",WORK_CITY},{"work-state",WORK_STATE},{"work-country",WORK_COUNTRY},{"work-zip",WORK_ZIP},
81 		    {"home-addr-line1",HOME_ADDR_LINE1},{"home-addr-line2",HOME_ADDR_LINE2},{"home-addr-City",HOME_CITY},{"home-state",HOME_STATE},{"home-country",HOME_COUNTRY},{"home-zip",HOME_ZIP},
82 		    {"other-addr-line1",OTHER_ADDR_LINE1},{"other-addr-line2",OTHER_ADDR_LINE2},{"other-addr-city",OTHER_CITY},{"other-addr-state",OTHER_STATE},{"other-addr-country",OTHER_COUNTRY},{"other-addr-zip",OTHER_ZIP}
83 	    };
84         return evo_addr;
85     }
86 
87     static void
splitColumn(ColumnProperty ** pToBeFields)88     splitColumn (ColumnProperty **pToBeFields)
89     {
90         const SplitEvoColumns* evo_addr( get_evo_addr() );
91         for (int i = 0; i < OTHER_ZIP; i++)
92         {
93             pToBeFields[nFields] = g_new0(ColumnProperty,1);
94             pToBeFields[nFields]->bIsSplittedValue = true;
95             pToBeFields[nFields]->pField = g_param_spec_ref(g_param_spec_string (evo_addr[i].pColumnName,evo_addr[i].pColumnName,"",NULL,G_PARAM_WRITABLE));
96             nFields++;
97         }
98     }
99 
100     static void
initFields()101     initFields()
102     {
103         if( !pFields )
104         {
105             ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
106             if( !pFields )
107             {
108                 guint        nProps;
109                 ColumnProperty **pToBeFields;
110                 GParamSpec **pProps;
111                 nFields = 0;
112                 pProps = g_object_class_list_properties
113                     ( (GObjectClass *) g_type_class_ref( E_TYPE_CONTACT ),
114                          &nProps );
115                 pToBeFields = g_new0(ColumnProperty  *, (nProps + OTHER_ZIP)/* new column(s)*/ );
116                 for ( guint i = 0; i < nProps; i++ )
117                 {
118                     switch (pProps[i]->value_type)
119                     {
120                         case G_TYPE_STRING:
121                         case G_TYPE_BOOLEAN:
122                         {
123                             bool bAdd = true;
124                             const char *pName = g_param_spec_get_name( pProps[i] );
125                             for (unsigned int j = 0; j < G_N_ELEMENTS( pBlackList ); j++ )
126                             {
127                                 if( !strcmp( pBlackList[j], pName ) )
128                                 {
129                                     bAdd = false;
130                                     break;
131                                 }
132                             }
133                             if( bAdd )
134                             {
135                                 pToBeFields[nFields]= g_new0(ColumnProperty,1);
136                                 pToBeFields[nFields]->bIsSplittedValue=false;
137                                 pToBeFields[ nFields++ ]->pField = g_param_spec_ref( pProps[i] );
138                             }
139                             break;
140                         }
141                         default:
142                             break;
143                     }
144                 }
145 
146                 splitColumn(pToBeFields);
147                 pFields = pToBeFields;
148             }
149         }
150     }
151 
152 
153     guint
getFieldCount()154     getFieldCount()
155     {
156         initFields();
157         return nFields;
158     }
159 
160     const ColumnProperty *
getField(guint n)161     getField(guint n)
162     {
163         initFields();
164         if( n < nFields )
165             return pFields[n];
166     	else
167             return NULL;
168     }
169 
170     GType
getGFieldType(guint nCol)171     getGFieldType( guint nCol )
172     {
173         initFields();
174 
175         sal_Int32 nType = G_TYPE_STRING;
176         if ( nCol < nFields )
177             return ((GParamSpec *)pFields[nCol]->pField)->value_type;
178         return nType;
179     }
180 
181     sal_Int32
getFieldType(guint nCol)182     getFieldType( guint nCol )
183     {
184         sal_Int32 nType = getGFieldType( nCol );
185         return nType == G_TYPE_STRING ? DataType::VARCHAR : DataType::BIT;
186     }
187 
findEvoabField(const rtl::OUString & aColName)188     guint findEvoabField(const rtl::OUString& aColName)
189     {
190         guint nRet = (guint)-1;
191         sal_Bool bFound = sal_False;
192         initFields();
193         for (guint i=0;(i < nFields) && !bFound;i++)
194         {
195             rtl::OUString aName = getFieldName(i);
196             if (aName == aColName)
197             {
198                 nRet = i;
199                 bFound = sal_True;
200             }
201         }
202         return nRet;
203     }
204 
205     rtl::OUString
getFieldTypeName(guint nCol)206     getFieldTypeName( guint nCol )
207     {
208         switch( getFieldType( nCol ) )
209         {
210             case DataType::BIT:
211                 return ::rtl::OUString::createFromAscii( "BIT" );
212             case DataType::VARCHAR:
213                 return ::rtl::OUString::createFromAscii( "VARCHAR" );
214             default:
215                 break;
216         }
217         return ::rtl::OUString();
218     }
219 
220     rtl::OUString
getFieldName(guint nCol)221     getFieldName( guint nCol )
222     {
223         const GParamSpec *pSpec = getField( nCol )->pField;
224         rtl::OUString aName;
225         initFields();
226 
227         if( pSpec )
228             aName = rtl::OStringToOUString( g_param_spec_get_name( ( GParamSpec * )pSpec ),
229 											RTL_TEXTENCODING_UTF8 );
230             aName = aName.replace( '-', '_' );
231         return aName;
232     }
233 
234     void
free_column_resources()235     free_column_resources()
236     {
237         for (int i=nFields-1;i > 0;i--)
238         {
239             if (pFields && pFields[i] )
240             {
241                 if (pFields[i]->pField)
242                     g_param_spec_unref(pFields[i]->pField);
243                 g_free(pFields[i]);
244             }
245         }
246        if(pFields)
247         {
248             g_free(pFields);
249             pFields=NULL;
250         }
251 
252     }
253 
254 
255     }
256 }
257 
258 
OEvoabDatabaseMetaData(OEvoabConnection * _pCon)259 OEvoabDatabaseMetaData::OEvoabDatabaseMetaData(OEvoabConnection* _pCon)
260 	: ::connectivity::ODatabaseMetaDataBase(_pCon, _pCon->getConnectionInfo())
261 	,m_pConnection(_pCon)
262 {
263 	OSL_ENSURE(m_pConnection,"OEvoabDatabaseMetaData::OEvoabDatabaseMetaData: No connection set!");
264 }
~OEvoabDatabaseMetaData()265 OEvoabDatabaseMetaData::~OEvoabDatabaseMetaData()
266 {
267 }
268 
269 // -------------------------------------------------------------------------
getColumnRows(const::rtl::OUString & columnNamePattern)270 ODatabaseMetaDataResultSet::ORows& OEvoabDatabaseMetaData::getColumnRows( const ::rtl::OUString& columnNamePattern )
271 {
272 	static ODatabaseMetaDataResultSet::ORows aRows;
273 	ODatabaseMetaDataResultSet::ORow  aRow(19);
274 	aRows.clear();
275 
276 	// ****************************************************
277 	// Some entries in a row never change, so set them now
278 	// ****************************************************
279 
280 	// Catalog
281 	aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii(""));
282 	// Schema
283 	aRow[2] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii(""));
284 	// COLUMN_SIZE
285 	aRow[7] = new ORowSetValueDecorator(s_nCOLUMN_SIZE);
286 	// BUFFER_LENGTH, not used
287 	aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
288 	// DECIMAL_DIGITS.
289 	aRow[9] = new ORowSetValueDecorator(s_nDECIMAL_DIGITS);
290 	// NUM_PREC_RADIX
291 	aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
292 	// NULLABLE
293 	aRow[11] = new ORowSetValueDecorator(s_nNULLABLE);
294 	// REMARKS
295 	aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
296 	// COULUMN_DEF, not used
297 	aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
298 	// SQL_DATA_TYPE, not used
299 	aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
300 	// SQL_DATETIME_SUB, not used
301 	aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
302 	// CHAR_OCTET_LENGTH, refer to [5]
303 	aRow[16] = new ORowSetValueDecorator(s_nCHAR_OCTET_LENGTH);
304 	// IS_NULLABLE
305 	aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii( "YES" ));
306 
307 
308 	aRow[3] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii( "TABLE" ));
309 	::osl::MutexGuard aGuard( m_aMutex );
310 
311 	initFields();
312 	for (sal_Int32 i = 0; i < (sal_Int32) nFields; i++)
313 	{
314 		if( match( columnNamePattern, getFieldName( i ), '\0' ) )
315 		{
316 			aRow[5] = new ORowSetValueDecorator( static_cast<sal_Int16>( getFieldType( i ) ) );
317 			aRow[6] = new ORowSetValueDecorator( getFieldTypeName( i ) );
318 
319 			OSL_TRACE( "ColumnName = '%s'", g_param_spec_get_name( pFields[i]->pField ) );
320 			// COLUMN_NAME
321 			aRow[4] = new ORowSetValueDecorator( getFieldName( i ) );
322 			// ORDINAL_POSITION
323 			aRow[17] = new ORowSetValueDecorator( i );
324 			aRows.push_back( aRow );
325 		}
326 	}
327 
328 	return aRows ;
329 }
330 // -------------------------------------------------------------------------
impl_getCatalogSeparator_throw()331 ::rtl::OUString OEvoabDatabaseMetaData::impl_getCatalogSeparator_throw(  )
332 {
333 	return ::rtl::OUString();
334 }
335 // -------------------------------------------------------------------------
getMaxBinaryLiteralLength()336 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxBinaryLiteralLength(  ) throw(SQLException, RuntimeException)
337 {
338 	return 0;// 0 means no limit
339 }
340 // -------------------------------------------------------------------------
getMaxRowSize()341 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxRowSize(  ) throw(SQLException, RuntimeException)
342 {
343 	return 0;// 0 means no limit
344 }
345 // -------------------------------------------------------------------------
getMaxCatalogNameLength()346 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxCatalogNameLength(  ) throw(SQLException, RuntimeException)
347 {
348 	return 0;// 0 means no limit
349 }
350 // -------------------------------------------------------------------------
getMaxCharLiteralLength()351 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxCharLiteralLength(  ) throw(SQLException, RuntimeException)
352 {
353 	return 0;// 0 means no limit
354 }
355 // -------------------------------------------------------------------------
getMaxColumnNameLength()356 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnNameLength(  ) throw(SQLException, RuntimeException)
357 {
358 	return 0;// 0 means no limit
359 }
360 // -------------------------------------------------------------------------
getMaxColumnsInIndex()361 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInIndex(  ) throw(SQLException, RuntimeException)
362 {
363 	return 0;// 0 means no limit
364 }
365 // -------------------------------------------------------------------------
getMaxCursorNameLength()366 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxCursorNameLength(  ) throw(SQLException, RuntimeException)
367 {
368 	return 0;// 0 means no limit
369 }
370 // -------------------------------------------------------------------------
getMaxConnections()371 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxConnections(  ) throw(SQLException, RuntimeException)
372 {
373 	return 0;// 0 means no limit
374 }
375 // -------------------------------------------------------------------------
getMaxColumnsInTable()376 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInTable(  ) throw(SQLException, RuntimeException)
377 {
378 	return 0;// 0 means no limit
379 }
380 // -------------------------------------------------------------------------
impl_getMaxStatements_throw()381 sal_Int32 OEvoabDatabaseMetaData::impl_getMaxStatements_throw(  )
382 {
383 	return 0;// 0 means no limit
384 }
385 // -------------------------------------------------------------------------
getMaxTableNameLength()386 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxTableNameLength(  ) throw(SQLException, RuntimeException)
387 {
388 	return 0;// 0 means no limit
389 }
390 // -------------------------------------------------------------------------
impl_getMaxTablesInSelect_throw()391 sal_Int32 OEvoabDatabaseMetaData::impl_getMaxTablesInSelect_throw(  )
392 {
393 	// We only support a single table
394 	return 1;
395 }
396 // -------------------------------------------------------------------------
397 // -------------------------------------------------------------------------
doesMaxRowSizeIncludeBlobs()398 sal_Bool SAL_CALL OEvoabDatabaseMetaData::doesMaxRowSizeIncludeBlobs(  ) throw(SQLException, RuntimeException)
399 {
400 	return sal_False;
401 }
402 // -------------------------------------------------------------------------
storesLowerCaseQuotedIdentifiers()403 sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesLowerCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
404 {
405 	return sal_False;
406 }
407 // -------------------------------------------------------------------------
storesLowerCaseIdentifiers()408 sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesLowerCaseIdentifiers(  ) throw(SQLException, RuntimeException)
409 {
410 	return sal_False;
411 }
412 // -------------------------------------------------------------------------
impl_storesMixedCaseQuotedIdentifiers_throw()413 sal_Bool OEvoabDatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw(  )
414 {
415 	return sal_False;
416 }
417 // -------------------------------------------------------------------------
storesMixedCaseIdentifiers()418 sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesMixedCaseIdentifiers(  ) throw(SQLException, RuntimeException)
419 {
420 	return sal_False;
421 }
422 // -------------------------------------------------------------------------
storesUpperCaseQuotedIdentifiers()423 sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesUpperCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
424 {
425 	return sal_False;
426 }
427 // -------------------------------------------------------------------------
storesUpperCaseIdentifiers()428 sal_Bool SAL_CALL OEvoabDatabaseMetaData::storesUpperCaseIdentifiers(  ) throw(SQLException, RuntimeException)
429 {
430 	return sal_False;
431 }
432 // -------------------------------------------------------------------------
impl_supportsAlterTableWithAddColumn_throw()433 sal_Bool OEvoabDatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw(  )
434 {
435 	return sal_False;
436 }
437 // -------------------------------------------------------------------------
impl_supportsAlterTableWithDropColumn_throw()438 sal_Bool OEvoabDatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw(  )
439 {
440 	return sal_False;
441 }
442 // -------------------------------------------------------------------------
getMaxIndexLength()443 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxIndexLength(  ) throw(SQLException, RuntimeException)
444 {
445 	return 0;// 0 means no limit
446 }
447 // -------------------------------------------------------------------------
supportsNonNullableColumns()448 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsNonNullableColumns(  ) throw(SQLException, RuntimeException)
449 {
450 	return sal_False;
451 }
452 // -------------------------------------------------------------------------
getCatalogTerm()453 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getCatalogTerm(  ) throw(SQLException, RuntimeException)
454 {
455 	::rtl::OUString aVal;
456 	return aVal;
457 }
458 // -------------------------------------------------------------------------
impl_getIdentifierQuoteString_throw()459 ::rtl::OUString OEvoabDatabaseMetaData::impl_getIdentifierQuoteString_throw(  )
460 {
461 	// normally this is "
462 	::rtl::OUString aVal = ::rtl::OUString::createFromAscii("\"");
463 	return aVal;
464 }
465 // -------------------------------------------------------------------------
getExtraNameCharacters()466 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getExtraNameCharacters(  ) throw(SQLException, RuntimeException)
467 {
468 	::rtl::OUString aVal;
469 	return aVal;
470 }
471 // -------------------------------------------------------------------------
supportsDifferentTableCorrelationNames()472 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsDifferentTableCorrelationNames(  ) throw(SQLException, RuntimeException)
473 {
474 	return sal_False;
475 }
476 // -------------------------------------------------------------------------
impl_isCatalogAtStart_throw()477 sal_Bool OEvoabDatabaseMetaData::impl_isCatalogAtStart_throw(  )
478 {
479 	sal_Bool bValue = sal_False;
480 	return bValue;
481 }
482 // -------------------------------------------------------------------------
dataDefinitionIgnoredInTransactions()483 sal_Bool SAL_CALL OEvoabDatabaseMetaData::dataDefinitionIgnoredInTransactions(  ) throw(SQLException, RuntimeException)
484 {
485 	return sal_True;
486 }
487 // -------------------------------------------------------------------------
dataDefinitionCausesTransactionCommit()488 sal_Bool SAL_CALL OEvoabDatabaseMetaData::dataDefinitionCausesTransactionCommit(  ) throw(SQLException, RuntimeException)
489 {
490 	return sal_True;
491 }
492 // -------------------------------------------------------------------------
supportsDataManipulationTransactionsOnly()493 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsDataManipulationTransactionsOnly(  ) throw(SQLException, RuntimeException)
494 {
495 	return sal_True;
496 }
497 // -------------------------------------------------------------------------
supportsDataDefinitionAndDataManipulationTransactions()498 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions(  ) throw(SQLException, RuntimeException)
499 {
500 	return sal_True;
501 }
502 // -------------------------------------------------------------------------
supportsPositionedDelete()503 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsPositionedDelete(  ) throw(SQLException, RuntimeException)
504 {
505 	return sal_False;
506 }
507 // -------------------------------------------------------------------------
supportsPositionedUpdate()508 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsPositionedUpdate(  ) throw(SQLException, RuntimeException)
509 {
510 	return sal_False;
511 }
512 // -------------------------------------------------------------------------
supportsOpenStatementsAcrossRollback()513 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenStatementsAcrossRollback(  ) throw(SQLException, RuntimeException)
514 {
515 	return sal_False;
516 }
517 // -------------------------------------------------------------------------
supportsOpenStatementsAcrossCommit()518 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenStatementsAcrossCommit(  ) throw(SQLException, RuntimeException)
519 {
520 	return sal_False;
521 }
522 // -------------------------------------------------------------------------
supportsOpenCursorsAcrossCommit()523 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenCursorsAcrossCommit(  ) throw(SQLException, RuntimeException)
524 {
525 	return sal_False;
526 }
527 // -------------------------------------------------------------------------
supportsOpenCursorsAcrossRollback()528 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOpenCursorsAcrossRollback(  ) throw(SQLException, RuntimeException)
529 {
530 	return sal_False;
531 }
532 // -------------------------------------------------------------------------
supportsTransactionIsolationLevel(sal_Int32)533 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException)
534 {
535 	return sal_False;
536 }
537 // -------------------------------------------------------------------------
impl_supportsSchemasInDataManipulation_throw()538 sal_Bool OEvoabDatabaseMetaData::impl_supportsSchemasInDataManipulation_throw(  )
539 {
540 	return sal_False;
541 }
542 // -------------------------------------------------------------------------
supportsANSI92FullSQL()543 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsANSI92FullSQL(  ) throw(SQLException, RuntimeException)
544 {
545 	return sal_False;
546 }
547 // -------------------------------------------------------------------------
supportsANSI92EntryLevelSQL()548 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsANSI92EntryLevelSQL(  ) throw(SQLException, RuntimeException)
549 {
550 	return sal_True; // should be supported at least
551 }
552 // -------------------------------------------------------------------------
supportsIntegrityEnhancementFacility()553 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsIntegrityEnhancementFacility(  ) throw(SQLException, RuntimeException)
554 {
555 	return sal_False;
556 }
557 // -------------------------------------------------------------------------
supportsSchemasInIndexDefinitions()558 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSchemasInIndexDefinitions(  ) throw(SQLException, RuntimeException)
559 {
560 	return sal_False;
561 }
562 // -------------------------------------------------------------------------
impl_supportsSchemasInTableDefinitions_throw()563 sal_Bool OEvoabDatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw(  )
564 {
565 	return sal_False;
566 }
567 // -------------------------------------------------------------------------
impl_supportsCatalogsInTableDefinitions_throw()568 sal_Bool OEvoabDatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw(  )
569 {
570 	return sal_False;
571 }
572 // -------------------------------------------------------------------------
supportsCatalogsInIndexDefinitions()573 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCatalogsInIndexDefinitions(  ) throw(SQLException, RuntimeException)
574 {
575 	return sal_False;
576 }
577 // -------------------------------------------------------------------------
impl_supportsCatalogsInDataManipulation_throw()578 sal_Bool OEvoabDatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw(  )
579 {
580 	return sal_False;
581 }
582 // -------------------------------------------------------------------------
supportsOuterJoins()583 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOuterJoins(  ) throw(SQLException, RuntimeException)
584 {
585 	return sal_False;
586 }
587 // -------------------------------------------------------------------------
getMaxStatementLength()588 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxStatementLength(  ) throw(SQLException, RuntimeException)
589 {
590 	return 0;// 0 means no limit
591 }
592 // -------------------------------------------------------------------------
getMaxProcedureNameLength()593 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxProcedureNameLength(  ) throw(SQLException, RuntimeException)
594 {
595 	return 0;// 0 means no limit
596 }
597 // -------------------------------------------------------------------------
getMaxSchemaNameLength()598 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxSchemaNameLength(  ) throw(SQLException, RuntimeException)
599 {
600 	return 0;// 0 means no limit
601 }
602 // -------------------------------------------------------------------------
supportsTransactions()603 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTransactions(  ) throw(SQLException, RuntimeException)
604 {
605 	return sal_False;
606 }
607 // -------------------------------------------------------------------------
allProceduresAreCallable()608 sal_Bool SAL_CALL OEvoabDatabaseMetaData::allProceduresAreCallable(  ) throw(SQLException, RuntimeException)
609 {
610 	return sal_False;
611 }
612 // -------------------------------------------------------------------------
supportsStoredProcedures()613 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsStoredProcedures(  ) throw(SQLException, RuntimeException)
614 {
615 	return sal_False;
616 }
617 // -------------------------------------------------------------------------
supportsSelectForUpdate()618 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSelectForUpdate(  ) throw(SQLException, RuntimeException)
619 {
620 	return sal_False;
621 }
622 // -------------------------------------------------------------------------
allTablesAreSelectable()623 sal_Bool SAL_CALL OEvoabDatabaseMetaData::allTablesAreSelectable(  ) throw(SQLException, RuntimeException)
624 {
625     // We allow you to select from any table.
626 	return sal_True;
627 }
628 // -------------------------------------------------------------------------
isReadOnly()629 sal_Bool SAL_CALL OEvoabDatabaseMetaData::isReadOnly(  ) throw(SQLException, RuntimeException)
630 {
631     // For now definitely read-only, no support for update/delete
632 	return sal_True;
633 }
634 // -------------------------------------------------------------------------
usesLocalFiles()635 sal_Bool SAL_CALL OEvoabDatabaseMetaData::usesLocalFiles(  ) throw(SQLException, RuntimeException)
636 {
637 	return sal_False;
638 }
639 // -------------------------------------------------------------------------
usesLocalFilePerTable()640 sal_Bool SAL_CALL OEvoabDatabaseMetaData::usesLocalFilePerTable(  ) throw(SQLException, RuntimeException)
641 {
642 	return sal_False;
643 }
644 // -------------------------------------------------------------------------
supportsTypeConversion()645 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTypeConversion(  ) throw(SQLException, RuntimeException)
646 {
647 	return sal_False;
648 }
649 // -------------------------------------------------------------------------
nullPlusNonNullIsNull()650 sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullPlusNonNullIsNull(  ) throw(SQLException, RuntimeException)
651 {
652 	return sal_False;
653 }
654 // -------------------------------------------------------------------------
supportsColumnAliasing()655 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsColumnAliasing(  ) throw(SQLException, RuntimeException)
656 {
657     // todo add Support for this.
658 	return sal_False;
659 }
660 // -------------------------------------------------------------------------
supportsTableCorrelationNames()661 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsTableCorrelationNames(  ) throw(SQLException, RuntimeException)
662 {
663 	return sal_False;
664 }
665 // -------------------------------------------------------------------------
supportsConvert(sal_Int32,sal_Int32)666 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException)
667 {
668 	return sal_False;
669 }
670 // -------------------------------------------------------------------------
supportsExpressionsInOrderBy()671 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsExpressionsInOrderBy(  ) throw(SQLException, RuntimeException)
672 {
673 	return sal_False;
674 }
675 // -------------------------------------------------------------------------
supportsGroupBy()676 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsGroupBy(  ) throw(SQLException, RuntimeException)
677 {
678 	return sal_False;
679 }
680 // -------------------------------------------------------------------------
supportsGroupByBeyondSelect()681 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsGroupByBeyondSelect(  ) throw(SQLException, RuntimeException)
682 {
683 	return sal_False;
684 }
685 // -------------------------------------------------------------------------
supportsGroupByUnrelated()686 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsGroupByUnrelated(  ) throw(SQLException, RuntimeException)
687 {
688 	return sal_False;
689 }
690 // -------------------------------------------------------------------------
supportsMultipleTransactions()691 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMultipleTransactions(  ) throw(SQLException, RuntimeException)
692 {
693 	return sal_False;
694 }
695 // -------------------------------------------------------------------------
supportsMultipleResultSets()696 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMultipleResultSets(  ) throw(SQLException, RuntimeException)
697 {
698 	return sal_False;
699 }
700 // -------------------------------------------------------------------------
supportsLikeEscapeClause()701 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsLikeEscapeClause(  ) throw(SQLException, RuntimeException)
702 {
703 	return sal_False;
704 }
705 // -------------------------------------------------------------------------
supportsOrderByUnrelated()706 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsOrderByUnrelated(  ) throw(SQLException, RuntimeException)
707 {
708 	return sal_False;
709 }
710 // -------------------------------------------------------------------------
supportsUnion()711 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsUnion(  ) throw(SQLException, RuntimeException)
712 {
713 	return sal_False;
714 }
715 // -------------------------------------------------------------------------
supportsUnionAll()716 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsUnionAll(  ) throw(SQLException, RuntimeException)
717 {
718 	return sal_False;
719 }
720 // -------------------------------------------------------------------------
supportsMixedCaseIdentifiers()721 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMixedCaseIdentifiers(  ) throw(SQLException, RuntimeException)
722 {
723 	return sal_False;
724 }
725 // -------------------------------------------------------------------------
impl_supportsMixedCaseQuotedIdentifiers_throw()726 sal_Bool OEvoabDatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw(  )
727 {
728     // Any case may be used
729 	return sal_True;
730 }
731 // -------------------------------------------------------------------------
nullsAreSortedAtEnd()732 sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedAtEnd(  ) throw(SQLException, RuntimeException)
733 {
734 	return sal_False;
735 }
736 // -------------------------------------------------------------------------
nullsAreSortedAtStart()737 sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedAtStart(  ) throw(SQLException, RuntimeException)
738 {
739 	return sal_True;
740 }
741 // -------------------------------------------------------------------------
nullsAreSortedHigh()742 sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedHigh(  ) throw(SQLException, RuntimeException)
743 {
744 	return sal_False;
745 }
746 // -------------------------------------------------------------------------
nullsAreSortedLow()747 sal_Bool SAL_CALL OEvoabDatabaseMetaData::nullsAreSortedLow(  ) throw(SQLException, RuntimeException)
748 {
749 	return sal_True;
750 }
751 // -------------------------------------------------------------------------
supportsSchemasInProcedureCalls()752 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSchemasInProcedureCalls(  ) throw(SQLException, RuntimeException)
753 {
754 	return sal_False;
755 }
756 // -------------------------------------------------------------------------
supportsSchemasInPrivilegeDefinitions()757 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSchemasInPrivilegeDefinitions(  ) throw(SQLException, RuntimeException)
758 {
759 	return sal_False;
760 }
761 // -------------------------------------------------------------------------
supportsCatalogsInProcedureCalls()762 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCatalogsInProcedureCalls(  ) throw(SQLException, RuntimeException)
763 {
764 	return sal_False;
765 }
766 // -------------------------------------------------------------------------
supportsCatalogsInPrivilegeDefinitions()767 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCatalogsInPrivilegeDefinitions(  ) throw(SQLException, RuntimeException)
768 {
769 	return sal_False;
770 }
771 // -------------------------------------------------------------------------
supportsCorrelatedSubqueries()772 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCorrelatedSubqueries(  ) throw(SQLException, RuntimeException)
773 {
774 	return sal_False;
775 }
776 // -------------------------------------------------------------------------
supportsSubqueriesInComparisons()777 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInComparisons(  ) throw(SQLException, RuntimeException)
778 {
779 	return sal_False;
780 }
781 // -------------------------------------------------------------------------
supportsSubqueriesInExists()782 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInExists(  ) throw(SQLException, RuntimeException)
783 {
784 	return sal_False;
785 }
786 // -------------------------------------------------------------------------
supportsSubqueriesInIns()787 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInIns(  ) throw(SQLException, RuntimeException)
788 {
789 	return sal_False;
790 }
791 // -------------------------------------------------------------------------
supportsSubqueriesInQuantifieds()792 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsSubqueriesInQuantifieds(  ) throw(SQLException, RuntimeException)
793 {
794 	return sal_False;
795 }
796 // -------------------------------------------------------------------------
supportsANSI92IntermediateSQL()797 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsANSI92IntermediateSQL(  ) throw(SQLException, RuntimeException)
798 {
799 	return sal_False;
800 }
801 // -------------------------------------------------------------------------
getURL()802 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getURL(  ) throw(SQLException, RuntimeException)
803 {
804     ::osl::MutexGuard aGuard( m_aMutex );
805 
806     return m_pConnection->getURL();
807 }
808 // -------------------------------------------------------------------------
getUserName()809 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getUserName(  ) throw(SQLException, RuntimeException)
810 {
811 	::rtl::OUString aValue;
812 	return aValue;
813 }
814 // -------------------------------------------------------------------------
getDriverName()815 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDriverName(  ) throw(SQLException, RuntimeException)
816 {
817 	::rtl::OUString aValue;
818 	return aValue;
819 }
820 // -------------------------------------------------------------------------
getDriverVersion()821 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
822 {
823 	::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)1);
824 	return aValue;
825 }
826 // -------------------------------------------------------------------------
getDatabaseProductVersion()827 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDatabaseProductVersion(  ) throw(SQLException, RuntimeException)
828 {
829 	::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)0);
830 	return aValue;
831 }
832 // -------------------------------------------------------------------------
getDatabaseProductName()833 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getDatabaseProductName(  ) throw(SQLException, RuntimeException)
834 {
835 	::rtl::OUString aValue;
836 	return aValue;
837 }
838 // -------------------------------------------------------------------------
getProcedureTerm()839 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getProcedureTerm(  ) throw(SQLException, RuntimeException)
840 {
841 	::rtl::OUString aValue;
842 	return aValue;
843 }
844 // -------------------------------------------------------------------------
getSchemaTerm()845 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSchemaTerm(  ) throw(SQLException, RuntimeException)
846 {
847 	::rtl::OUString aValue;
848 	return aValue;
849 }
850 // -------------------------------------------------------------------------
getDriverMajorVersion()851 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getDriverMajorVersion(  ) throw(RuntimeException)
852 {
853 	return 1;
854 }
855 // -------------------------------------------------------------------------
getDefaultTransactionIsolation()856 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getDefaultTransactionIsolation(  ) throw(SQLException, RuntimeException)
857 {
858 	return TransactionIsolation::NONE;
859 }
860 // -------------------------------------------------------------------------
getDriverMinorVersion()861 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getDriverMinorVersion(  ) throw(RuntimeException)
862 {
863 	return 0;
864 }
865 // -------------------------------------------------------------------------
getSQLKeywords()866 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSQLKeywords(  ) throw(SQLException, RuntimeException)
867 {
868 	::rtl::OUString aValue;
869 	return aValue;
870 }
871 // -------------------------------------------------------------------------
getSearchStringEscape()872 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSearchStringEscape(  ) throw(SQLException, RuntimeException)
873 {
874 	::rtl::OUString aValue;
875 	return aValue;
876 }
877 // -------------------------------------------------------------------------
getStringFunctions()878 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getStringFunctions(  ) throw(SQLException, RuntimeException)
879 {
880 	return ::rtl::OUString();
881 }
882 // -------------------------------------------------------------------------
getTimeDateFunctions()883 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getTimeDateFunctions(  ) throw(SQLException, RuntimeException)
884 {
885 	return ::rtl::OUString();
886 }
887 // -------------------------------------------------------------------------
getSystemFunctions()888 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getSystemFunctions(  ) throw(SQLException, RuntimeException)
889 {
890 	return ::rtl::OUString();
891 }
892 // -------------------------------------------------------------------------
getNumericFunctions()893 ::rtl::OUString SAL_CALL OEvoabDatabaseMetaData::getNumericFunctions(  ) throw(SQLException, RuntimeException)
894 {
895 	return ::rtl::OUString();
896 }
897 // -------------------------------------------------------------------------
supportsExtendedSQLGrammar()898 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsExtendedSQLGrammar(  ) throw(SQLException, RuntimeException)
899 {
900 	return sal_False;
901 }
902 // -------------------------------------------------------------------------
supportsCoreSQLGrammar()903 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsCoreSQLGrammar(  ) throw(SQLException, RuntimeException)
904 {
905 	return sal_False;
906 }
907 // -------------------------------------------------------------------------
supportsMinimumSQLGrammar()908 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsMinimumSQLGrammar(  ) throw(SQLException, RuntimeException)
909 {
910 	return sal_True;
911 }
912 // -------------------------------------------------------------------------
supportsFullOuterJoins()913 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsFullOuterJoins(  ) throw(SQLException, RuntimeException)
914 {
915 	return sal_False;
916 }
917 // -------------------------------------------------------------------------
supportsLimitedOuterJoins()918 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsLimitedOuterJoins(  ) throw(SQLException, RuntimeException)
919 {
920 	return sal_False;
921 }
922 // -------------------------------------------------------------------------
getMaxColumnsInGroupBy()923 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInGroupBy(  ) throw(SQLException, RuntimeException)
924 {
925 	return 0;// 0 means no limit
926 }
927 // -------------------------------------------------------------------------
getMaxColumnsInOrderBy()928 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInOrderBy(  ) throw(SQLException, RuntimeException)
929 {
930 	return 0;// 0 means no limit
931 }
932 // -------------------------------------------------------------------------
getMaxColumnsInSelect()933 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxColumnsInSelect(  ) throw(SQLException, RuntimeException)
934 {
935 	return 0;// 0 means no limit
936 }
937 // -------------------------------------------------------------------------
getMaxUserNameLength()938 sal_Int32 SAL_CALL OEvoabDatabaseMetaData::getMaxUserNameLength(  ) throw(SQLException, RuntimeException)
939 {
940 	return 0;// 0 means no limit
941 }
942 // -------------------------------------------------------------------------
supportsResultSetType(sal_Int32)943 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
944 {
945 	return sal_False;
946 }
947 // -------------------------------------------------------------------------
supportsResultSetConcurrency(sal_Int32,sal_Int32)948 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException)
949 {
950 	return sal_False;
951 }
952 // -------------------------------------------------------------------------
ownUpdatesAreVisible(sal_Int32)953 sal_Bool SAL_CALL OEvoabDatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
954 {
955 	return sal_False;
956 }
957 // -------------------------------------------------------------------------
ownDeletesAreVisible(sal_Int32)958 sal_Bool SAL_CALL OEvoabDatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
959 {
960 	return sal_False;
961 }
962 // -------------------------------------------------------------------------
ownInsertsAreVisible(sal_Int32)963 sal_Bool SAL_CALL OEvoabDatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
964 {
965 	return sal_False;
966 }
967 // -------------------------------------------------------------------------
othersUpdatesAreVisible(sal_Int32)968 sal_Bool SAL_CALL OEvoabDatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
969 {
970 	return sal_False;
971 }
972 // -------------------------------------------------------------------------
othersDeletesAreVisible(sal_Int32)973 sal_Bool SAL_CALL OEvoabDatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
974 {
975 	return sal_False;
976 }
977 // -------------------------------------------------------------------------
othersInsertsAreVisible(sal_Int32)978 sal_Bool SAL_CALL OEvoabDatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
979 {
980 	return sal_False;
981 }
982 // -------------------------------------------------------------------------
updatesAreDetected(sal_Int32)983 sal_Bool SAL_CALL OEvoabDatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
984 {
985 	return sal_False;
986 }
987 // -------------------------------------------------------------------------
deletesAreDetected(sal_Int32)988 sal_Bool SAL_CALL OEvoabDatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
989 {
990 	return sal_False;
991 }
992 // -------------------------------------------------------------------------
insertsAreDetected(sal_Int32)993 sal_Bool SAL_CALL OEvoabDatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
994 {
995 	return sal_False;
996 }
997 // -------------------------------------------------------------------------
supportsBatchUpdates()998 sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsBatchUpdates(  ) throw(SQLException, RuntimeException)
999 {
1000 	return sal_False;
1001 }
1002 // -------------------------------------------------------------------------
1003 // here follow all methods which return a resultset
1004 // the first methods is an example implementation how to use this resultset
1005 // of course you could implement it on your and you should do this because
1006 // the general way is more memory expensive
1007 // -------------------------------------------------------------------------
getTableTypes()1008 Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes(  ) throw(SQLException, RuntimeException)
1009 {
1010 	/* Dont need to change as evoab driver supports only table */
1011 
1012 	// there exists no possibility to get table types so we have to check
1013 	static ::rtl::OUString sTableTypes[] =
1014 	{
1015 		::rtl::OUString::createFromAscii("TABLE"),
1016         // Currently we only support a 'TABLE' nothing more complex
1017 	};
1018     ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
1019 	Reference< XResultSet > xRef = pResult;
1020 
1021 	// here we fill the rows which should be visible when ask for data from the resultset returned here
1022 	sal_Int32  nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString);
1023 	ODatabaseMetaDataResultSet::ORows aRows;
1024 	for(sal_Int32 i=0;i < nSize;++i)
1025 	{
1026 		ODatabaseMetaDataResultSet::ORow aRow;
1027 		aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
1028 		aRow.push_back(new ORowSetValueDecorator(sTableTypes[i]));
1029 
1030 		// bound row
1031 		aRows.push_back(aRow);
1032 	}
1033 	// here we set the rows at the resultset
1034 	pResult->setRows(aRows);
1035 	return xRef;
1036 }
1037 // -------------------------------------------------------------------------
impl_getTypeInfo_throw()1038 Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw(  )
1039 {
1040 	/*
1041 	 * Return the proper type information required by evo driver
1042 	 */
1043 
1044 	ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
1045 
1046 	Reference< XResultSet > xResultSet = pResultSet;
1047 	static ODatabaseMetaDataResultSet::ORows aRows;
1048 
1049 	if(aRows.empty())
1050 	{
1051 		ODatabaseMetaDataResultSet::ORow aRow;
1052 		aRow.reserve(19);
1053 		aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
1054 		aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")));
1055 		aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
1056 		aRow.push_back(new ORowSetValueDecorator((sal_Int32)s_nCHAR_OCTET_LENGTH));
1057 		aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
1058 		aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
1059 		aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
1060 		// aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
1061 		aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
1062 		aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
1063 		aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::FULL));
1064 		aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
1065 		aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
1066 		aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
1067 		aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
1068 		aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
1069 		aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
1070 		aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
1071 		aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
1072 		aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
1073 
1074 		aRows.push_back(aRow);
1075 
1076 		aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR"));
1077 		aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR);
1078 		aRow[3] = new ORowSetValueDecorator((sal_Int32)65535);
1079 		aRows.push_back(aRow);
1080 	}
1081 	pResultSet->setRows(aRows);
1082 	return xResultSet;
1083 }
1084 // -------------------------------------------------------------------------
getColumns(const Any &,const::rtl::OUString &,const::rtl::OUString &,const::rtl::OUString & columnNamePattern)1085 Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns(
1086 	const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*tableNamePattern*/,
1087 	const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
1088 {
1089 	// this returns an empty resultset where the column-names are already set
1090 	// in special the metadata of the resultset already returns the right columns
1091     ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns );
1092 	Reference< XResultSet > xResultSet = pResultSet;
1093 	pResultSet->setRows( getColumnRows( columnNamePattern ) );
1094 	return xResultSet;
1095 }
1096 // -------------------------------------------------------------------------
getTables(const Any &,const::rtl::OUString &,const::rtl::OUString &,const Sequence<::rtl::OUString> & types)1097 Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables(
1098 	const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/,
1099 	const ::rtl::OUString& /*tableNamePattern*/, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
1100 {
1101 	::osl::MutexGuard aGuard( m_aMutex );
1102 
1103 	ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
1104 	Reference< XResultSet > xRef = pResult;
1105 
1106 	// check if any type is given
1107 	// when no types are given then we have to return all tables e.g. TABLE
1108 
1109 	const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE"));
1110 
1111 	sal_Bool bTableFound = sal_True;
1112 	sal_Int32 nLength = types.getLength();
1113 	if(nLength)
1114 		{
1115 			bTableFound = sal_False;
1116 
1117 			const ::rtl::OUString* pBegin = types.getConstArray();
1118 			const ::rtl::OUString* pEnd	= pBegin + nLength;
1119 			for(;pBegin != pEnd;++pBegin)
1120 				{
1121 					if(*pBegin == aTable)
1122 						{
1123 							bTableFound = sal_True;
1124 							break;
1125 						}
1126 				}
1127 		}
1128 	if(!bTableFound)
1129 		return xRef;
1130 
1131 	ODatabaseMetaDataResultSet::ORows aRows;
1132 
1133 	ESourceList *pSourceList;
1134 	if( !e_book_get_addressbooks (&pSourceList, NULL) )
1135 			pSourceList = NULL;
1136 
1137 	GSList *g;
1138 	for( g = e_source_list_peek_groups( pSourceList ); g; g = g->next)
1139 	{
1140 		GSList *s;
1141 		const char *p = e_source_group_peek_base_uri(E_SOURCE_GROUP(g->data));
1142 
1143 		switch (m_pConnection->getSDBCAddressType()) {
1144 		case SDBCAddress::EVO_GWISE:
1145 					if (0==strncmp( "groupwise://", p, 11 ))
1146 						break;
1147 					else
1148 						continue;
1149 		case SDBCAddress::EVO_LOCAL:
1150 					if (0==strncmp( "file://", p, 6 ))
1151 						break;
1152 					else
1153 						continue;
1154 		case SDBCAddress::EVO_LDAP:
1155 					if (0==strncmp( "ldap://", p, 6 ))
1156 						break;
1157 					else
1158 						continue;
1159         case SDBCAddress::Unknown:
1160             break;
1161 		}
1162 		for (s = e_source_group_peek_sources (E_SOURCE_GROUP (g->data)); s; s = s->next)
1163 		{
1164 			ESource *pSource = E_SOURCE (s->data);
1165 
1166 			rtl::OUString aName = rtl::OStringToOUString( e_source_peek_name( pSource ),
1167 														  RTL_TEXTENCODING_UTF8 );
1168 
1169 			ODatabaseMetaDataResultSet::ORow aRow(3);
1170 			aRow.reserve(6);
1171 			aRow.push_back(new ORowSetValueDecorator(aName));
1172 			aRow.push_back(new ORowSetValueDecorator(aTable));
1173 			aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
1174 			aRows.push_back(aRow);
1175 		}
1176 	}
1177 
1178 	pResult->setRows(aRows);
1179 
1180 	return xRef;
1181 }
1182 // -------------------------------------------------------------------------
getUDTs(const Any &,const::rtl::OUString &,const::rtl::OUString &,const Sequence<sal_Int32> &)1183 Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException)
1184 {
1185     ::dbtools::throwFeatureNotImplementedException( "XDatabaseMetaDaza::getUDTs", *this );
1186     return NULL;
1187 }
1188 // -----------------------------------------------------------------------------
1189