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