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