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