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