1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_connectivity.hxx"
30 #include "java/lang/String.hxx"
31 #include "java/lang/Boolean.hxx"
32 #include "java/sql/ResultSet.hxx"
33 #include "java/math/BigDecimal.hxx"
34 #include "java/sql/JStatement.hxx"
35 #include "java/sql/SQLWarning.hxx"
36 #include "java/sql/Timestamp.hxx"
37 #include "java/sql/Array.hxx"
38 #include "java/sql/Ref.hxx"
39 #include "java/sql/Clob.hxx"
40 #include "java/sql/Timestamp.hxx"
41 #include "java/sql/Blob.hxx"
42 #include "java/sql/ResultSetMetaData.hxx"
43 #include "java/io/InputStream.hxx"
44 #include "java/io/Reader.hxx"
45 #include "java/tools.hxx"
46 #include <comphelper/property.hxx>
47 #include "connectivity/CommonTools.hxx"
48 #include <cppuhelper/typeprovider.hxx>
49 #include <comphelper/sequence.hxx>
50 #include <com/sun/star/beans/PropertyAttribute.hpp>
51 #include "TConnection.hxx"
52 #include <comphelper/types.hxx>
53 #include "connectivity/dbtools.hxx"
54 #include "connectivity/dbexception.hxx"
55 #include "resource/common_res.hrc"
56 #include "resource/sharedresources.hxx"
57 #include "java/LocalRef.hxx"
58 
59 #include <rtl/logfile.hxx>
60 #include <string.h>
61 
62 using namespace ::comphelper;
63 
64 using namespace connectivity;
65 using namespace ::com::sun::star::uno;
66 using namespace ::com::sun::star::beans;
67 //	using namespace ::com::sun::star::sdbcx;
68 using namespace ::com::sun::star::sdbc;
69 using namespace ::com::sun::star::container;
70 using namespace ::com::sun::star::lang;
71 
72 IMPLEMENT_SERVICE_INFO(java_sql_ResultSet,"com.sun.star.sdbcx.JResultSet","com.sun.star.sdbc.ResultSet");
73 //**************************************************************
74 //************ Class: java.sql.ResultSet
75 //**************************************************************
76 
77 jclass java_sql_ResultSet::theClass = 0;
78 java_sql_ResultSet::java_sql_ResultSet( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rParentLogger,java_sql_Connection& _rConnection, java_sql_Statement_Base* pStmt)
79     :java_sql_ResultSet_BASE(m_aMutex)
80     ,java_lang_Object( pEnv, myObj )
81     ,OPropertySetHelper(java_sql_ResultSet_BASE::rBHelper)
82     ,m_aLogger( _rParentLogger, java::sql::ConnectionLog::RESULTSET )
83     ,m_pConnection(&_rConnection)
84 {
85     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::java_sql_ResultSet" );
86 	SDBThreadAttach::addRef();
87 	osl_incrementInterlockedCount(&m_refCount);
88 	if ( pStmt )
89 		m_xStatement = *pStmt;
90 
91 	osl_decrementInterlockedCount(&m_refCount);
92 }
93 // -----------------------------------------------------------------------------
94 java_sql_ResultSet::~java_sql_ResultSet()
95 {
96     if ( !java_sql_ResultSet_BASE::rBHelper.bDisposed && !java_sql_ResultSet_BASE::rBHelper.bInDispose )
97 	{
98         // increment ref count to prevent double call of Dtor
99         osl_incrementInterlockedCount( &m_refCount );
100         dispose();
101 	}
102 }
103 
104 jclass java_sql_ResultSet::getMyClass() const
105 {
106     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getMyClass" );
107 	// die Klasse muss nur einmal geholt werden, daher statisch
108 	if( !theClass )
109         theClass = findMyClass("java/sql/ResultSet");
110 	return theClass;
111 }
112 
113 // -------------------------------------------------------------------------
114 void java_sql_ResultSet::disposing(void)
115 {
116     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::disposing" );
117 	OPropertySetHelper::disposing();
118 
119 	::osl::MutexGuard aGuard(m_aMutex);
120 m_xMetaData.clear();
121 	if( object )
122 	{
123         SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
124         static jmethodID mID(NULL);
125         callVoidMethod("close",mID);
126 		clearObject(*t.pEnv);
127 	}
128 
129 	SDBThreadAttach::releaseRef();
130 }
131 // -------------------------------------------------------------------------
132 ::com::sun::star::uno::Any SAL_CALL java_sql_ResultSet::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
133 {
134     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::queryInterface" );
135 	::com::sun::star::uno::Any aRet = OPropertySetHelper::queryInterface(rType);
136 	return aRet.hasValue() ? aRet : java_sql_ResultSet_BASE::queryInterface(rType);
137 }
138 // -------------------------------------------------------------------------
139 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL java_sql_ResultSet::getTypes(  ) throw(::com::sun::star::uno::RuntimeException)
140 {
141     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTypes" );
142 	::cppu::OTypeCollection aTypes(	::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
143 									::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
144 									::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
145 
146 	return ::comphelper::concatSequences(aTypes.getTypes(),java_sql_ResultSet_BASE::getTypes());
147 }
148 // -------------------------------------------------------------------------
149 
150 sal_Int32 SAL_CALL java_sql_ResultSet::findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
151 {
152     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::findColumn" );
153     static jmethodID mID(NULL);
154     return callIntMethodWithStringArg("findColumn",mID,columnName);
155 }
156 // -------------------------------------------------------------------------
157 Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
158 {
159     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBinaryStream" );
160     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
161     static jmethodID mID(NULL);
162     jobject out = callObjectMethodWithIntArg(t.pEnv,"getBinaryStream","(I)Ljava/io/InputStream;", mID, columnIndex);
163 
164 	// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
165 	return out==0 ? 0 : new java_io_InputStream( t.pEnv, out );
166 }
167 // -------------------------------------------------------------------------
168 Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
169 {
170     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCharacterStream" );
171     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
172     static jmethodID mID(NULL);
173     jobject out = callObjectMethodWithIntArg(t.pEnv,"getCharacterStream","(I)Ljava/io/Reader;", mID, columnIndex);
174 
175 	// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
176 	return out==0 ? 0 : new java_io_Reader( t.pEnv, out );
177 }
178 // -------------------------------------------------------------------------
179 
180 sal_Bool SAL_CALL java_sql_ResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
181 {
182     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBoolean" );
183     static jmethodID mID(NULL);
184     return callBooleanMethodWithIntArg( "getBoolean", mID,columnIndex );
185 }
186 // -------------------------------------------------------------------------
187 
188 sal_Int8 SAL_CALL java_sql_ResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
189 {
190     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getByte" );
191     static jmethodID mID(NULL);
192     jbyte (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallByteMethod;
193     return callMethodWithIntArg<jbyte>(pCallMethod,"getByte","(I)B",mID,columnIndex);
194 }
195 // -------------------------------------------------------------------------
196 
197 Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
198 {
199     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBytes" );
200     Sequence< sal_Int8 > aSeq;
201     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
202     static jmethodID mID(NULL);
203     jbyteArray out = (jbyteArray)callObjectMethodWithIntArg(t.pEnv,"getBytes","(I)[B", mID, columnIndex);
204 	if (out)
205 	{
206 		jboolean p = sal_False;
207 		aSeq.realloc(t.pEnv->GetArrayLength(out));
208 		memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength());
209 		t.pEnv->DeleteLocalRef(out);
210 	}
211 	return aSeq;
212 }
213 // -------------------------------------------------------------------------
214 
215 ::com::sun::star::util::Date SAL_CALL java_sql_ResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
216 {
217     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDate" );
218     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
219     static jmethodID mID(NULL);
220     jobject out = callObjectMethodWithIntArg(t.pEnv,"getDate","(I)Ljava/sql/Date;", mID, columnIndex);
221 	// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
222 	return out ? static_cast <com::sun::star::util::Date> (java_sql_Date( t.pEnv, out )) : ::com::sun::star::util::Date();
223 }
224 // -------------------------------------------------------------------------
225 
226 double SAL_CALL java_sql_ResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
227 {
228     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDouble" );
229     static jmethodID mID(NULL);
230     jdouble (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallDoubleMethod;
231     return callMethodWithIntArg<double>(pCallMethod,"getDouble","(I)D",mID,columnIndex);
232 }
233 // -------------------------------------------------------------------------
234 
235 float SAL_CALL java_sql_ResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
236 {
237     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFloat" );
238     static jmethodID mID(NULL);
239     jfloat (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallFloatMethod;
240     return callMethodWithIntArg<jfloat>(pCallMethod,"getFloat","(I)F",mID,columnIndex);
241 }
242 // -------------------------------------------------------------------------
243 
244 sal_Int32 SAL_CALL java_sql_ResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
245 {
246     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getInt" );
247     static jmethodID mID(NULL);
248     return callIntMethodWithIntArg("getInt",mID,columnIndex);
249 }
250 // -------------------------------------------------------------------------
251 
252 sal_Int32 SAL_CALL java_sql_ResultSet::getRow(  ) throw(SQLException, RuntimeException)
253 {
254     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRow" );
255     static jmethodID mID(NULL);
256     return callIntMethod("getRow",mID);
257 }
258 // -------------------------------------------------------------------------
259 
260 sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
261 {
262     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getLong" );
263     static jmethodID mID(NULL);
264     jlong (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod;
265     return callMethodWithIntArg<jlong>(pCallMethod,"getLong","(I)J",mID,columnIndex);
266 }
267 // -------------------------------------------------------------------------
268 
269 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL java_sql_ResultSet::getMetaData(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
270 {
271     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getMetaData" );
272     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
273     static jmethodID mID(NULL);
274     jobject out = callObjectMethod(t.pEnv,"getMetaData","()Ljava/sql/ResultSetMetaData;", mID);
275 
276 	return out==0 ? 0 : new java_sql_ResultSetMetaData( t.pEnv, out, m_aLogger,*m_pConnection );
277 }
278 // -------------------------------------------------------------------------
279 Reference< XArray > SAL_CALL java_sql_ResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
280 {
281     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getArray" );
282     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
283     static jmethodID mID(NULL);
284     jobject out = callObjectMethodWithIntArg(t.pEnv,"getArray","(I)Ljava/sql/Array;", mID, columnIndex);
285 
286 	// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
287 	return out==0 ? 0 : new java_sql_Array( t.pEnv, out );
288 }
289 // -------------------------------------------------------------------------
290 
291 Reference< XClob > SAL_CALL java_sql_ResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
292 {
293     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getClob" );
294     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
295     static jmethodID mID(NULL);
296     jobject out = callObjectMethodWithIntArg(t.pEnv,"getClob","(I)Ljava/sql/Clob;", mID, columnIndex);
297 	// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
298 	return out==0 ? 0 : new java_sql_Clob( t.pEnv, out );
299 }
300 // -------------------------------------------------------------------------
301 Reference< XBlob > SAL_CALL java_sql_ResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
302 {
303     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBlob" );
304     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
305     static jmethodID mID(NULL);
306     jobject out = callObjectMethodWithIntArg(t.pEnv,"getBlob","(I)Ljava/sql/Blob;", mID, columnIndex);
307 	// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
308 	return out==0 ? 0 : new java_sql_Blob( t.pEnv, out );
309 }
310 // -------------------------------------------------------------------------
311 
312 Reference< XRef > SAL_CALL java_sql_ResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
313 {
314     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRef" );
315     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
316     static jmethodID mID(NULL);
317     jobject out = callObjectMethodWithIntArg(t.pEnv,"getRef","(I)Ljava/sql/Ref;", mID, columnIndex);
318 
319 	// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
320 	return out==0 ? 0 : new java_sql_Ref( t.pEnv, out );
321 }
322 // -------------------------------------------------------------------------
323 
324 Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException)
325 {
326     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getObject" );
327 	jobject out(0);
328 	Any aRet;
329     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
330 	{
331 		jvalue args[2];
332 		// Parameter konvertieren
333 		args[0].i = (sal_Int32)columnIndex;
334 		args[1].l = convertTypeMapToJavaMap(t.pEnv,typeMap);
335 		// temporaere Variable initialisieren
336 		// Java-Call absetzen
337 		static jmethodID mID(NULL);
338 		if ( !mID  )
339         {
340             static const char * cSignature = "(I)Ljava/lang/Object;";
341             static const char * cMethodName = "getObject";
342 
343 			obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
344         }
345 
346 		out = t.pEnv->CallObjectMethodA( object, mID, args);
347 		t.pEnv->DeleteLocalRef((jstring)args[1].l);
348 		ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
349 		// und aufraeumen
350 		if ( out )
351 		{
352 			if ( t.pEnv->IsInstanceOf(out,java_lang_String::st_getMyClass()) )
353 			{
354 				java_lang_String aVal(t.pEnv,out);
355 				aRet <<= (::rtl::OUString)aVal;
356 			}
357 			else if ( t.pEnv->IsInstanceOf(out,java_lang_Boolean::st_getMyClass()) )
358 			{
359 				java_lang_Boolean aVal(t.pEnv,out);
360 				static jmethodID methodID = NULL;
361 				aRet <<= aVal.callBooleanMethod("booleanValue",methodID);
362 			}
363 			else if ( t.pEnv->IsInstanceOf(out,java_sql_Date::st_getMyClass()) )
364 			{
365 				java_sql_Date aVal(t.pEnv,out);
366 				aRet <<= (::com::sun::star::util::Date)aVal;
367 			}
368 			else if ( t.pEnv->IsInstanceOf(out,java_sql_Time::st_getMyClass()) )
369 			{
370 				java_sql_Time aVal(t.pEnv,out);
371 				aRet <<= (::com::sun::star::util::Time)aVal;
372 			}
373 			else if ( t.pEnv->IsInstanceOf(out,java_sql_Timestamp::st_getMyClass()) )
374 			{
375 				java_sql_Timestamp aVal(t.pEnv,out);
376 				aRet <<= (::com::sun::star::util::DateTime)aVal;
377 			}
378 			else
379 				t.pEnv->DeleteLocalRef(out);
380 		}
381 	} //t.pEnv
382     return aRet;
383 }
384 // -------------------------------------------------------------------------
385 
386 sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
387 {
388     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getShort" );
389     static jmethodID mID(NULL);
390     jshort (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallShortMethod;
391     return callMethodWithIntArg<jshort>(pCallMethod,"getShort","(I)S",mID,columnIndex);
392 }
393 // -------------------------------------------------------------------------
394 
395 
396 ::rtl::OUString SAL_CALL java_sql_ResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
397 {
398     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getString" );
399     static jmethodID mID(NULL);
400     return callStringMethodWithIntArg("getString",mID,columnIndex);
401 }
402 // -------------------------------------------------------------------------
403 
404 
405 ::com::sun::star::util::Time SAL_CALL java_sql_ResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
406 {
407     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTime" );
408     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
409     static jmethodID mID(NULL);
410     jobject out = callObjectMethodWithIntArg(t.pEnv,"getTime","(I)Ljava/sql/Time;", mID, columnIndex);
411 	// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
412 	return out ? static_cast <com::sun::star::util::Time> (java_sql_Time( t.pEnv, out )) : ::com::sun::star::util::Time();
413 }
414 // -------------------------------------------------------------------------
415 
416 
417 ::com::sun::star::util::DateTime SAL_CALL java_sql_ResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
418 {
419     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTimestamp" );
420     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
421     static jmethodID mID(NULL);
422     jobject out = callObjectMethodWithIntArg(t.pEnv,"getTimestamp","(I)Ljava/sql/Timestamp;", mID, columnIndex);
423 	// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
424 	return out ? static_cast <com::sun::star::util::DateTime> (java_sql_Timestamp( t.pEnv, out )) : ::com::sun::star::util::DateTime();
425 }
426 // -------------------------------------------------------------------------
427 
428 sal_Bool SAL_CALL java_sql_ResultSet::isAfterLast(  ) throw(SQLException, RuntimeException)
429 {
430     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isAfterLast" );
431     static jmethodID mID(NULL);
432     return callBooleanMethod( "isAfterLast", mID );
433 }
434 // -------------------------------------------------------------------------
435 sal_Bool SAL_CALL java_sql_ResultSet::isFirst(  ) throw(SQLException, RuntimeException)
436 {
437     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isFirst" );
438     static jmethodID mID(NULL);
439     return callBooleanMethod( "isFirst", mID );
440 }
441 // -------------------------------------------------------------------------
442 sal_Bool SAL_CALL java_sql_ResultSet::isLast(  ) throw(SQLException, RuntimeException)
443 {
444     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isLast" );
445     static jmethodID mID(NULL);
446     return callBooleanMethod( "isLast", mID );
447 }
448 // -------------------------------------------------------------------------
449 void SAL_CALL java_sql_ResultSet::beforeFirst(  ) throw(SQLException, RuntimeException)
450 {
451     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::beforeFirst" );
452     static jmethodID mID(NULL);
453     callVoidMethod("beforeFirst",mID);
454 }
455 // -------------------------------------------------------------------------
456 void SAL_CALL java_sql_ResultSet::afterLast(  ) throw(SQLException, RuntimeException)
457 {
458     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::afterLast" );
459     static jmethodID mID(NULL);
460     callVoidMethod("afterLast",mID);
461 }
462 // -------------------------------------------------------------------------
463 
464 void SAL_CALL java_sql_ResultSet::close(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
465 {
466     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::close" );
467 	dispose();
468 }
469 // -------------------------------------------------------------------------
470 
471 sal_Bool SAL_CALL java_sql_ResultSet::first(  ) throw(SQLException, RuntimeException)
472 {
473     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::first" );
474     static jmethodID mID(NULL);
475     return callBooleanMethod( "first", mID );
476 }
477 // -------------------------------------------------------------------------
478 
479 sal_Bool SAL_CALL java_sql_ResultSet::last(  ) throw(SQLException, RuntimeException)
480 {
481     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::last" );
482     static jmethodID mID(NULL);
483     return callBooleanMethod( "last", mID );
484 }
485 // -------------------------------------------------------------------------
486 sal_Bool SAL_CALL java_sql_ResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
487 {
488     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::absolute" );
489     static jmethodID mID(NULL);
490     return callBooleanMethodWithIntArg( "absolute", mID,row );
491 }
492 // -------------------------------------------------------------------------
493 sal_Bool SAL_CALL java_sql_ResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
494 {
495     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::relative" );
496     static jmethodID mID(NULL);
497     return callBooleanMethodWithIntArg( "relative", mID,row );
498 }
499 // -------------------------------------------------------------------------
500 sal_Bool SAL_CALL java_sql_ResultSet::previous(  ) throw(SQLException, RuntimeException)
501 {
502     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::previous" );
503     static jmethodID mID(NULL);
504     return callBooleanMethod( "previous", mID );
505 }
506 // -------------------------------------------------------------------------
507 Reference< XInterface > SAL_CALL java_sql_ResultSet::getStatement(  ) throw(SQLException, RuntimeException)
508 {
509     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getStatement" );
510 	return m_xStatement;
511 }
512 // -------------------------------------------------------------------------
513 
514 sal_Bool SAL_CALL java_sql_ResultSet::rowDeleted(  ) throw(SQLException, RuntimeException)
515 {
516     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowDeleted" );
517     static jmethodID mID(NULL);
518     return callBooleanMethod( "rowDeleted", mID );
519 }
520 // -------------------------------------------------------------------------
521 sal_Bool SAL_CALL java_sql_ResultSet::rowInserted(  ) throw(SQLException, RuntimeException)
522 {
523     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowInserted" );
524     static jmethodID mID(NULL);
525     return callBooleanMethod( "rowInserted", mID );
526 }
527 // -------------------------------------------------------------------------
528 sal_Bool SAL_CALL java_sql_ResultSet::rowUpdated(  ) throw(SQLException, RuntimeException)
529 {
530     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowUpdated" );
531     static jmethodID mID(NULL);
532     return callBooleanMethod( "rowUpdated", mID );
533 }
534 // -------------------------------------------------------------------------
535 
536 sal_Bool SAL_CALL java_sql_ResultSet::isBeforeFirst(  ) throw(SQLException, RuntimeException)
537 {
538     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isBeforeFirst" );
539     static jmethodID mID(NULL);
540     return callBooleanMethod( "isBeforeFirst", mID );
541 }
542 // -------------------------------------------------------------------------
543 
544 sal_Bool SAL_CALL java_sql_ResultSet::next(  ) throw(SQLException, RuntimeException)
545 {
546     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::next" );
547     static jmethodID mID(NULL);
548     return callBooleanMethod( "next", mID );
549 }
550 // -------------------------------------------------------------------------
551 
552 sal_Bool SAL_CALL java_sql_ResultSet::wasNull(  ) throw(SQLException, RuntimeException)
553 {
554     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::wasNull" );
555     static jmethodID mID(NULL);
556     return callBooleanMethod( "wasNull", mID );
557 }
558 // -------------------------------------------------------------------------
559 
560 void SAL_CALL java_sql_ResultSet::cancel(  ) throw(::com::sun::star::uno::RuntimeException)
561 {
562     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancel" );
563     static jmethodID mID(NULL);
564     callVoidMethod("cancel",mID);
565 }
566 // -------------------------------------------------------------------------
567 // -------------------------------------------------------------------------
568 void SAL_CALL java_sql_ResultSet::clearWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
569 {
570     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::clearWarnings" );
571     static jmethodID mID(NULL);
572     callVoidMethod("clearWarnings",mID);
573 }
574 // -------------------------------------------------------------------------
575 ::com::sun::star::uno::Any SAL_CALL java_sql_ResultSet::getWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
576 {
577     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getWarnings" );
578 	SDBThreadAttach t;
579     static jmethodID mID(NULL);
580     jobject out = callObjectMethod(t.pEnv,"getWarnings","()Ljava/sql/SQLWarning;", mID);
581 	// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
582 	if( out )
583 	{
584 		java_sql_SQLWarning_BASE		warn_base( t.pEnv, out );
585 		return makeAny(
586             static_cast< starsdbc::SQLException >(
587                 java_sql_SQLWarning(warn_base,*this)));
588 	}
589 
590 	return ::com::sun::star::uno::Any();
591 }
592 // -------------------------------------------------------------------------
593 
594 void SAL_CALL java_sql_ResultSet::insertRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
595 {
596     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::insertRow" );
597     static jmethodID mID(NULL);
598     callVoidMethod("insertRow",mID);
599 }
600 // -------------------------------------------------------------------------
601 void SAL_CALL java_sql_ResultSet::updateRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
602 {
603     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateRow" );
604     static jmethodID mID(NULL);
605     callVoidMethod("updateRow",mID);
606 }
607 // -------------------------------------------------------------------------
608 void SAL_CALL java_sql_ResultSet::deleteRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
609 {
610     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::deleteRow" );
611     static jmethodID mID(NULL);
612     callVoidMethod("deleteRow",mID);
613 }
614 // -------------------------------------------------------------------------
615 
616 void SAL_CALL java_sql_ResultSet::cancelRowUpdates(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
617 {
618     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancelRowUpdates" );
619     static jmethodID mID(NULL);
620     callVoidMethod("cancelRowUpdates",mID);
621 }
622 // -------------------------------------------------------------------------
623 
624 void SAL_CALL java_sql_ResultSet::moveToInsertRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
625 {
626     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToInsertRow" );
627     static jmethodID mID(NULL);
628     callVoidMethod("moveToInsertRow",mID);
629 }
630 // -------------------------------------------------------------------------
631 
632 void SAL_CALL java_sql_ResultSet::moveToCurrentRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
633 {
634     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToCurrentRow" );
635     static jmethodID mID(NULL);
636     callVoidMethod("moveToCurrentRow",mID);
637 }
638 // -------------------------------------------------------------------------
639 
640 void SAL_CALL java_sql_ResultSet::updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
641 {
642     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateNull" );
643     static jmethodID mID(NULL);
644     callVoidMethodWithIntArg("updateNull",mID,columnIndex);
645 }
646 // -------------------------------------------------------------------------
647 
648 void SAL_CALL java_sql_ResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
649 {
650     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBoolean" );
651     static jmethodID mID(NULL);
652     callVoidMethod("updateBoolean", "(IZ)V", mID, columnIndex, x);
653 }
654 // -------------------------------------------------------------------------
655 void SAL_CALL java_sql_ResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
656 {
657     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateByte" );
658     static jmethodID mID(NULL);
659     callVoidMethod("updateByte", "(IB)V", mID, columnIndex, x);
660 }
661 // -------------------------------------------------------------------------
662 
663 void SAL_CALL java_sql_ResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
664 {
665     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateShort" );
666     static jmethodID mID(NULL);
667     callVoidMethod("updateShort", "(IS)V", mID, columnIndex, x);
668 }
669 // -------------------------------------------------------------------------
670 void SAL_CALL java_sql_ResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
671 {
672     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateInt" );
673     static jmethodID mID(NULL);
674     callVoidMethod("updateInt", "(II)V", mID, columnIndex, x);
675 }
676 // -------------------------------------------------------------------------
677 void SAL_CALL java_sql_ResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
678 {
679     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateLong" );
680     static jmethodID mID(NULL);
681     callVoidMethod("updateLong", "(IJ)V", mID, columnIndex, x);
682 }
683 // -------------------------------------------------------------------------
684 
685 // -----------------------------------------------------------------------
686 void SAL_CALL java_sql_ResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
687 {
688     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateFloat" );
689     static jmethodID mID(NULL);
690     callVoidMethod("updateFloat", "(IF)V", mID, columnIndex, x);
691 }
692 // -------------------------------------------------------------------------
693 
694 void SAL_CALL java_sql_ResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
695 {
696     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDouble" );
697     static jmethodID mID(NULL);
698     callVoidMethod("updateDouble", "(ID)V", mID, columnIndex, x);
699 }
700 // -------------------------------------------------------------------------
701 
702 void SAL_CALL java_sql_ResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
703 {
704     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateString" );
705 	SDBThreadAttach t;
706 
707 	{
708 
709 		// temporaere Variable initialisieren
710 		// Java-Call absetzen
711 		static jmethodID mID(NULL);
712 		if ( !mID  )
713         {
714             static const char * cSignature = "(ILjava/lang/String;)V";
715             static const char * cMethodName = "updateString";
716 
717 			obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
718         }
719 
720 		{
721 			// Parameter konvertieren
722 			jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,x));
723 			t.pEnv->CallVoidMethod( object, mID,columnIndex,str.get());
724 			ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
725 		}
726 	}
727 }
728 // -------------------------------------------------------------------------
729 
730 void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
731 {
732     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBytes" );
733 	SDBThreadAttach t;
734 
735 	{
736 		// temporaere Variable initialisieren
737 		// Java-Call absetzen
738 		static jmethodID mID(NULL);
739 		if ( !mID  )
740         {
741             static const char * cSignature = "(I[B)V";
742             static const char * cMethodName = "updateBytes";
743 
744 			obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
745         }
746 
747 		{
748 			jbyteArray aArray = t.pEnv->NewByteArray(x.getLength());
749 			t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),(jbyte*)x.getConstArray());
750 			// Parameter konvertieren
751 			t.pEnv->CallVoidMethod( object, mID,columnIndex,aArray);
752 			t.pEnv->DeleteLocalRef(aArray);
753 			ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
754 		}
755 	}
756 }
757 // -------------------------------------------------------------------------
758 
759 void SAL_CALL java_sql_ResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
760 {
761     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDate" );
762     java_sql_Date aD(x);
763     static jmethodID mID(NULL);
764     callVoidMethod("updateDate", "(ILjava/sql/Date;)V", mID, columnIndex, aD.getJavaObject());
765 }
766 // -------------------------------------------------------------------------
767 
768 void SAL_CALL java_sql_ResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
769 {
770     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTime" );
771     java_sql_Time aD(x);
772     static jmethodID mID(NULL);
773     callVoidMethod("updateTime", "(ILjava/sql/Time;)V", mID, columnIndex, aD.getJavaObject());
774 }
775 // -------------------------------------------------------------------------
776 
777 void SAL_CALL java_sql_ResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
778 {
779     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTimestamp" );
780     java_sql_Timestamp aD(x);
781     static jmethodID mID(NULL);
782     callVoidMethod("updateTimestamp", "(ILjava/sql/Timestamp;)V", mID, columnIndex, aD.getJavaObject());
783 }
784 // -------------------------------------------------------------------------
785 
786 void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
787 {
788     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBinaryStream" );
789     try
790     {
791         SDBThreadAttach t;
792 	    {
793 
794 		    // temporaere Variable initialisieren
795 		    // Java-Call absetzen
796 		    static jmethodID mID(NULL);
797 		    if ( !mID  )
798             {
799                 static const char * cSignature = "(ILjava/io/InputStream;I)V";
800                 static const char * cMethodName = "updateBinaryStream";
801 			    obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
802             }
803 
804 		    {
805 			    // Parameter konvertieren
806                 jobject obj = createByteInputStream(x,length);
807                 t.pEnv->CallVoidMethod( object, mID, columnIndex,obj,length);
808                 ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
809 		    }
810 	    }
811     }
812     catch(Exception)
813     {
814 	    ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateBinaryStream", *this );
815     }
816 }
817 // -------------------------------------------------------------------------
818 void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
819 {
820     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateCharacterStream" );
821     try
822     {
823         SDBThreadAttach t;
824 	    {
825 
826 		    // temporaere Variable initialisieren
827 		    // Java-Call absetzen
828 		    static jmethodID mID(NULL);
829 		    if ( !mID  )
830             {
831                 static const char * cSignature = "(ILjava/io/Reader;I)V";
832                 static const char * cMethodName = "updateCharacterStream";
833 			    obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
834             }
835 
836 		    {
837 			    // Parameter konvertieren
838                 jobject obj = createCharArrayReader(x,length);
839                 t.pEnv->CallVoidMethod( object, mID, columnIndex,obj,length);
840                 ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
841 		    }
842 	    }
843     }
844     catch(Exception)
845     {
846 	    ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateCharacterStream", *this );
847     }
848 }
849 // -------------------------------------------------------------------------
850 void SAL_CALL java_sql_ResultSet::updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
851 {
852     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateObject" );
853 	if(!::dbtools::implUpdateObject(this,columnIndex,x))
854 	{
855         ::connectivity::SharedResources aResources;
856         const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
857                 STR_UNKNOWN_COLUMN_TYPE,
858                 "$position$", ::rtl::OUString::valueOf(columnIndex)
859              ) );
860 		::dbtools::throwGenericSQLException(sError,*this);
861 	}
862 }
863 // -------------------------------------------------------------------------
864 
865 void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
866 {
867     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateNumericObject" );
868 	//	OSL_ENSURE(0,"java_sql_ResultSet::updateNumericObject: NYI");
869     try
870     {
871         SDBThreadAttach t;
872 
873 	    {
874 
875 		    // temporaere Variable initialisieren
876 		    // Java-Call absetzen
877 		    static jmethodID mID(NULL);
878 		    if ( !mID  )
879             {
880                 static const char * cSignature = "(ILjava/lang/Object;I)V";
881                 static const char * cMethodName = "updateObject";
882 
883 			    obtainMethodId(t.pEnv, cMethodName,cSignature, mID);
884             }
885 
886 		    {
887 			    // Parameter konvertieren
888                 double nTemp = 0.0;
889                 ::std::auto_ptr<java_math_BigDecimal> pBigDecimal;
890                 if ( x >>= nTemp)
891                 {
892                     pBigDecimal.reset(new java_math_BigDecimal(nTemp));
893                 }
894                 else
895                     pBigDecimal.reset(new java_math_BigDecimal(::comphelper::getString(x)));
896                     //obj = convertwchar_tToJavaString(t.pEnv,::comphelper::getString(x));
897                 t.pEnv->CallVoidMethod( object, mID, columnIndex,pBigDecimal->getJavaObject(),scale);
898                 ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
899 		    }
900 	    }
901     }
902     catch(Exception)
903     {
904 	    updateObject( columnIndex,x);
905     }
906 }
907 //------------------------------------------------------------------------------
908 sal_Int32 java_sql_ResultSet::getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
909 {
910     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetConcurrency" );
911     static jmethodID mID(NULL);
912     return callIntMethod("getConcurrency",mID,true);
913 }
914 //------------------------------------------------------------------------------
915 sal_Int32 java_sql_ResultSet::getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
916 {
917     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetType" );
918     static jmethodID mID(NULL);
919     return callIntMethod("getType",mID,true);
920 }
921 //------------------------------------------------------------------------------
922 sal_Int32 java_sql_ResultSet::getFetchDirection() const	throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
923 {
924     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchDirection" );
925     static jmethodID mID(NULL);
926     return callIntMethod("getFetchDirection",mID,true);
927 }
928 //------------------------------------------------------------------------------
929 sal_Int32 java_sql_ResultSet::getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
930 {
931     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchSize" );
932     static jmethodID mID(NULL);
933     return callIntMethod("getFetchSize",mID,true);
934 }
935 //------------------------------------------------------------------------------
936 ::rtl::OUString java_sql_ResultSet::getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
937 {
938     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCursorName" );
939     static jmethodID mID(NULL);
940     return callStringMethod("getCursorName",mID);
941 }
942 
943 //------------------------------------------------------------------------------
944 void java_sql_ResultSet::setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
945 {
946     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchDirection" );
947     static jmethodID mID(NULL);
948     callVoidMethodWithIntArg("setFetchDirection",mID,_par0,true);
949 }
950 //------------------------------------------------------------------------------
951 void SAL_CALL java_sql_ResultSet::refreshRow(  ) throw(SQLException, RuntimeException)
952 {
953     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::refreshRow" );
954     static jmethodID mID(NULL);
955     callVoidMethod("refreshRow",mID);
956 }
957 //------------------------------------------------------------------------------
958 void java_sql_ResultSet::setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
959 {
960     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchSize" );
961     static jmethodID mID(NULL);
962     callVoidMethodWithIntArg("setFetchSize",mID,_par0,true);
963 }
964 // -------------------------------------------------------------------------
965 ::cppu::IPropertyArrayHelper* java_sql_ResultSet::createArrayHelper( ) const
966 {
967     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::createArrayHelper" );
968 	Sequence< Property > aProps(5);
969     Property* pProperties = aProps.getArray();
970 	sal_Int32 nPos = 0;
971 	DECL_PROP1IMPL(CURSORNAME,			::rtl::OUString) PropertyAttribute::READONLY);
972 	DECL_PROP0(FETCHDIRECTION,		sal_Int32);
973 	DECL_PROP0(FETCHSIZE,			sal_Int32);
974 	DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
975 	DECL_PROP1IMPL(RESULTSETTYPE,		sal_Int32) PropertyAttribute::READONLY);
976 
977 	return new ::cppu::OPropertyArrayHelper(aProps);
978 }
979 // -------------------------------------------------------------------------
980 ::cppu::IPropertyArrayHelper & java_sql_ResultSet::getInfoHelper()
981 {
982     //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getInfoHelper" );
983 	return *const_cast<java_sql_ResultSet*>(this)->getArrayHelper();
984 }
985 // -------------------------------------------------------------------------
986 sal_Bool java_sql_ResultSet::convertFastPropertyValue(
987 							::com::sun::star::uno::Any & rConvertedValue,
988 							::com::sun::star::uno::Any & rOldValue,
989 							sal_Int32 nHandle,
990 							const ::com::sun::star::uno::Any& rValue )
991 								throw (::com::sun::star::lang::IllegalArgumentException)
992 {
993     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::convertFastPropertyValue" );
994 	sal_Bool bRet = sal_False;
995 	switch(nHandle)
996 	{
997 		case PROPERTY_ID_CURSORNAME:
998 		case PROPERTY_ID_RESULTSETCONCURRENCY:
999 		case PROPERTY_ID_RESULTSETTYPE:
1000 			throw ::com::sun::star::lang::IllegalArgumentException();
1001 		case PROPERTY_ID_FETCHDIRECTION:
1002 			bRet = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
1003 			break;
1004 		case PROPERTY_ID_FETCHSIZE:
1005 			bRet = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
1006 		default:
1007 			;
1008 	}
1009 	return bRet;
1010 }
1011 
1012 // -------------------------------------------------------------------------
1013 void java_sql_ResultSet::setFastPropertyValue_NoBroadcast(
1014 								sal_Int32 nHandle,
1015 								const ::com::sun::star::uno::Any& rValue
1016 												 )
1017 												 throw (::com::sun::star::uno::Exception)
1018 {
1019     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFastPropertyValue_NoBroadcast" );
1020 	switch(nHandle)
1021 	{
1022 		case PROPERTY_ID_CURSORNAME:
1023 		case PROPERTY_ID_RESULTSETCONCURRENCY:
1024 		case PROPERTY_ID_RESULTSETTYPE:
1025 			throw ::com::sun::star::uno::Exception();
1026 		case PROPERTY_ID_FETCHDIRECTION:
1027 			setFetchDirection(comphelper::getINT32(rValue));
1028 			break;
1029 		case PROPERTY_ID_FETCHSIZE:
1030 			setFetchSize(comphelper::getINT32(rValue));
1031 			break;
1032 		default:
1033 			;
1034 	}
1035 }
1036 // -------------------------------------------------------------------------
1037 void java_sql_ResultSet::getFastPropertyValue(
1038 								::com::sun::star::uno::Any& rValue,
1039 								sal_Int32 nHandle
1040 									 ) const
1041 {
1042     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFastPropertyValue" );
1043 	try
1044 	{
1045 		switch(nHandle)
1046 		{
1047 			case PROPERTY_ID_CURSORNAME:
1048 				rValue <<= getCursorName();
1049 				break;
1050 			case PROPERTY_ID_RESULTSETCONCURRENCY:
1051 				rValue <<= getResultSetConcurrency();
1052 				break;
1053 			case PROPERTY_ID_RESULTSETTYPE:
1054 				rValue <<= getResultSetType();
1055 				break;
1056 			case PROPERTY_ID_FETCHDIRECTION:
1057 				rValue <<= getFetchDirection();
1058 				break;
1059 			case PROPERTY_ID_FETCHSIZE:
1060 				rValue <<= getFetchSize();
1061 				break;
1062 		}
1063 	}
1064 	catch(Exception&)
1065 	{
1066 	}
1067 }
1068 // -----------------------------------------------------------------------------
1069 void SAL_CALL java_sql_ResultSet::acquire() throw()
1070 {
1071 	java_sql_ResultSet_BASE::acquire();
1072 }
1073 // -----------------------------------------------------------------------------
1074 void SAL_CALL java_sql_ResultSet::release() throw()
1075 {
1076 	java_sql_ResultSet_BASE::release();
1077 }
1078 // -----------------------------------------------------------------------------
1079 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL java_sql_ResultSet::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException)
1080 {
1081     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getPropertySetInfo" );
1082 	return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
1083 }
1084 // -----------------------------------------------------------------------------
1085 
1086 
1087 
1088