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 #include "java/sql/DatabaseMetaData.hxx"
31 #include "java/sql/Connection.hxx"
32 #include "java/sql/ResultSet.hxx"
33 #include "java/tools.hxx"
34 #include "java/lang/String.hxx"
35 #include "connectivity/CommonTools.hxx"
36 #include "FDatabaseMetaDataResultSet.hxx"
37 #include <comphelper/types.hxx>
38 #include "TPrivilegesResultSet.hxx"
39 #include "diagnose_ex.h"
40 #include "resource/jdbc_log.hrc"
41 
42 using namespace ::comphelper;
43 
44 using namespace connectivity;
45 using namespace ::com::sun::star::uno;
46 using namespace ::com::sun::star::beans;
47 using namespace ::com::sun::star::sdbc;
48 using namespace ::com::sun::star::container;
49 using namespace ::com::sun::star::lang;
50 
51 //**************************************************************
52 //************ Class: java.sql.DatabaseMetaData
53 //**************************************************************
54 
55 jclass java_sql_DatabaseMetaData::theClass				= 0;
56 
57 java_sql_DatabaseMetaData::~java_sql_DatabaseMetaData()
58 {
59 	SDBThreadAttach::releaseRef();
60 }
61 
62 jclass java_sql_DatabaseMetaData::getMyClass() const
63 {
64 	// die Klasse muss nur einmal geholt werden, daher statisch
65 	if( !theClass )
66         theClass = findMyClass("java/sql/DatabaseMetaData");
67 	return theClass;
68 }
69 // -----------------------------------------------------------------------------
70 java_sql_DatabaseMetaData::java_sql_DatabaseMetaData( JNIEnv * pEnv, jobject myObj, java_sql_Connection& _rConnection )
71     :ODatabaseMetaDataBase( &_rConnection,_rConnection.getConnectionInfo() )
72     ,java_lang_Object( pEnv, myObj )
73 	,m_pConnection( &_rConnection )
74     ,m_aLogger( _rConnection.getLogger() )
75 {
76 	SDBThreadAttach::addRef();
77 }
78 
79 // -------------------------------------------------------------------------
80 Reference< XResultSet > java_sql_DatabaseMetaData::impl_getTypeInfo_throw(  )
81 {
82 	static jmethodID mID(NULL);
83     return impl_callResultSetMethod( "getTypeInfo", mID );
84 }
85 // -------------------------------------------------------------------------
86 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCatalogs(  ) throw(SQLException, RuntimeException)
87 {
88 	static jmethodID mID(NULL);
89     return impl_callResultSetMethod( "getCatalogs", mID );
90 }
91 // -------------------------------------------------------------------------
92 ::rtl::OUString java_sql_DatabaseMetaData::impl_getCatalogSeparator_throw(  )
93 {
94 	static jmethodID mID(NULL);
95     return impl_callStringMethod( "getCatalogSeparator", mID );
96 }
97 // -------------------------------------------------------------------------
98 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getSchemas(  ) throw(SQLException, RuntimeException)
99 {
100 	static jmethodID mID(NULL);
101     return impl_callResultSetMethod( "getSchemas", mID );
102 }
103 // -------------------------------------------------------------------------
104 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumnPrivileges(
105         const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
106 {
107 	static jmethodID mID(NULL);
108     return impl_callResultSetMethodWithStrings( "getColumnPrivileges", mID, catalog, schema, table, &columnNamePattern );
109 }
110 // -------------------------------------------------------------------------
111 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumns(
112         const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
113 {
114 	static jmethodID mID(NULL);
115     return impl_callResultSetMethodWithStrings( "getColumns", mID, catalog, schemaPattern, tableNamePattern, &columnNamePattern );
116 }
117 
118 // -------------------------------------------------------------------------
119 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
120         const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& _types ) throw(SQLException, RuntimeException)
121 {
122 	static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;";
123 	static const char * cMethodName = "getTables";
124 
125     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
126 
127     jobject out(0);
128     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
129 
130     {
131 		// Java-Call absetzen
132 		static jmethodID mID(NULL);
133         obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
134 		OSL_VERIFY_RES( !isExceptionOccured(t.pEnv,sal_True),"Exception occured!");
135 		jvalue args[4];
136 
137 		args[3].l = 0;
138         sal_Int32 typeFilterCount = _types.getLength();
139         if ( typeFilterCount )
140         {
141             jobjectArray pObjArray = static_cast< jobjectArray >( t.pEnv->NewObjectArray( (jsize)typeFilterCount, java_lang_String::st_getMyClass(), 0 ) );
142             OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" );
143             const ::rtl::OUString* typeFilter = _types.getConstArray();
144             bool bIncludeAllTypes = false;
145             for ( sal_Int32 i=0; i<typeFilterCount; ++i, ++typeFilter )
146             {
147                 if ( typeFilter->equalsAsciiL( "%", 1 ) )
148                 {
149                     bIncludeAllTypes = true;
150                     break;
151                 }
152                 jstring aT = convertwchar_tToJavaString( t.pEnv, *typeFilter );
153                 t.pEnv->SetObjectArrayElement( pObjArray, (jsize)i, aT );
154                 OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" );
155             }
156 
157             if ( bIncludeAllTypes )
158             {
159                 // the SDBC API allows to pass "%" as table type filter, but in JDBC, "all table types"
160                 // is represented by the table type being <null/>
161                 t.pEnv->DeleteLocalRef( pObjArray );
162                 OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" );
163             }
164             else
165             {
166                 args[3].l = pObjArray;
167             }
168         }
169         // if we are to display "all catalogs", then respect m_aCatalogRestriction
170         Any aCatalogFilter( catalog );
171         if ( !aCatalogFilter.hasValue() )
172             aCatalogFilter = m_pConnection->getCatalogRestriction();
173         // similar for schema
174         Any aSchemaFilter;
175         if ( schemaPattern.equalsAsciiL( "%", 1 ) )
176             aSchemaFilter = m_pConnection->getSchemaRestriction();
177         else
178             aSchemaFilter <<= schemaPattern;
179 
180         args[0].l = aCatalogFilter.hasValue() ? convertwchar_tToJavaString( t.pEnv, ::comphelper::getString( aCatalogFilter ) ) : NULL;
181         args[1].l = aSchemaFilter.hasValue() ? convertwchar_tToJavaString( t.pEnv, ::comphelper::getString( aSchemaFilter ) ) : NULL;
182         args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern);
183         out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l);
184         jthrowable jThrow = t.pEnv->ExceptionOccurred();
185         if ( jThrow )
186             t.pEnv->ExceptionClear();// we have to clear the exception here because we want to handle it below
187         if ( aCatalogFilter.hasValue() )
188         {
189             t.pEnv->DeleteLocalRef((jstring)args[0].l);
190             OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" );
191         }
192         if(args[1].l)
193         {
194             t.pEnv->DeleteLocalRef((jstring)args[1].l);
195             OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" );
196         }
197         if(tableNamePattern.getLength())
198         {
199             t.pEnv->DeleteLocalRef((jstring)args[2].l);
200             OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" );
201         }
202         //for(INT16 i=0;i<len;i++)
203         if ( args[3].l )
204         {
205             t.pEnv->DeleteLocalRef( (jobjectArray)args[3].l );
206             OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" );
207         }
208 
209         if ( jThrow )
210         {
211             if ( t.pEnv->IsInstanceOf( jThrow,java_sql_SQLException_BASE::st_getMyClass() ) )
212             {
213                 java_sql_SQLException_BASE* pException = new java_sql_SQLException_BASE( t.pEnv, jThrow );
214                 SQLException e(	pException->getMessage(),
215                                     *this,
216                                     pException->getSQLState(),
217                                     pException->getErrorCode(),
218                                     Any()
219                                 );
220                 delete pException;
221                 throw  e;
222             }
223         }
224 	}
225 
226     if ( !out )
227         return NULL;
228 
229     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, cMethodName );
230 	return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
231 }
232 // -------------------------------------------------------------------------
233 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedureColumns(
234         const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
235 {
236 	static jmethodID mID(NULL);
237     return impl_callResultSetMethodWithStrings( "getProcedureColumns", mID, catalog, schemaPattern, procedureNamePattern, &columnNamePattern );
238 }
239 // -------------------------------------------------------------------------
240 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedures( const Any&
241                 catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException)
242 {
243 	static jmethodID mID(NULL);
244     return impl_callResultSetMethodWithStrings( "getProcedures", mID, catalog, schemaPattern, procedureNamePattern );
245 }
246 // -------------------------------------------------------------------------
247 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getVersionColumns(
248         const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
249 {
250 	static jmethodID mID(NULL);
251     return impl_callResultSetMethodWithStrings( "getVersionColumns", mID, catalog, schema, table );
252 }
253 // -------------------------------------------------------------------------
254 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxBinaryLiteralLength(  ) throw(SQLException, RuntimeException)
255 {
256 	static jmethodID mID(NULL);
257     return impl_callIntMethod( "getMaxBinaryLiteralLength", mID );
258 }
259 // -------------------------------------------------------------------------
260 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxRowSize(  ) throw(SQLException, RuntimeException)
261 {
262 	static jmethodID mID(NULL);
263     return impl_callIntMethod( "getMaxRowSize", mID );
264 }
265 // -------------------------------------------------------------------------
266 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCatalogNameLength(  ) throw(SQLException, RuntimeException)
267 {
268 	static jmethodID mID(NULL);
269     return impl_callIntMethod( "getMaxCatalogNameLength", mID );
270 }
271 // -------------------------------------------------------------------------
272 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCharLiteralLength(  ) throw(SQLException, RuntimeException)
273 {
274 	static jmethodID mID(NULL);
275     return impl_callIntMethod( "getMaxCharLiteralLength", mID );
276 }
277 // -------------------------------------------------------------------------
278 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnNameLength(  ) throw(SQLException, RuntimeException)
279 {
280 	static jmethodID mID(NULL);
281     return impl_callIntMethod( "getMaxColumnNameLength", mID );
282 }
283 // -------------------------------------------------------------------------
284 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInIndex(  ) throw(SQLException, RuntimeException)
285 {
286 	static jmethodID mID(NULL);
287     return impl_callIntMethod( "getMaxColumnsInIndex", mID );
288 }
289 // -------------------------------------------------------------------------
290 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCursorNameLength(  ) throw(SQLException, RuntimeException)
291 {
292 	static jmethodID mID(NULL);
293     return impl_callIntMethod( "getMaxCursorNameLength", mID );
294 }
295 // -------------------------------------------------------------------------
296 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxConnections(  ) throw(SQLException, RuntimeException)
297 {
298 	static jmethodID mID(NULL);
299     return impl_callIntMethod( "getMaxConnections", mID );
300 }
301 // -------------------------------------------------------------------------
302 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInTable(  ) throw(SQLException, RuntimeException)
303 {
304 	static jmethodID mID(NULL);
305     return impl_callIntMethod( "getMaxColumnsInTable", mID );
306 }
307 // -------------------------------------------------------------------------
308 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxStatementLength(  ) throw(SQLException, RuntimeException)
309 {
310 	static jmethodID mID(NULL);
311     return impl_callIntMethod( "getMaxStatementLength", mID );
312 }
313 // -------------------------------------------------------------------------
314 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxTableNameLength(  ) throw(SQLException, RuntimeException)
315 {
316 	static jmethodID mID(NULL);
317     return impl_callIntMethod( "getMaxTableNameLength", mID );
318 }
319 // -------------------------------------------------------------------------
320 sal_Int32 java_sql_DatabaseMetaData::impl_getMaxTablesInSelect_throw(  )
321 {
322 	static jmethodID mID(NULL);
323     return impl_callIntMethod( "getMaxTablesInSelect", mID );
324 }
325 // -------------------------------------------------------------------------
326 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getExportedKeys(
327         const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
328 {
329 	static jmethodID mID(NULL);
330     return impl_callResultSetMethodWithStrings( "getExportedKeys", mID, catalog, schema, table );
331 }
332 // -------------------------------------------------------------------------
333 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getImportedKeys(
334         const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
335 {
336 	static jmethodID mID(NULL);
337     return impl_callResultSetMethodWithStrings( "getImportedKeys", mID, catalog, schema, table );
338 }
339 // -------------------------------------------------------------------------
340 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getPrimaryKeys(
341         const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
342 {
343 	static jmethodID mID(NULL);
344     return impl_callResultSetMethodWithStrings( "getPrimaryKeys", mID, catalog, schema, table );
345 }
346 // -------------------------------------------------------------------------
347 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo(
348         const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
349         sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException)
350 {
351 	static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/sql/ResultSet;";
352 	static const char * cMethodName = "getIndexInfo";
353 
354     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
355 
356     jobject out(0);
357     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
358 
359     {
360 		// Java-Call absetzen
361 		static jmethodID mID(NULL);
362         obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
363 		jvalue args[5];
364 		// Parameter konvertieren
365 		args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
366 		args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
367 		args[2].l = convertwchar_tToJavaString(t.pEnv,table);
368 		args[3].z = unique;
369 		args[4].z = approximate;
370 		out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,args[3].z,args[4].z );
371 
372 		// und aufraeumen
373 		if(catalog.hasValue())
374 			t.pEnv->DeleteLocalRef((jstring)args[0].l);
375 		if(args[1].l)
376 			t.pEnv->DeleteLocalRef((jstring)args[1].l);
377 		if(table.getLength())
378 			t.pEnv->DeleteLocalRef((jstring)args[2].l);
379 		ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
380 	}
381     if ( !out )
382         return NULL;
383 
384     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, cMethodName );
385 	return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
386 }
387 // -------------------------------------------------------------------------
388 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier(
389         const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope,
390         sal_Bool nullable ) throw(SQLException, RuntimeException)
391 {
392 	static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZ)Ljava/sql/ResultSet;";
393 	static const char * cMethodName = "getBestRowIdentifier";
394 
395     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
396 
397     jobject out(0);
398     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
399 
400     {
401 		// Java-Call absetzen
402 		static jmethodID mID(NULL);
403         obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
404 		jvalue args[3];
405 		// Parameter konvertieren
406 		args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
407 		args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
408 		args[2].l = convertwchar_tToJavaString(t.pEnv,table);
409 		out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,scope,nullable);
410 
411 		// und aufraeumen
412 		if(catalog.hasValue())
413 			t.pEnv->DeleteLocalRef((jstring)args[0].l);
414 		if(args[1].l)
415 			t.pEnv->DeleteLocalRef((jstring)args[1].l);
416 		if(table.getLength())
417 			t.pEnv->DeleteLocalRef((jstring)args[2].l);
418 		ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
419 	}
420 
421     if ( !out )
422         return NULL;
423 
424     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, cMethodName );
425 	return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
426 }
427 // -------------------------------------------------------------------------
428 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
429         const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
430 {
431 	if ( m_pConnection->isIgnoreDriverPrivilegesEnabled() )
432 		return new OResultSetPrivileges(this,catalog,schemaPattern,tableNamePattern);
433 
434 	static jmethodID mID(NULL);
435     Reference< XResultSet > xReturn( impl_callResultSetMethodWithStrings( "getTablePrivileges", mID, catalog, schemaPattern, tableNamePattern ) );
436 
437 	if ( xReturn.is() )
438 	{
439 		// we have to check the result columns for the tables privleges
440         // #106324#
441 		Reference< XResultSetMetaDataSupplier > xMetaSup(xReturn,UNO_QUERY);
442 		if ( xMetaSup.is() )
443 		{
444 			Reference< XResultSetMetaData> xMeta = xMetaSup->getMetaData();
445 			if ( xMeta.is() && xMeta->getColumnCount() != 7 )
446 			{
447 				// here we know that the count of column doesn't match
448 				::std::map<sal_Int32,sal_Int32> aColumnMatching;
449 				static const ::rtl::OUString sPrivs[] = {
450 											::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE_CAT")),
451 											::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE_SCHEM")),
452 											::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE_NAME")),
453 											::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GRANTOR")),
454 											::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GRANTEE")),
455 											::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PRIVILEGE")),
456 											::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IS_GRANTABLE"))
457 										};
458 
459 				::rtl::OUString sColumnName;
460 				sal_Int32 nCount = xMeta->getColumnCount();
461 				for (sal_Int32 i = 1 ; i <= nCount ; ++i)
462 				{
463 					sColumnName = xMeta->getColumnName(i);
464 					for (sal_uInt32 j = 0 ; j < sizeof(sPrivs)/sizeof(sPrivs[0]); ++j)
465 					{
466 						if ( sPrivs[j] == sColumnName )
467 						{
468 							aColumnMatching.insert( ::std::map<sal_Int32,sal_Int32>::value_type(i,j+1) );
469 							break;
470 						}
471 					}
472 
473 				}
474 				// fill our own resultset
475                 ODatabaseMetaDataResultSet* pNewPrivRes = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTablePrivileges );
476 				Reference< XResultSet > xTemp = xReturn;
477 				xReturn = pNewPrivRes;
478 				ODatabaseMetaDataResultSet::ORows aRows;
479 				Reference< XRow > xRow(xTemp,UNO_QUERY);
480 				::rtl::OUString sValue;
481 
482 				ODatabaseMetaDataResultSet::ORow aRow(8);
483 				while ( xRow.is() && xTemp->next() )
484 				{
485 					::std::map<sal_Int32,sal_Int32>::iterator aIter = aColumnMatching.begin();
486 					::std::map<sal_Int32,sal_Int32>::iterator aEnd  = aColumnMatching.end();
487 					for (;aIter != aEnd ; ++aIter)
488 					{
489 						sValue = xRow->getString(aIter->first);
490 						if ( xRow->wasNull() )
491 							aRow[aIter->second] = ODatabaseMetaDataResultSet::getEmptyValue();
492 						else
493 							aRow[aIter->second] = new ORowSetValueDecorator(sValue);
494 					}
495 
496 					aRows.push_back(aRow);
497 				}
498 				pNewPrivRes->setRows(aRows);
499 			}
500 		}
501 	}
502 	return xReturn;
503 }
504 // -------------------------------------------------------------------------
505 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference(
506         const Any& primaryCatalog, const ::rtl::OUString& primarySchema,
507         const ::rtl::OUString& primaryTable, const Any& foreignCatalog,
508         const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException)
509 {
510 	static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
511 	static const char * cMethodName = "getCrossReference";
512     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
513 
514     jobject out(0);
515     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
516 	{
517 
518 		// Java-Call absetzen
519 		static jmethodID mID(NULL);
520         obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
521 		jvalue args[6];
522 		// Parameter konvertieren
523 		args[0].l = primaryCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(primaryCatalog)) : 0;
524 		args[1].l = primarySchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,primarySchema);
525 		args[2].l = convertwchar_tToJavaString(t.pEnv,primaryTable);
526 		args[3].l = foreignCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(foreignCatalog)) : 0;
527 		args[4].l = foreignSchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,foreignSchema);
528 		args[5].l = convertwchar_tToJavaString(t.pEnv,foreignTable);
529 		out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[2].l,args[2].l,args[3].l,args[4].l,args[5].l );
530 
531 		// und aufraeumen
532 		if(primaryCatalog.hasValue())
533 			t.pEnv->DeleteLocalRef((jstring)args[0].l);
534 		if(args[1].l)
535 			t.pEnv->DeleteLocalRef((jstring)args[1].l);
536 		if(primaryTable.getLength())
537 			t.pEnv->DeleteLocalRef((jstring)args[2].l);
538 		if(foreignCatalog.hasValue())
539 			t.pEnv->DeleteLocalRef((jstring)args[3].l);
540 		if(args[4].l)
541 			t.pEnv->DeleteLocalRef((jstring)args[4].l);
542 		if(foreignTable.getLength())
543 			t.pEnv->DeleteLocalRef((jstring)args[5].l);
544 		ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
545 	}
546 
547     if ( !out )
548         return NULL;
549 
550     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, cMethodName );
551 	return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
552 }
553 
554 // -------------------------------------------------------------------------
555 sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethod( const char* _pMethodName, jmethodID& _inout_MethodID )
556 {
557     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName );
558 	jboolean out( java_lang_Object::callBooleanMethod(_pMethodName,_inout_MethodID) );
559     m_aLogger.log< const sal_Char*, sal_Int16>( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, out );
560 	return out;
561 }
562 
563 // -------------------------------------------------------------------------
564 ::rtl::OUString java_sql_DatabaseMetaData::impl_callStringMethod( const char* _pMethodName, jmethodID& _inout_MethodID )
565 {
566     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName );
567 
568 	const ::rtl::OUString sReturn( callStringMethod(_pMethodName,_inout_MethodID) );
569     if ( m_aLogger.isLoggable( LogLevel::FINEST ) )
570     {
571         ::rtl::OUString sLoggedResult( sReturn );
572         if ( !sLoggedResult.getLength() )
573             sLoggedResult = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "<empty string>" ) );
574         m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, sLoggedResult );
575     }
576 
577     return sReturn;
578 }
579 
580 // -------------------------------------------------------------------------
581 sal_Int32 java_sql_DatabaseMetaData::impl_callIntMethod( const char* _pMethodName, jmethodID& _inout_MethodID )
582 {
583     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName );
584     sal_Int32 out( (sal_Int32)callIntMethod(_pMethodName,_inout_MethodID) );
585     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, (sal_Int32)out );
586 	return out;
587 }
588 
589 // -------------------------------------------------------------------------
590 sal_Bool java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument )
591 {
592     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG1, _pMethodName, _nArgument );
593 
594 	jboolean out( callBooleanMethodWithIntArg(_pMethodName,_inout_MethodID,_nArgument) );
595 
596     m_aLogger.log< const sal_Char*, sal_Int16 >( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, _pMethodName, out );
597 	return out;
598 }
599 
600 // -------------------------------------------------------------------------
601 Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethod( const char* _pMethodName, jmethodID& _inout_MethodID )
602 {
603     SDBThreadAttach t;
604     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName );
605     jobject out(callResultSetMethod(t.env(),_pMethodName,_inout_MethodID));
606     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, _pMethodName );
607     return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
608 }
609 
610 // -------------------------------------------------------------------------
611 Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings( const char* _pMethodName, jmethodID& _inout_MethodID,
612     const Any& _rCatalog, const ::rtl::OUString& _rSchemaPattern, const ::rtl::OUString& _rLeastPattern,
613     const ::rtl::OUString* _pOptionalAdditionalString )
614 {
615     bool bCatalog = _rCatalog.hasValue();
616     ::rtl::OUString sCatalog;
617     _rCatalog >>= sCatalog;
618 
619     bool bSchema = _rSchemaPattern.toChar() != '%';
620 
621     // log the call
622     if ( m_aLogger.isLoggable( LogLevel::FINEST ) )
623     {
624         ::rtl::OUString sCatalogLog = bCatalog ? sCatalog : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "null" ) );
625         ::rtl::OUString sSchemaLog = bSchema ? _rSchemaPattern : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "null" ) );
626         if ( _pOptionalAdditionalString )
627             m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG4, _pMethodName, sCatalogLog, sSchemaLog, _rLeastPattern, *_pOptionalAdditionalString );
628         else
629             m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG3, _pMethodName, sCatalogLog, sSchemaLog, _rLeastPattern );
630     }
631 
632     jobject out(0);
633 
634     SDBThreadAttach t;
635     OSL_ENSURE( t.pEnv, "java_sql_DatabaseMetaData::impl_callResultSetMethodWithStrings: no Java enviroment anymore!" );
636 
637     {
638         const  char* pSignature = _pOptionalAdditionalString
639             ?   "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"
640             :   "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
641         // obtain method ID
642         obtainMethodId(t.pEnv, _pMethodName,pSignature, _inout_MethodID);
643 
644         // call method
645 
646         {
647             jvalue args[4];
648             // convert parameters
649             args[0].l = bCatalog ? convertwchar_tToJavaString( t.pEnv, sCatalog ) : NULL;
650             args[1].l = bSchema ? convertwchar_tToJavaString( t.pEnv, _rSchemaPattern ) : NULL;
651 			args[2].l = convertwchar_tToJavaString( t.pEnv, _rLeastPattern );
652             args[3].l = _pOptionalAdditionalString ? convertwchar_tToJavaString( t.pEnv, *_pOptionalAdditionalString ) : NULL;
653 
654             // actually do the call
655             if ( _pOptionalAdditionalString )
656 			    out = t.pEnv->CallObjectMethod( object, _inout_MethodID, args[0].l, args[1].l, args[2].l, args[3].l );
657             else
658 			    out = t.pEnv->CallObjectMethod( object, _inout_MethodID, args[0].l, args[1].l, args[2].l );
659 
660 			// clean up
661 			if ( args[0].l )
662 				t.pEnv->DeleteLocalRef( (jstring)args[0].l );
663 			if ( args[1].l )
664 				t.pEnv->DeleteLocalRef( (jstring)args[1].l );
665 			if ( args[2].l )
666 				t.pEnv->DeleteLocalRef( (jstring)args[2].l );
667             if ( args[3].l )
668 				t.pEnv->DeleteLocalRef( (jstring)args[3].l );
669 
670 			ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
671 		}
672     }
673 
674     if ( !out )
675         return NULL;
676 
677     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_SUCCESS, _pMethodName );
678     return new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection);
679 }
680 
681 // -------------------------------------------------------------------------
682 sal_Bool SAL_CALL java_sql_DatabaseMetaData::doesMaxRowSizeIncludeBlobs(  ) throw(SQLException, RuntimeException)
683 {
684 	static jmethodID mID(NULL);
685     return impl_callBooleanMethod( "doesMaxRowSizeIncludeBlobs", mID );
686 }
687 // -------------------------------------------------------------------------
688 sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesLowerCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
689 {
690 	static jmethodID mID(NULL);
691     return impl_callBooleanMethod( "storesLowerCaseQuotedIdentifiers", mID );
692 }
693 // -------------------------------------------------------------------------
694 sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesLowerCaseIdentifiers(  ) throw(SQLException, RuntimeException)
695 {
696 	static jmethodID mID(NULL);
697     return impl_callBooleanMethod( "storesLowerCaseIdentifiers", mID );
698 }
699 // -------------------------------------------------------------------------
700 sal_Bool java_sql_DatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw(  )
701 {
702 	static jmethodID mID(NULL);
703     return impl_callBooleanMethod( "storesMixedCaseQuotedIdentifiers", mID );
704 }
705 // -------------------------------------------------------------------------
706 sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesMixedCaseIdentifiers(  ) throw(SQLException, RuntimeException)
707 {
708 	static jmethodID mID(NULL);
709     return impl_callBooleanMethod( "storesMixedCaseIdentifiers", mID );
710 }
711 // -------------------------------------------------------------------------
712 sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesUpperCaseQuotedIdentifiers(  ) throw(SQLException, RuntimeException)
713 {
714 	static jmethodID mID(NULL);
715     return impl_callBooleanMethod( "storesUpperCaseQuotedIdentifiers", mID );
716 }
717 // -------------------------------------------------------------------------
718 sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesUpperCaseIdentifiers(  ) throw(SQLException, RuntimeException)
719 {
720 	static jmethodID mID(NULL);
721     return impl_callBooleanMethod( "storesUpperCaseIdentifiers", mID );
722 }
723 // -------------------------------------------------------------------------
724 sal_Bool java_sql_DatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw(  )
725 {
726 	static jmethodID mID(NULL);
727     return impl_callBooleanMethod( "supportsAlterTableWithAddColumn", mID );
728 }
729 // -------------------------------------------------------------------------
730 sal_Bool java_sql_DatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw(  )
731 {
732 	static jmethodID mID(NULL);
733     return impl_callBooleanMethod( "supportsAlterTableWithDropColumn", mID );
734 }
735 // -------------------------------------------------------------------------
736 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxIndexLength(  ) throw(SQLException, RuntimeException)
737 {
738 	static jmethodID mID(NULL);
739     return impl_callIntMethod( "getMaxIndexLength", mID );
740 }
741 // -------------------------------------------------------------------------
742 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsNonNullableColumns(  ) throw(SQLException, RuntimeException)
743 {
744 	static jmethodID mID(NULL);
745     return impl_callBooleanMethod( "supportsNonNullableColumns", mID );
746 }
747 // -------------------------------------------------------------------------
748 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getCatalogTerm(  ) throw(SQLException, RuntimeException)
749 {
750 	static jmethodID mID(NULL);
751     return impl_callStringMethod( "getCatalogTerm", mID );
752 }
753 // -------------------------------------------------------------------------
754 ::rtl::OUString java_sql_DatabaseMetaData::impl_getIdentifierQuoteString_throw(  )
755 {
756 	static jmethodID mID(NULL);
757     return impl_callStringMethod( "getIdentifierQuoteString", mID );
758 }
759 // -------------------------------------------------------------------------
760 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getExtraNameCharacters(  ) throw(SQLException, RuntimeException)
761 {
762 	static jmethodID mID(NULL);
763     return impl_callStringMethod( "getExtraNameCharacters", mID );
764 }
765 // -------------------------------------------------------------------------
766 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDifferentTableCorrelationNames(  ) throw(SQLException, RuntimeException)
767 {
768 	static jmethodID mID(NULL);
769     return impl_callBooleanMethod( "supportsDifferentTableCorrelationNames", mID );
770 }
771 // -------------------------------------------------------------------------
772 sal_Bool java_sql_DatabaseMetaData::impl_isCatalogAtStart_throw(  )
773 {
774 	static jmethodID mID(NULL);
775     return impl_callBooleanMethod( "isCatalogAtStart", mID );
776 }
777 // -------------------------------------------------------------------------
778 sal_Bool SAL_CALL java_sql_DatabaseMetaData::dataDefinitionIgnoredInTransactions(  ) throw(SQLException, RuntimeException)
779 {
780 	static jmethodID mID(NULL);
781     return impl_callBooleanMethod( "dataDefinitionIgnoredInTransactions", mID );
782 }
783 // -------------------------------------------------------------------------
784 sal_Bool SAL_CALL java_sql_DatabaseMetaData::dataDefinitionCausesTransactionCommit(  ) throw(SQLException, RuntimeException)
785 {
786 	static jmethodID mID(NULL);
787     return impl_callBooleanMethod( "dataDefinitionCausesTransactionCommit", mID );
788 }
789 // -------------------------------------------------------------------------
790 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDataManipulationTransactionsOnly(  ) throw(SQLException, RuntimeException)
791 {
792 	static jmethodID mID(NULL);
793     return impl_callBooleanMethod( "supportsDataManipulationTransactionsOnly", mID );
794 }
795 // -------------------------------------------------------------------------
796 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions(  ) throw(SQLException, RuntimeException)
797 {
798 	static jmethodID mID(NULL);
799     return impl_callBooleanMethod( "supportsDataDefinitionAndDataManipulationTransactions", mID );
800 }
801 // -------------------------------------------------------------------------
802 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsPositionedDelete(  ) throw(SQLException, RuntimeException)
803 {
804 	static jmethodID mID(NULL);
805     return impl_callBooleanMethod( "supportsPositionedDelete", mID );
806 }
807 // -------------------------------------------------------------------------
808 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsPositionedUpdate(  ) throw(SQLException, RuntimeException)
809 {
810 	static jmethodID mID(NULL);
811     return impl_callBooleanMethod( "supportsPositionedUpdate", mID );
812 }
813 // -------------------------------------------------------------------------
814 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenStatementsAcrossRollback(  ) throw(SQLException, RuntimeException)
815 {
816 	static jmethodID mID(NULL);
817     return impl_callBooleanMethod( "supportsOpenStatementsAcrossRollback", mID );
818 }
819 // -------------------------------------------------------------------------
820 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenStatementsAcrossCommit(  ) throw(SQLException, RuntimeException)
821 {
822 	static jmethodID mID(NULL);
823     return impl_callBooleanMethod( "supportsOpenStatementsAcrossCommit", mID );
824 }
825 // -------------------------------------------------------------------------
826 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenCursorsAcrossCommit(  ) throw(SQLException, RuntimeException)
827 {
828 	static jmethodID mID(NULL);
829     return impl_callBooleanMethod( "supportsOpenCursorsAcrossCommit", mID );
830 }
831 // -------------------------------------------------------------------------
832 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenCursorsAcrossRollback(  ) throw(SQLException, RuntimeException)
833 {
834 	static jmethodID mID(NULL);
835     return impl_callBooleanMethod( "supportsOpenCursorsAcrossRollback", mID );
836 }
837 // -------------------------------------------------------------------------
838 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException)
839 {
840 	static jmethodID mID(NULL);
841     return impl_callBooleanMethodWithIntArg( "supportsTransactionIsolationLevel", mID, level );
842 }
843 // -------------------------------------------------------------------------
844 sal_Bool java_sql_DatabaseMetaData::impl_supportsSchemasInDataManipulation_throw(  )
845 {
846 	static jmethodID mID(NULL);
847     return impl_callBooleanMethod( "supportsSchemasInDataManipulation", mID );
848 }
849 // -------------------------------------------------------------------------
850 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92FullSQL(  ) throw(SQLException, RuntimeException)
851 {
852 	static jmethodID mID(NULL);
853     return impl_callBooleanMethod( "supportsANSI92FullSQL", mID );
854 }
855 // -------------------------------------------------------------------------
856 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92EntryLevelSQL(  ) throw(SQLException, RuntimeException)
857 {
858 	static jmethodID mID(NULL);
859     return impl_callBooleanMethod( "supportsANSI92EntryLevelSQL", mID );
860 }
861 // -------------------------------------------------------------------------
862 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsIntegrityEnhancementFacility(  ) throw(SQLException, RuntimeException)
863 {
864 	static jmethodID mID(NULL);
865     return impl_callBooleanMethod( "supportsIntegrityEnhancementFacility", mID );
866 }
867 // -------------------------------------------------------------------------
868 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInIndexDefinitions(  ) throw(SQLException, RuntimeException)
869 {
870 	static jmethodID mID(NULL);
871     return impl_callBooleanMethod( "supportsSchemasInIndexDefinitions", mID );
872 }
873 // -------------------------------------------------------------------------
874 sal_Bool java_sql_DatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw(  )
875 {
876 	static jmethodID mID(NULL);
877     return impl_callBooleanMethod( "supportsSchemasInTableDefinitions", mID );
878 }
879 // -------------------------------------------------------------------------
880 sal_Bool java_sql_DatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw(  )
881 {
882 	static jmethodID mID(NULL);
883     return impl_callBooleanMethod( "supportsCatalogsInTableDefinitions", mID );
884 }
885 // -------------------------------------------------------------------------
886 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInIndexDefinitions(  ) throw(SQLException, RuntimeException)
887 {
888 	static jmethodID mID(NULL);
889     return impl_callBooleanMethod( "supportsCatalogsInIndexDefinitions", mID );
890 }
891 // -------------------------------------------------------------------------
892 sal_Bool java_sql_DatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw(  )
893 {
894 	static jmethodID mID(NULL);
895     return impl_callBooleanMethod( "supportsCatalogsInDataManipulation", mID );
896 }
897 // -------------------------------------------------------------------------
898 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOuterJoins(  ) throw(SQLException, RuntimeException)
899 {
900 	static jmethodID mID(NULL);
901     return impl_callBooleanMethod( "supportsOuterJoins", mID );
902 }
903 // -------------------------------------------------------------------------
904 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTableTypes(  ) throw(SQLException, RuntimeException)
905 {
906 	static jmethodID mID(NULL);
907     return impl_callResultSetMethod( "getTableTypes", mID );
908 }
909 // -------------------------------------------------------------------------
910 sal_Int32 java_sql_DatabaseMetaData::impl_getMaxStatements_throw(  )
911 {
912 	static jmethodID mID(NULL);
913     return impl_callIntMethod( "getMaxStatements", mID );
914 }
915 // -------------------------------------------------------------------------
916 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxProcedureNameLength(  ) throw(SQLException, RuntimeException)
917 {
918 	static jmethodID mID(NULL);
919     return impl_callIntMethod( "getMaxProcedureNameLength", mID );
920 }
921 // -------------------------------------------------------------------------
922 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxSchemaNameLength(  ) throw(SQLException, RuntimeException)
923 {
924 	static jmethodID mID(NULL);
925     return impl_callIntMethod( "getMaxSchemaNameLength", mID );
926 }
927 // -------------------------------------------------------------------------
928 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTransactions(  ) throw(SQLException, RuntimeException)
929 {
930 	static jmethodID mID(NULL);
931     return impl_callBooleanMethod( "supportsTransactions", mID );
932 }
933 
934 // -------------------------------------------------------------------------
935 sal_Bool SAL_CALL java_sql_DatabaseMetaData::allProceduresAreCallable(  ) throw(SQLException, RuntimeException)
936 {
937 	static jmethodID mID(NULL);
938     return impl_callBooleanMethod( "allProceduresAreCallable", mID );
939 }
940 // -------------------------------------------------------------------------
941 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsStoredProcedures(  ) throw(SQLException, RuntimeException)
942 {
943 	static jmethodID mID(NULL);
944     return impl_callBooleanMethod( "supportsStoredProcedures", mID );
945 }
946 // -------------------------------------------------------------------------
947 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSelectForUpdate(  ) throw(SQLException, RuntimeException)
948 {
949 	static jmethodID mID(NULL);
950     return impl_callBooleanMethod( "supportsSelectForUpdate", mID );
951 }
952 // -------------------------------------------------------------------------
953 sal_Bool SAL_CALL java_sql_DatabaseMetaData::allTablesAreSelectable(  ) throw(SQLException, RuntimeException)
954 {
955 	static jmethodID mID(NULL);
956     return impl_callBooleanMethod( "allTablesAreSelectable", mID );
957 }
958 // -------------------------------------------------------------------------
959 sal_Bool SAL_CALL java_sql_DatabaseMetaData::isReadOnly(  ) throw(SQLException, RuntimeException)
960 {
961 	static jmethodID mID(NULL);
962     return impl_callBooleanMethod( "isReadOnly", mID );
963 }
964 // -------------------------------------------------------------------------
965 sal_Bool SAL_CALL java_sql_DatabaseMetaData::usesLocalFiles(  ) throw(SQLException, RuntimeException)
966 {
967 	static jmethodID mID(NULL);
968     return impl_callBooleanMethod( "usesLocalFiles", mID );
969 }
970 // -------------------------------------------------------------------------
971 sal_Bool SAL_CALL java_sql_DatabaseMetaData::usesLocalFilePerTable(  ) throw(SQLException, RuntimeException)
972 {
973 	static jmethodID mID(NULL);
974     return impl_callBooleanMethod( "usesLocalFilePerTable", mID );
975 }
976 // -------------------------------------------------------------------------
977 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTypeConversion(  ) throw(SQLException, RuntimeException)
978 {
979 	static jmethodID mID(NULL);
980     return impl_callBooleanMethod( "supportsTypeConversion", mID );
981 }
982 // -------------------------------------------------------------------------
983 sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullPlusNonNullIsNull(  ) throw(SQLException, RuntimeException)
984 {
985 	static jmethodID mID(NULL);
986     return impl_callBooleanMethod( "nullPlusNonNullIsNull", mID );
987 }
988 // -------------------------------------------------------------------------
989 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsColumnAliasing(  ) throw(SQLException, RuntimeException)
990 {
991 	static jmethodID mID(NULL);
992     return impl_callBooleanMethod( "supportsColumnAliasing", mID );
993 }
994 // -------------------------------------------------------------------------
995 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTableCorrelationNames(  ) throw(SQLException, RuntimeException)
996 {
997 	static jmethodID mID(NULL);
998     return impl_callBooleanMethod( "supportsTableCorrelationNames", mID );
999 }
1000 // -------------------------------------------------------------------------
1001 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException)
1002 {
1003     static const char* pMethodName = "supportsConvert";
1004     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG2, pMethodName, fromType, toType );
1005 
1006     jboolean out( sal_False );
1007 	SDBThreadAttach t;
1008 
1009     {
1010         static jmethodID mID(NULL);
1011         obtainMethodId(t.pEnv, pMethodName,"(II)Z", mID);
1012 		out = t.pEnv->CallBooleanMethod( object, mID, fromType, toType );
1013 		ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
1014 	}
1015 
1016     m_aLogger.log< const sal_Char*, sal_Int16 >( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, pMethodName, out );
1017     return out;
1018 }
1019 // -------------------------------------------------------------------------
1020 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsExpressionsInOrderBy(  ) throw(SQLException, RuntimeException)
1021 {
1022 	static jmethodID mID(NULL);
1023     return impl_callBooleanMethod( "supportsExpressionsInOrderBy", mID );
1024 }
1025 // -------------------------------------------------------------------------
1026 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupBy(  ) throw(SQLException, RuntimeException)
1027 {
1028 	static jmethodID mID(NULL);
1029     return impl_callBooleanMethod( "supportsGroupBy", mID );
1030 }
1031 // -------------------------------------------------------------------------
1032 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupByBeyondSelect(  ) throw(SQLException, RuntimeException)
1033 {
1034 	static jmethodID mID(NULL);
1035     return impl_callBooleanMethod( "supportsGroupByBeyondSelect", mID );
1036 }
1037 // -------------------------------------------------------------------------
1038 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupByUnrelated(  ) throw(SQLException, RuntimeException)
1039 {
1040 	static jmethodID mID(NULL);
1041     return impl_callBooleanMethod( "supportsGroupByUnrelated", mID );
1042 }
1043 // -------------------------------------------------------------------------
1044 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMultipleTransactions(  ) throw(SQLException, RuntimeException)
1045 {
1046 	static jmethodID mID(NULL);
1047     return impl_callBooleanMethod( "supportsMultipleTransactions", mID );
1048 }
1049 // -------------------------------------------------------------------------
1050 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMultipleResultSets(  ) throw(SQLException, RuntimeException)
1051 {
1052 	static jmethodID mID(NULL);
1053     return impl_callBooleanMethod( "supportsMultipleResultSets", mID );
1054 }
1055 // -------------------------------------------------------------------------
1056 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsLikeEscapeClause(  ) throw(SQLException, RuntimeException)
1057 {
1058 	static jmethodID mID(NULL);
1059     return impl_callBooleanMethod( "supportsLikeEscapeClause", mID );
1060 }
1061 // -------------------------------------------------------------------------
1062 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOrderByUnrelated(  ) throw(SQLException, RuntimeException)
1063 {
1064 	static jmethodID mID(NULL);
1065     return impl_callBooleanMethod( "supportsOrderByUnrelated", mID );
1066 }
1067 // -------------------------------------------------------------------------
1068 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsUnion(  ) throw(SQLException, RuntimeException)
1069 {
1070 	static jmethodID mID(NULL);
1071     return impl_callBooleanMethod( "supportsUnion", mID );
1072 }
1073 // -------------------------------------------------------------------------
1074 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsUnionAll(  ) throw(SQLException, RuntimeException)
1075 {
1076 	static jmethodID mID(NULL);
1077     return impl_callBooleanMethod( "supportsUnionAll", mID );
1078 }
1079 // -------------------------------------------------------------------------
1080 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMixedCaseIdentifiers(  ) throw(SQLException, RuntimeException)
1081 {
1082 	static jmethodID mID(NULL);
1083     return impl_callBooleanMethod( "supportsMixedCaseIdentifiers", mID );
1084 }
1085 // -------------------------------------------------------------------------
1086 sal_Bool java_sql_DatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw(  )
1087 {
1088 	static jmethodID mID(NULL);
1089     return impl_callBooleanMethod( "supportsMixedCaseQuotedIdentifiers", mID );
1090 }
1091 // -------------------------------------------------------------------------
1092 sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedAtEnd(  ) throw(SQLException, RuntimeException)
1093 {
1094 	static jmethodID mID(NULL);
1095     return impl_callBooleanMethod( "nullsAreSortedAtEnd", mID );
1096 }
1097 // -------------------------------------------------------------------------
1098 sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedAtStart(  ) throw(SQLException, RuntimeException)
1099 {
1100 	static jmethodID mID(NULL);
1101     return impl_callBooleanMethod( "nullsAreSortedAtStart", mID );
1102 }
1103 // -------------------------------------------------------------------------
1104 sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedHigh(  ) throw(SQLException, RuntimeException)
1105 {
1106 	static jmethodID mID(NULL);
1107     return impl_callBooleanMethod( "nullsAreSortedHigh", mID );
1108 }
1109 // -------------------------------------------------------------------------
1110 sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedLow(  ) throw(SQLException, RuntimeException)
1111 {
1112 	static jmethodID mID(NULL);
1113     return impl_callBooleanMethod( "nullsAreSortedLow", mID );
1114 }
1115 // -------------------------------------------------------------------------
1116 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInProcedureCalls(  ) throw(SQLException, RuntimeException)
1117 {
1118 	static jmethodID mID(NULL);
1119     return impl_callBooleanMethod( "supportsSchemasInProcedureCalls", mID );
1120 }
1121 // -------------------------------------------------------------------------
1122 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInPrivilegeDefinitions(  ) throw(SQLException, RuntimeException)
1123 {
1124 	static jmethodID mID(NULL);
1125     return impl_callBooleanMethod( "supportsSchemasInPrivilegeDefinitions", mID );
1126 }
1127 // -------------------------------------------------------------------------
1128 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInProcedureCalls(  ) throw(SQLException, RuntimeException)
1129 {
1130 	static jmethodID mID(NULL);
1131     return impl_callBooleanMethod( "supportsCatalogsInProcedureCalls", mID );
1132 }
1133 // -------------------------------------------------------------------------
1134 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInPrivilegeDefinitions(  ) throw(SQLException, RuntimeException)
1135 {
1136 	static jmethodID mID(NULL);
1137     return impl_callBooleanMethod( "supportsCatalogsInPrivilegeDefinitions", mID );
1138 }
1139 // -------------------------------------------------------------------------
1140 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCorrelatedSubqueries(  ) throw(SQLException, RuntimeException)
1141 {
1142 	static jmethodID mID(NULL);
1143     return impl_callBooleanMethod( "supportsCorrelatedSubqueries", mID );
1144 }
1145 // -------------------------------------------------------------------------
1146 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInComparisons(  ) throw(SQLException, RuntimeException)
1147 {
1148 	static jmethodID mID(NULL);
1149     return impl_callBooleanMethod( "supportsSubqueriesInComparisons", mID );
1150 }
1151 // -------------------------------------------------------------------------
1152 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInExists(  ) throw(SQLException, RuntimeException)
1153 {
1154 	static jmethodID mID(NULL);
1155     return impl_callBooleanMethod( "supportsSubqueriesInExists", mID );
1156 }
1157 // -------------------------------------------------------------------------
1158 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInIns(  ) throw(SQLException, RuntimeException)
1159 {
1160 	static jmethodID mID(NULL);
1161     return impl_callBooleanMethod( "supportsSubqueriesInIns", mID );
1162 }
1163 // -------------------------------------------------------------------------
1164 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInQuantifieds(  ) throw(SQLException, RuntimeException)
1165 {
1166 	static jmethodID mID(NULL);
1167     return impl_callBooleanMethod( "supportsSubqueriesInQuantifieds", mID );
1168 }
1169 // -------------------------------------------------------------------------
1170 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92IntermediateSQL(  ) throw(SQLException, RuntimeException)
1171 {
1172 	static jmethodID mID(NULL);
1173     return impl_callBooleanMethod( "supportsANSI92IntermediateSQL", mID );
1174 }
1175 // -------------------------------------------------------------------------
1176 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getURL(  ) throw(SQLException, RuntimeException)
1177 {
1178 	::rtl::OUString sURL = m_pConnection->getURL();
1179 	if ( !sURL.getLength() )
1180 	{
1181 	    static jmethodID mID(NULL);
1182         sURL = impl_callStringMethod( "getURL", mID );
1183 	}
1184 	return sURL;
1185 }
1186 // -------------------------------------------------------------------------
1187 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getUserName(  ) throw(SQLException, RuntimeException)
1188 {
1189 	static jmethodID mID(NULL);
1190     return impl_callStringMethod( "getUserName", mID );
1191 }
1192 // -------------------------------------------------------------------------
1193 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDriverName(  ) throw(SQLException, RuntimeException)
1194 {
1195 	static jmethodID mID(NULL);
1196     return impl_callStringMethod( "getDriverName", mID );
1197 }
1198 // -------------------------------------------------------------------------
1199 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDriverVersion(  ) throw(SQLException, RuntimeException)
1200 {
1201 	static jmethodID mID(NULL);
1202     return impl_callStringMethod( "getDriverVersion", mID );
1203 }
1204 // -------------------------------------------------------------------------
1205 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDatabaseProductVersion(  ) throw(SQLException, RuntimeException)
1206 {
1207 	static jmethodID mID(NULL);
1208     return impl_callStringMethod( "getDatabaseProductVersion", mID );
1209 }
1210 // -------------------------------------------------------------------------
1211 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDatabaseProductName(  ) throw(SQLException, RuntimeException)
1212 {
1213 	static jmethodID mID(NULL);
1214     return impl_callStringMethod( "getDatabaseProductName", mID );
1215 }
1216 // -------------------------------------------------------------------------
1217 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getProcedureTerm(  ) throw(SQLException, RuntimeException)
1218 {
1219 	static jmethodID mID(NULL);
1220     return impl_callStringMethod( "getProcedureTerm", mID );
1221 }
1222 // -------------------------------------------------------------------------
1223 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSchemaTerm(  ) throw(SQLException, RuntimeException)
1224 {
1225 	static jmethodID mID(NULL);
1226     return impl_callStringMethod( "getSchemaTerm", mID );
1227 }
1228 // -------------------------------------------------------------------------
1229 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDriverMajorVersion(  ) throw(RuntimeException)
1230 {
1231 	static jmethodID mID(NULL);
1232     return impl_callIntMethod( "getDriverMajorVersion", mID );
1233 }
1234 // -------------------------------------------------------------------------
1235 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDefaultTransactionIsolation(  ) throw(SQLException, RuntimeException)
1236 {
1237 	static jmethodID mID(NULL);
1238     return impl_callIntMethod( "getDefaultTransactionIsolation", mID );
1239 }
1240 // -------------------------------------------------------------------------
1241 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDriverMinorVersion(  ) throw(RuntimeException)
1242 {
1243 	static jmethodID mID(NULL);
1244     return impl_callIntMethod( "getDriverMinorVersion", mID );
1245 }
1246 // -------------------------------------------------------------------------
1247 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSQLKeywords(  ) throw(SQLException, RuntimeException)
1248 {
1249 	static jmethodID mID(NULL);
1250     return impl_callStringMethod( "getSQLKeywords", mID );
1251 }
1252 // -------------------------------------------------------------------------
1253 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSearchStringEscape(  ) throw(SQLException, RuntimeException)
1254 {
1255 	static jmethodID mID(NULL);
1256     return impl_callStringMethod( "getSearchStringEscape", mID );
1257 }
1258 // -------------------------------------------------------------------------
1259 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getStringFunctions(  ) throw(SQLException, RuntimeException)
1260 {
1261 	static jmethodID mID(NULL);
1262     return impl_callStringMethod( "getStringFunctions", mID );
1263 }
1264 // -------------------------------------------------------------------------
1265 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getTimeDateFunctions(  ) throw(SQLException, RuntimeException)
1266 {
1267 	static jmethodID mID(NULL);
1268     return impl_callStringMethod( "getTimeDateFunctions", mID );
1269 }
1270 // -------------------------------------------------------------------------
1271 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSystemFunctions(  ) throw(SQLException, RuntimeException)
1272 {
1273 	static jmethodID mID(NULL);
1274     return impl_callStringMethod( "getSystemFunctions", mID );
1275 }
1276 // -------------------------------------------------------------------------
1277 ::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getNumericFunctions(  ) throw(SQLException, RuntimeException)
1278 {
1279 	static jmethodID mID(NULL);
1280     return impl_callStringMethod( "getNumericFunctions", mID );
1281 }
1282 // -------------------------------------------------------------------------
1283 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsExtendedSQLGrammar(  ) throw(SQLException, RuntimeException)
1284 {
1285 	static jmethodID mID(NULL);
1286     return impl_callBooleanMethod( "supportsExtendedSQLGrammar", mID );
1287 }
1288 // -------------------------------------------------------------------------
1289 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCoreSQLGrammar(  ) throw(SQLException, RuntimeException)
1290 {
1291 	static jmethodID mID(NULL);
1292     return impl_callBooleanMethod( "supportsCoreSQLGrammar", mID );
1293 }
1294 // -------------------------------------------------------------------------
1295 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMinimumSQLGrammar(  ) throw(SQLException, RuntimeException)
1296 {
1297 	static jmethodID mID(NULL);
1298     return impl_callBooleanMethod( "supportsMinimumSQLGrammar", mID );
1299 }
1300 // -------------------------------------------------------------------------
1301 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsFullOuterJoins(  ) throw(SQLException, RuntimeException)
1302 {
1303 	static jmethodID mID(NULL);
1304     return impl_callBooleanMethod( "supportsFullOuterJoins", mID );
1305 }
1306 // -------------------------------------------------------------------------
1307 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsLimitedOuterJoins(  ) throw(SQLException, RuntimeException)
1308 {
1309 	static jmethodID mID(NULL);
1310     return impl_callBooleanMethod( "supportsLimitedOuterJoins", mID );
1311 }
1312 // -------------------------------------------------------------------------
1313 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInGroupBy(  ) throw(SQLException, RuntimeException)
1314 {
1315 	static jmethodID mID(NULL);
1316     return impl_callIntMethod( "getMaxColumnsInGroupBy", mID );
1317 }
1318 // -------------------------------------------------------------------------
1319 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInOrderBy(  ) throw(SQLException, RuntimeException)
1320 {
1321 	static jmethodID mID(NULL);
1322     return impl_callIntMethod( "getMaxColumnsInOrderBy", mID );
1323 }
1324 // -------------------------------------------------------------------------
1325 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInSelect(  ) throw(SQLException, RuntimeException)
1326 {
1327 	static jmethodID mID(NULL);
1328     return impl_callIntMethod( "getMaxColumnsInSelect", mID );
1329 }
1330 // -------------------------------------------------------------------------
1331 sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxUserNameLength(  ) throw(SQLException, RuntimeException)
1332 {
1333 	static jmethodID mID(NULL);
1334     return impl_callIntMethod( "getMaxUserNameLength", mID );
1335 }
1336 // -------------------------------------------------------------------------
1337 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
1338 {
1339 	static jmethodID mID(NULL);
1340     return impl_callBooleanMethodWithIntArg( "supportsResultSetType", mID, setType );
1341 }
1342 // -------------------------------------------------------------------------
1343 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException)
1344 {
1345     static const char* pMethodName = "supportsResultSetConcurrency";
1346     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG2, pMethodName, setType, concurrency );
1347 
1348 	jboolean out( sal_False );
1349     SDBThreadAttach t;
1350 
1351 	{
1352 		static jmethodID mID(NULL);
1353         obtainMethodId(t.pEnv, pMethodName,"(II)Z", mID);
1354 		out = 	t.pEnv->CallBooleanMethod( object, mID, setType, concurrency);
1355 		ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
1356 	}
1357 
1358     m_aLogger.log< const sal_Char*, sal_Int16 >( LogLevel::FINEST, STR_LOG_META_DATA_RESULT, pMethodName, out );
1359 	return out;
1360 }
1361 // -------------------------------------------------------------------------
1362 sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1363 {
1364 	static jmethodID mID(NULL);
1365     return impl_callBooleanMethodWithIntArg( "ownUpdatesAreVisible", mID, setType );
1366 }
1367 // -------------------------------------------------------------------------
1368 sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1369 {
1370 	static jmethodID mID(NULL);
1371     return impl_callBooleanMethodWithIntArg( "ownDeletesAreVisible", mID, setType );
1372 }
1373 // -------------------------------------------------------------------------
1374 sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1375 {
1376 	static jmethodID mID(NULL);
1377     return impl_callBooleanMethodWithIntArg( "ownInsertsAreVisible", mID, setType );
1378 }
1379 // -------------------------------------------------------------------------
1380 sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1381 {
1382 	static jmethodID mID(NULL);
1383     return impl_callBooleanMethodWithIntArg( "othersUpdatesAreVisible", mID, setType );
1384 }
1385 // -------------------------------------------------------------------------
1386 sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1387 {
1388 	static jmethodID mID(NULL);
1389     return impl_callBooleanMethodWithIntArg( "othersDeletesAreVisible", mID, setType );
1390 }
1391 // -------------------------------------------------------------------------
1392 sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
1393 {
1394 	static jmethodID mID(NULL);
1395     return impl_callBooleanMethodWithIntArg( "othersInsertsAreVisible", mID, setType );
1396 }
1397 // -------------------------------------------------------------------------
1398 sal_Bool SAL_CALL java_sql_DatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
1399 {
1400 	static jmethodID mID(NULL);
1401     return impl_callBooleanMethodWithIntArg( "updatesAreDetected", mID, setType );
1402 }
1403 // -------------------------------------------------------------------------
1404 sal_Bool SAL_CALL java_sql_DatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
1405 {
1406 	static jmethodID mID(NULL);
1407     return impl_callBooleanMethodWithIntArg( "deletesAreDetected", mID, setType );
1408 }
1409 // -------------------------------------------------------------------------
1410 sal_Bool SAL_CALL java_sql_DatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
1411 {
1412 	static jmethodID mID(NULL);
1413     return impl_callBooleanMethodWithIntArg( "insertsAreDetected", mID, setType );
1414 }
1415 // -------------------------------------------------------------------------
1416 sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsBatchUpdates(  ) throw(SQLException, RuntimeException)
1417 {
1418 	static jmethodID mID(NULL);
1419     return impl_callBooleanMethod( "supportsBatchUpdates", mID );
1420 }
1421 // -------------------------------------------------------------------------
1422 Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs(
1423         const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern,
1424         const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException)
1425 {
1426 	jobject out(0);
1427     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
1428 	{
1429 
1430 
1431 		static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I)Ljava/sql/ResultSet;";
1432 		static const char * cMethodName = "getUDTs";
1433 		// Java-Call absetzen
1434 		static jmethodID mID(NULL);
1435         obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
1436 		{
1437 			jvalue args[4];
1438 			// temporaere Variable initialisieren
1439 			args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
1440 			args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern);
1441 			args[2].l = convertwchar_tToJavaString(t.pEnv,typeNamePattern);
1442 			jintArray pArray = t.pEnv->NewIntArray(types.getLength());
1443 			t.pEnv->SetIntArrayRegion(pArray,0,types.getLength(),(jint*)types.getConstArray());
1444 			args[3].l = pArray;
1445 
1446 			out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l);
1447 
1448 			if(catalog.hasValue())
1449 				t.pEnv->DeleteLocalRef((jstring)args[0].l);
1450 			if(schemaPattern.getLength())
1451 				t.pEnv->DeleteLocalRef((jstring)args[1].l);
1452 			if(typeNamePattern.getLength())
1453 				t.pEnv->DeleteLocalRef((jstring)args[2].l);
1454 			if(args[3].l)
1455 				t.pEnv->DeleteLocalRef((jintArray)args[3].l);
1456 			ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
1457 		}
1458 	}
1459 
1460 	return out ? new java_sql_ResultSet( t.pEnv, out, m_aLogger,*m_pConnection ) : 0;
1461 }
1462 // -------------------------------------------------------------------------
1463