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