1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ResultSet.cxx,v $
10 * $Revision: 1.36.22.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
33 #include "java/sql/ResultSet.hxx"
34 #include "java/math/BigDecimal.hxx"
35 #include "java/sql/JStatement.hxx"
36 #include "java/sql/SQLWarning.hxx"
37 #include "java/sql/Array.hxx"
38 #include "java/sql/Ref.hxx"
39 #include "java/sql/Clob.hxx"
40 #include "java/sql/Timestamp.hxx"
41 #include "java/sql/Blob.hxx"
42 #include "java/sql/ResultSetMetaData.hxx"
43 #include "java/io/InputStream.hxx"
44 #include "java/io/Reader.hxx"
45 #include "java/tools.hxx"
46 #include <comphelper/property.hxx>
47 #include "connectivity/CommonTools.hxx"
48 #include <cppuhelper/typeprovider.hxx>
49 #include <comphelper/sequence.hxx>
50 #include <com/sun/star/beans/PropertyAttribute.hpp>
51 #include "TConnection.hxx"
52 #include <comphelper/types.hxx>
53 #include "connectivity/dbtools.hxx"
54 #include "connectivity/dbexception.hxx"
55 #include "resource/common_res.hrc"
56 #include "resource/sharedresources.hxx"
58 #include <rtl/logfile.hxx>
61 using namespace ::comphelper
;
63 using namespace connectivity
;
64 using namespace ::com::sun::star::uno
;
65 using namespace ::com::sun::star::beans
;
66 // using namespace ::com::sun::star::sdbcx;
67 using namespace ::com::sun::star::sdbc
;
68 using namespace ::com::sun::star::container
;
69 using namespace ::com::sun::star::lang
;
71 IMPLEMENT_SERVICE_INFO(java_sql_ResultSet
,"com.sun.star.sdbcx.JResultSet","com.sun.star.sdbc.ResultSet");
72 //**************************************************************
73 //************ Class: java.sql.ResultSet
74 //**************************************************************
76 jclass
java_sql_ResultSet::theClass
= 0;
77 java_sql_ResultSet::java_sql_ResultSet( JNIEnv
* pEnv
, jobject myObj
, const java::sql::ConnectionLog
& _rParentLogger
,java_sql_Connection
& _rConnection
, java_sql_Statement_Base
* pStmt
)
78 :java_sql_ResultSet_BASE(m_aMutex
)
79 ,java_lang_Object( pEnv
, myObj
)
80 ,OPropertySetHelper(java_sql_ResultSet_BASE::rBHelper
)
81 ,m_aLogger( _rParentLogger
, java::sql::ConnectionLog::RESULTSET
)
82 ,m_pConnection(&_rConnection
)
84 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::java_sql_ResultSet" );
85 SDBThreadAttach::addRef();
86 osl_incrementInterlockedCount(&m_refCount
);
88 m_xStatement
= *pStmt
;
90 osl_decrementInterlockedCount(&m_refCount
);
92 // -----------------------------------------------------------------------------
93 java_sql_ResultSet::~java_sql_ResultSet()
95 if ( !java_sql_ResultSet_BASE::rBHelper
.bDisposed
&& !java_sql_ResultSet_BASE::rBHelper
.bInDispose
)
97 // increment ref count to prevent double call of Dtor
98 osl_incrementInterlockedCount( &m_refCount
);
103 jclass
java_sql_ResultSet::getMyClass() const
105 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getMyClass" );
106 // die Klasse muss nur einmal geholt werden, daher statisch
108 theClass
= findMyClass("java/sql/ResultSet");
112 // -------------------------------------------------------------------------
113 void java_sql_ResultSet::disposing(void)
115 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::disposing" );
116 OPropertySetHelper::disposing();
118 ::osl::MutexGuard
aGuard(m_aMutex
);
122 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
123 static jmethodID
mID(NULL
);
124 callVoidMethod("close",mID
);
125 clearObject(*t
.pEnv
);
128 SDBThreadAttach::releaseRef();
130 // -------------------------------------------------------------------------
131 ::com::sun::star::uno::Any SAL_CALL
java_sql_ResultSet::queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
)
133 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::queryInterface" );
134 ::com::sun::star::uno::Any aRet
= OPropertySetHelper::queryInterface(rType
);
135 return aRet
.hasValue() ? aRet
: java_sql_ResultSet_BASE::queryInterface(rType
);
137 // -------------------------------------------------------------------------
138 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
java_sql_ResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException
)
140 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTypes" );
141 ::cppu::OTypeCollection
aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XMultiPropertySet
> *)0 ),
142 ::getCppuType( (const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XFastPropertySet
> *)0 ),
143 ::getCppuType( (const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> *)0 ));
145 return ::comphelper::concatSequences(aTypes
.getTypes(),java_sql_ResultSet_BASE::getTypes());
147 // -------------------------------------------------------------------------
149 sal_Int32 SAL_CALL
java_sql_ResultSet::findColumn( const ::rtl::OUString
& columnName
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
151 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::findColumn" );
152 static jmethodID
mID(NULL
);
153 return callIntMethodWithStringArg("findColumn",mID
,columnName
);
155 // -------------------------------------------------------------------------
156 Reference
< ::com::sun::star::io::XInputStream
> SAL_CALL
java_sql_ResultSet::getBinaryStream( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
158 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBinaryStream" );
159 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
160 static jmethodID
mID(NULL
);
161 jobject out
= callObjectMethodWithIntArg(t
.pEnv
,"getBinaryStream","(I)Ljava/io/InputStream;", mID
, columnIndex
);
163 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
164 return out
==0 ? 0 : new java_io_InputStream( t
.pEnv
, out
);
166 // -------------------------------------------------------------------------
167 Reference
< ::com::sun::star::io::XInputStream
> SAL_CALL
java_sql_ResultSet::getCharacterStream( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
169 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCharacterStream" );
170 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
171 static jmethodID
mID(NULL
);
172 jobject out
= callObjectMethodWithIntArg(t
.pEnv
,"getCharacterStream","(I)Ljava/io/Reader;", mID
, columnIndex
);
174 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
175 return out
==0 ? 0 : new java_io_Reader( t
.pEnv
, out
);
177 // -------------------------------------------------------------------------
179 sal_Bool SAL_CALL
java_sql_ResultSet::getBoolean( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
181 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBoolean" );
182 static jmethodID
mID(NULL
);
183 return callBooleanMethodWithIntArg( "getBoolean", mID
,columnIndex
);
185 // -------------------------------------------------------------------------
187 sal_Int8 SAL_CALL
java_sql_ResultSet::getByte( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
189 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getByte" );
190 static jmethodID
mID(NULL
);
191 jbyte (JNIEnv::*pCallMethod
)( jobject obj
, jmethodID methodID
, ... ) = &JNIEnv::CallByteMethod
;
192 return callMethodWithIntArg
<jbyte
>(pCallMethod
,"getByte","(I)B",mID
,columnIndex
);
194 // -------------------------------------------------------------------------
196 Sequence
< sal_Int8
> SAL_CALL
java_sql_ResultSet::getBytes( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
198 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBytes" );
199 Sequence
< sal_Int8
> aSeq
;
200 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
201 static jmethodID
mID(NULL
);
202 jbyteArray out
= (jbyteArray
)callObjectMethodWithIntArg(t
.pEnv
,"getBytes","(I)[B", mID
, columnIndex
);
205 jboolean p
= sal_False
;
206 aSeq
.realloc(t
.pEnv
->GetArrayLength(out
));
207 memcpy(aSeq
.getArray(),t
.pEnv
->GetByteArrayElements(out
,&p
),aSeq
.getLength());
208 t
.pEnv
->DeleteLocalRef(out
);
212 // -------------------------------------------------------------------------
214 ::com::sun::star::util::Date SAL_CALL
java_sql_ResultSet::getDate( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
216 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDate" );
217 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
218 static jmethodID
mID(NULL
);
219 jobject out
= callObjectMethodWithIntArg(t
.pEnv
,"getDate","(I)Ljava/sql/Date;", mID
, columnIndex
);
220 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
221 return out
? static_cast <com::sun::star::util::Date
> (java_sql_Date( t
.pEnv
, out
)) : ::com::sun::star::util::Date();
223 // -------------------------------------------------------------------------
225 double SAL_CALL
java_sql_ResultSet::getDouble( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
227 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getDouble" );
228 static jmethodID
mID(NULL
);
229 jdouble (JNIEnv::*pCallMethod
)( jobject obj
, jmethodID methodID
, ... ) = &JNIEnv::CallDoubleMethod
;
230 return callMethodWithIntArg
<double>(pCallMethod
,"getDouble","(I)D",mID
,columnIndex
);
232 // -------------------------------------------------------------------------
234 float SAL_CALL
java_sql_ResultSet::getFloat( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
236 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFloat" );
237 static jmethodID
mID(NULL
);
238 jfloat (JNIEnv::*pCallMethod
)( jobject obj
, jmethodID methodID
, ... ) = &JNIEnv::CallFloatMethod
;
239 return callMethodWithIntArg
<jfloat
>(pCallMethod
,"getFloat","(I)F",mID
,columnIndex
);
241 // -------------------------------------------------------------------------
243 sal_Int32 SAL_CALL
java_sql_ResultSet::getInt( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
245 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getInt" );
246 static jmethodID
mID(NULL
);
247 return callIntMethodWithIntArg("getInt",mID
,columnIndex
);
249 // -------------------------------------------------------------------------
251 sal_Int32 SAL_CALL
java_sql_ResultSet::getRow( ) throw(SQLException
, RuntimeException
)
253 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRow" );
254 static jmethodID
mID(NULL
);
255 return callIntMethod("getRow",mID
);
257 // -------------------------------------------------------------------------
259 sal_Int64 SAL_CALL
java_sql_ResultSet::getLong( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
261 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getLong" );
262 static jmethodID
mID(NULL
);
263 jlong (JNIEnv::*pCallMethod
)( jobject obj
, jmethodID methodID
, ... ) = &JNIEnv::CallLongMethod
;
264 return callMethodWithIntArg
<jlong
>(pCallMethod
,"getLong","(I)J",mID
,columnIndex
);
266 // -------------------------------------------------------------------------
268 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XResultSetMetaData
> SAL_CALL
java_sql_ResultSet::getMetaData( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
270 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getMetaData" );
271 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
272 static jmethodID
mID(NULL
);
273 jobject out
= callObjectMethod(t
.pEnv
,"getMetaData","()Ljava/sql/ResultSetMetaData;", mID
);
275 return out
==0 ? 0 : new java_sql_ResultSetMetaData( t
.pEnv
, out
, m_aLogger
,*m_pConnection
);
277 // -------------------------------------------------------------------------
278 Reference
< XArray
> SAL_CALL
java_sql_ResultSet::getArray( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
280 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getArray" );
281 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
282 static jmethodID
mID(NULL
);
283 jobject out
= callObjectMethodWithIntArg(t
.pEnv
,"getArray","(I)Ljava/sql/Array;", mID
, columnIndex
);
285 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
286 return out
==0 ? 0 : new java_sql_Array( t
.pEnv
, out
);
288 // -------------------------------------------------------------------------
290 Reference
< XClob
> SAL_CALL
java_sql_ResultSet::getClob( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
292 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getClob" );
293 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
294 static jmethodID
mID(NULL
);
295 jobject out
= callObjectMethodWithIntArg(t
.pEnv
,"getClob","(I)Ljava/sql/Clob;", mID
, columnIndex
);
296 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
297 return out
==0 ? 0 : new java_sql_Clob( t
.pEnv
, out
);
299 // -------------------------------------------------------------------------
300 Reference
< XBlob
> SAL_CALL
java_sql_ResultSet::getBlob( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
302 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getBlob" );
303 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
304 static jmethodID
mID(NULL
);
305 jobject out
= callObjectMethodWithIntArg(t
.pEnv
,"getBlob","(I)Ljava/sql/Blob;", mID
, columnIndex
);
306 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
307 return out
==0 ? 0 : new java_sql_Blob( t
.pEnv
, out
);
309 // -------------------------------------------------------------------------
311 Reference
< XRef
> SAL_CALL
java_sql_ResultSet::getRef( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
313 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getRef" );
314 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
315 static jmethodID
mID(NULL
);
316 jobject out
= callObjectMethodWithIntArg(t
.pEnv
,"getRef","(I)Ljava/sql/Ref;", mID
, columnIndex
);
318 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
319 return out
==0 ? 0 : new java_sql_Ref( t
.pEnv
, out
);
321 // -------------------------------------------------------------------------
323 Any SAL_CALL
java_sql_ResultSet::getObject( sal_Int32 columnIndex
, const Reference
< ::com::sun::star::container::XNameAccess
>& typeMap
) throw(SQLException
, RuntimeException
)
325 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getObject" );
327 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
330 // Parameter konvertieren
331 args
[0].i
= (sal_Int32
)columnIndex
;
332 args
[1].l
= convertTypeMapToJavaMap(t
.pEnv
,typeMap
);
333 // temporaere Variable initialisieren
334 // Java-Call absetzen
335 static jmethodID
mID(NULL
);
338 static const char * cSignature
= "(I)Ljava/lang/Object;";
339 static const char * cMethodName
= "getObject";
341 obtainMethodId(t
.pEnv
, cMethodName
,cSignature
, mID
);
344 out
= t
.pEnv
->CallObjectMethodA( object
, mID
, args
);
345 t
.pEnv
->DeleteLocalRef((jstring
)args
[1].l
);
346 ThrowLoggedSQLException( m_aLogger
, t
.pEnv
, *this );
350 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
351 ::dbtools::throwFunctionNotSupportedException( "XRow::getObject", *this );
352 return out
==0 ? Any() : Any();//new java_lang_Object( t.pEnv, out );
354 // -------------------------------------------------------------------------
356 sal_Int16 SAL_CALL
java_sql_ResultSet::getShort( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
358 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getShort" );
359 static jmethodID
mID(NULL
);
360 jshort (JNIEnv::*pCallMethod
)( jobject obj
, jmethodID methodID
, ... ) = &JNIEnv::CallShortMethod
;
361 return callMethodWithIntArg
<jshort
>(pCallMethod
,"getShort","(I)S",mID
,columnIndex
);
363 // -------------------------------------------------------------------------
366 ::rtl::OUString SAL_CALL
java_sql_ResultSet::getString( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
368 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getString" );
369 static jmethodID
mID(NULL
);
370 return callStringMethodWithIntArg("getString",mID
,columnIndex
);
372 // -------------------------------------------------------------------------
375 ::com::sun::star::util::Time SAL_CALL
java_sql_ResultSet::getTime( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
377 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTime" );
378 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
379 static jmethodID
mID(NULL
);
380 jobject out
= callObjectMethodWithIntArg(t
.pEnv
,"getTime","(I)Ljava/sql/Time;", mID
, columnIndex
);
381 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
382 return out
? static_cast <com::sun::star::util::Time
> (java_sql_Time( t
.pEnv
, out
)) : ::com::sun::star::util::Time();
384 // -------------------------------------------------------------------------
387 ::com::sun::star::util::DateTime SAL_CALL
java_sql_ResultSet::getTimestamp( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
389 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getTimestamp" );
390 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
391 static jmethodID
mID(NULL
);
392 jobject out
= callObjectMethodWithIntArg(t
.pEnv
,"getTimestamp","(I)Ljava/sql/Timestamp;", mID
, columnIndex
);
393 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
394 return out
? static_cast <com::sun::star::util::DateTime
> (java_sql_Timestamp( t
.pEnv
, out
)) : ::com::sun::star::util::DateTime();
396 // -------------------------------------------------------------------------
398 sal_Bool SAL_CALL
java_sql_ResultSet::isAfterLast( ) throw(SQLException
, RuntimeException
)
400 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isAfterLast" );
401 static jmethodID
mID(NULL
);
402 return callBooleanMethod( "isAfterLast", mID
);
404 // -------------------------------------------------------------------------
405 sal_Bool SAL_CALL
java_sql_ResultSet::isFirst( ) throw(SQLException
, RuntimeException
)
407 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isFirst" );
408 static jmethodID
mID(NULL
);
409 return callBooleanMethod( "isFirst", mID
);
411 // -------------------------------------------------------------------------
412 sal_Bool SAL_CALL
java_sql_ResultSet::isLast( ) throw(SQLException
, RuntimeException
)
414 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isLast" );
415 static jmethodID
mID(NULL
);
416 return callBooleanMethod( "isLast", mID
);
418 // -------------------------------------------------------------------------
419 void SAL_CALL
java_sql_ResultSet::beforeFirst( ) throw(SQLException
, RuntimeException
)
421 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::beforeFirst" );
422 static jmethodID
mID(NULL
);
423 callVoidMethod("beforeFirst",mID
);
425 // -------------------------------------------------------------------------
426 void SAL_CALL
java_sql_ResultSet::afterLast( ) throw(SQLException
, RuntimeException
)
428 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::afterLast" );
429 static jmethodID
mID(NULL
);
430 callVoidMethod("afterLast",mID
);
432 // -------------------------------------------------------------------------
434 void SAL_CALL
java_sql_ResultSet::close( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
436 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::close" );
439 // -------------------------------------------------------------------------
441 sal_Bool SAL_CALL
java_sql_ResultSet::first( ) throw(SQLException
, RuntimeException
)
443 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::first" );
444 static jmethodID
mID(NULL
);
445 return callBooleanMethod( "first", mID
);
447 // -------------------------------------------------------------------------
449 sal_Bool SAL_CALL
java_sql_ResultSet::last( ) throw(SQLException
, RuntimeException
)
451 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::last" );
452 static jmethodID
mID(NULL
);
453 return callBooleanMethod( "last", mID
);
455 // -------------------------------------------------------------------------
456 sal_Bool SAL_CALL
java_sql_ResultSet::absolute( sal_Int32 row
) throw(SQLException
, RuntimeException
)
458 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::absolute" );
459 static jmethodID
mID(NULL
);
460 return callBooleanMethodWithIntArg( "absolute", mID
,row
);
462 // -------------------------------------------------------------------------
463 sal_Bool SAL_CALL
java_sql_ResultSet::relative( sal_Int32 row
) throw(SQLException
, RuntimeException
)
465 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::relative" );
466 static jmethodID
mID(NULL
);
467 return callBooleanMethodWithIntArg( "relative", mID
,row
);
469 // -------------------------------------------------------------------------
470 sal_Bool SAL_CALL
java_sql_ResultSet::previous( ) throw(SQLException
, RuntimeException
)
472 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::previous" );
473 static jmethodID
mID(NULL
);
474 return callBooleanMethod( "previous", mID
);
476 // -------------------------------------------------------------------------
477 Reference
< XInterface
> SAL_CALL
java_sql_ResultSet::getStatement( ) throw(SQLException
, RuntimeException
)
479 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getStatement" );
482 // -------------------------------------------------------------------------
484 sal_Bool SAL_CALL
java_sql_ResultSet::rowDeleted( ) throw(SQLException
, RuntimeException
)
486 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowDeleted" );
487 static jmethodID
mID(NULL
);
488 return callBooleanMethod( "rowDeleted", mID
);
490 // -------------------------------------------------------------------------
491 sal_Bool SAL_CALL
java_sql_ResultSet::rowInserted( ) throw(SQLException
, RuntimeException
)
493 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowInserted" );
494 static jmethodID
mID(NULL
);
495 return callBooleanMethod( "rowInserted", mID
);
497 // -------------------------------------------------------------------------
498 sal_Bool SAL_CALL
java_sql_ResultSet::rowUpdated( ) throw(SQLException
, RuntimeException
)
500 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::rowUpdated" );
501 static jmethodID
mID(NULL
);
502 return callBooleanMethod( "rowUpdated", mID
);
504 // -------------------------------------------------------------------------
506 sal_Bool SAL_CALL
java_sql_ResultSet::isBeforeFirst( ) throw(SQLException
, RuntimeException
)
508 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::isBeforeFirst" );
509 static jmethodID
mID(NULL
);
510 return callBooleanMethod( "isBeforeFirst", mID
);
512 // -------------------------------------------------------------------------
514 sal_Bool SAL_CALL
java_sql_ResultSet::next( ) throw(SQLException
, RuntimeException
)
516 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::next" );
517 static jmethodID
mID(NULL
);
518 return callBooleanMethod( "next", mID
);
520 // -------------------------------------------------------------------------
522 sal_Bool SAL_CALL
java_sql_ResultSet::wasNull( ) throw(SQLException
, RuntimeException
)
524 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::wasNull" );
525 static jmethodID
mID(NULL
);
526 return callBooleanMethod( "wasNull", mID
);
528 // -------------------------------------------------------------------------
530 void SAL_CALL
java_sql_ResultSet::cancel( ) throw(::com::sun::star::uno::RuntimeException
)
532 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancel" );
533 static jmethodID
mID(NULL
);
534 callVoidMethod("cancel",mID
);
536 // -------------------------------------------------------------------------
537 // -------------------------------------------------------------------------
538 void SAL_CALL
java_sql_ResultSet::clearWarnings( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
540 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::clearWarnings" );
541 static jmethodID
mID(NULL
);
542 callVoidMethod("clearWarnings",mID
);
544 // -------------------------------------------------------------------------
545 ::com::sun::star::uno::Any SAL_CALL
java_sql_ResultSet::getWarnings( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
547 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getWarnings" );
549 static jmethodID
mID(NULL
);
550 jobject out
= callObjectMethod(t
.pEnv
,"getWarnings","()Ljava/sql/SQLWarning;", mID
);
551 // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
554 java_sql_SQLWarning_BASE
warn_base( t
.pEnv
, out
);
556 static_cast< starsdbc::SQLException
>(
557 java_sql_SQLWarning(warn_base
,*this)));
560 return ::com::sun::star::uno::Any();
562 // -------------------------------------------------------------------------
564 void SAL_CALL
java_sql_ResultSet::insertRow( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
566 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::insertRow" );
567 static jmethodID
mID(NULL
);
568 callVoidMethod("insertRow",mID
);
570 // -------------------------------------------------------------------------
571 void SAL_CALL
java_sql_ResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
573 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateRow" );
574 static jmethodID
mID(NULL
);
575 callVoidMethod("updateRow",mID
);
577 // -------------------------------------------------------------------------
578 void SAL_CALL
java_sql_ResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
580 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::deleteRow" );
581 static jmethodID
mID(NULL
);
582 callVoidMethod("deleteRow",mID
);
584 // -------------------------------------------------------------------------
586 void SAL_CALL
java_sql_ResultSet::cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
588 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::cancelRowUpdates" );
589 static jmethodID
mID(NULL
);
590 callVoidMethod("cancelRowUpdates",mID
);
592 // -------------------------------------------------------------------------
594 void SAL_CALL
java_sql_ResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
596 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToInsertRow" );
597 static jmethodID
mID(NULL
);
598 callVoidMethod("moveToInsertRow",mID
);
600 // -------------------------------------------------------------------------
602 void SAL_CALL
java_sql_ResultSet::moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
604 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::moveToCurrentRow" );
605 static jmethodID
mID(NULL
);
606 callVoidMethod("moveToCurrentRow",mID
);
608 // -------------------------------------------------------------------------
610 void SAL_CALL
java_sql_ResultSet::updateNull( sal_Int32 columnIndex
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
612 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateNull" );
613 static jmethodID
mID(NULL
);
614 callVoidMethodWithIntArg("updateNull",mID
,columnIndex
);
616 // -------------------------------------------------------------------------
618 void SAL_CALL
java_sql_ResultSet::updateBoolean( sal_Int32 columnIndex
, sal_Bool x
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
620 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBoolean" );
621 static jmethodID
mID(NULL
);
622 callVoidMethod("updateBoolean", "(IZ)V", mID
, columnIndex
, x
);
624 // -------------------------------------------------------------------------
625 void SAL_CALL
java_sql_ResultSet::updateByte( sal_Int32 columnIndex
, sal_Int8 x
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
627 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateByte" );
628 static jmethodID
mID(NULL
);
629 callVoidMethod("updateByte", "(IB)V", mID
, columnIndex
, x
);
631 // -------------------------------------------------------------------------
633 void SAL_CALL
java_sql_ResultSet::updateShort( sal_Int32 columnIndex
, sal_Int16 x
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
635 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateShort" );
636 static jmethodID
mID(NULL
);
637 callVoidMethod("updateShort", "(IS)V", mID
, columnIndex
, x
);
639 // -------------------------------------------------------------------------
640 void SAL_CALL
java_sql_ResultSet::updateInt( sal_Int32 columnIndex
, sal_Int32 x
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
642 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateInt" );
643 static jmethodID
mID(NULL
);
644 callVoidMethod("updateInt", "(II)V", mID
, columnIndex
, x
);
646 // -------------------------------------------------------------------------
647 void SAL_CALL
java_sql_ResultSet::updateLong( sal_Int32 columnIndex
, sal_Int64 x
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
649 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateLong" );
650 static jmethodID
mID(NULL
);
651 callVoidMethod("updateLong", "(IJ)V", mID
, columnIndex
, x
);
653 // -------------------------------------------------------------------------
655 // -----------------------------------------------------------------------
656 void SAL_CALL
java_sql_ResultSet::updateFloat( sal_Int32 columnIndex
, float x
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
658 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateFloat" );
659 static jmethodID
mID(NULL
);
660 callVoidMethod("updateFloat", "(IF)V", mID
, columnIndex
, x
);
662 // -------------------------------------------------------------------------
664 void SAL_CALL
java_sql_ResultSet::updateDouble( sal_Int32 columnIndex
, double x
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
666 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDouble" );
667 static jmethodID
mID(NULL
);
668 callVoidMethod("updateDouble", "(ID)V", mID
, columnIndex
, x
);
670 // -------------------------------------------------------------------------
672 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
)
674 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateString" );
679 // temporaere Variable initialisieren
680 // Java-Call absetzen
681 static jmethodID
mID(NULL
);
684 static const char * cSignature
= "(ILjava/lang/String;)V";
685 static const char * cMethodName
= "updateString";
687 obtainMethodId(t
.pEnv
, cMethodName
,cSignature
, mID
);
691 // Parameter konvertieren
692 jstring str
= convertwchar_tToJavaString(t
.pEnv
,x
);
693 t
.pEnv
->CallVoidMethod( object
, mID
,columnIndex
,str
);
694 t
.pEnv
->DeleteLocalRef(str
);
695 ThrowLoggedSQLException( m_aLogger
, t
.pEnv
, *this );
699 // -------------------------------------------------------------------------
701 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
)
703 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBytes" );
707 // temporaere Variable initialisieren
708 // Java-Call absetzen
709 static jmethodID
mID(NULL
);
712 static const char * cSignature
= "(I[B)V";
713 static const char * cMethodName
= "updateBytes";
715 obtainMethodId(t
.pEnv
, cMethodName
,cSignature
, mID
);
719 jbyteArray aArray
= t
.pEnv
->NewByteArray(x
.getLength());
720 t
.pEnv
->SetByteArrayRegion(aArray
,0,x
.getLength(),(jbyte
*)x
.getConstArray());
721 // Parameter konvertieren
722 t
.pEnv
->CallVoidMethod( object
, mID
,columnIndex
,aArray
);
723 t
.pEnv
->DeleteLocalRef(aArray
);
724 ThrowLoggedSQLException( m_aLogger
, t
.pEnv
, *this );
728 // -------------------------------------------------------------------------
730 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
)
732 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateDate" );
734 static jmethodID
mID(NULL
);
735 callVoidMethod("updateDate", "(ILjava/sql/Date;)V", mID
, columnIndex
, aD
.getJavaObject());
737 // -------------------------------------------------------------------------
739 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
)
741 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTime" );
743 static jmethodID
mID(NULL
);
744 callVoidMethod("updateTime", "(ILjava/sql/Time;)V", mID
, columnIndex
, aD
.getJavaObject());
746 // -------------------------------------------------------------------------
748 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
)
750 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateTimestamp" );
751 java_sql_Timestamp
aD(x
);
752 static jmethodID
mID(NULL
);
753 callVoidMethod("updateTimestamp", "(ILjava/sql/Timestamp;)V", mID
, columnIndex
, aD
.getJavaObject());
755 // -------------------------------------------------------------------------
757 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
)
759 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateBinaryStream" );
760 ::dbtools::throwFeatureNotImplementedException( "XParameters::updateBinaryStream", *this );
762 // -------------------------------------------------------------------------
763 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
)
765 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateCharacterStream" );
766 ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateCharacterStream", *this );
768 // -------------------------------------------------------------------------
769 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
)
771 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateObject" );
772 if(!::dbtools::implUpdateObject(this,columnIndex
,x
))
774 ::connectivity::SharedResources aResources
;
775 const ::rtl::OUString
sError( aResources
.getResourceStringWithSubstitution(
776 STR_UNKNOWN_COLUMN_TYPE
,
777 "$position$", ::rtl::OUString::valueOf(columnIndex
)
779 ::dbtools::throwGenericSQLException(sError
,*this);
782 // -------------------------------------------------------------------------
784 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
)
786 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateNumericObject" );
787 // OSL_ENSURE(0,"java_sql_ResultSet::updateNumericObject: NYI");
794 // temporaere Variable initialisieren
795 // Java-Call absetzen
796 static jmethodID
mID(NULL
);
799 static const char * cSignature
= "(ILjava/lang/Object;I)V";
800 static const char * cMethodName
= "updateObject";
802 obtainMethodId(t
.pEnv
, cMethodName
,cSignature
, mID
);
806 // Parameter konvertieren
808 ::std::auto_ptr
<java_math_BigDecimal
> pBigDecimal
;
811 pBigDecimal
.reset(new java_math_BigDecimal(nTemp
));
814 pBigDecimal
.reset(new java_math_BigDecimal(::comphelper::getString(x
)));
815 //obj = convertwchar_tToJavaString(t.pEnv,::comphelper::getString(x));
816 t
.pEnv
->CallVoidMethod( object
, mID
, columnIndex
,pBigDecimal
->getJavaObject(),scale
);
817 ThrowLoggedSQLException( m_aLogger
, t
.pEnv
, *this );
823 updateObject( columnIndex
,x
);
826 //------------------------------------------------------------------------------
827 sal_Int32
java_sql_ResultSet::getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
829 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetConcurrency" );
830 static jmethodID
mID(NULL
);
831 return callIntMethod("getConcurrency",mID
,true);
833 //------------------------------------------------------------------------------
834 sal_Int32
java_sql_ResultSet::getResultSetType() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
836 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getResultSetType" );
837 static jmethodID
mID(NULL
);
838 return callIntMethod("getType",mID
,true);
840 //------------------------------------------------------------------------------
841 sal_Int32
java_sql_ResultSet::getFetchDirection() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
843 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchDirection" );
844 static jmethodID
mID(NULL
);
845 return callIntMethod("getFetchDirection",mID
,true);
847 //------------------------------------------------------------------------------
848 sal_Int32
java_sql_ResultSet::getFetchSize() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
850 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFetchSize" );
851 static jmethodID
mID(NULL
);
852 return callIntMethod("getFetchSize",mID
,true);
854 //------------------------------------------------------------------------------
855 ::rtl::OUString
java_sql_ResultSet::getCursorName() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
857 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getCursorName" );
858 static jmethodID
mID(NULL
);
859 return callStringMethod("getCursorName",mID
);
862 //------------------------------------------------------------------------------
863 void java_sql_ResultSet::setFetchDirection(sal_Int32 _par0
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
865 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchDirection" );
866 static jmethodID
mID(NULL
);
867 callVoidMethodWithIntArg("setFetchDirection",mID
,_par0
,true);
869 //------------------------------------------------------------------------------
870 void SAL_CALL
java_sql_ResultSet::refreshRow( ) throw(SQLException
, RuntimeException
)
872 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::refreshRow" );
873 static jmethodID
mID(NULL
);
874 callVoidMethod("refreshRow",mID
);
876 //------------------------------------------------------------------------------
877 void java_sql_ResultSet::setFetchSize(sal_Int32 _par0
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
)
879 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFetchSize" );
880 static jmethodID
mID(NULL
);
881 callVoidMethodWithIntArg("setFetchSize",mID
,_par0
,true);
883 // -------------------------------------------------------------------------
884 ::cppu::IPropertyArrayHelper
* java_sql_ResultSet::createArrayHelper( ) const
886 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::createArrayHelper" );
887 Sequence
< Property
> aProps(5);
888 Property
* pProperties
= aProps
.getArray();
890 DECL_PROP1IMPL(CURSORNAME
, ::rtl::OUString
) PropertyAttribute::READONLY
);
891 DECL_PROP0(FETCHDIRECTION
, sal_Int32
);
892 DECL_PROP0(FETCHSIZE
, sal_Int32
);
893 DECL_PROP1IMPL(RESULTSETCONCURRENCY
,sal_Int32
) PropertyAttribute::READONLY
);
894 DECL_PROP1IMPL(RESULTSETTYPE
, sal_Int32
) PropertyAttribute::READONLY
);
896 return new ::cppu::OPropertyArrayHelper(aProps
);
898 // -------------------------------------------------------------------------
899 ::cppu::IPropertyArrayHelper
& java_sql_ResultSet::getInfoHelper()
901 //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getInfoHelper" );
902 return *const_cast<java_sql_ResultSet
*>(this)->getArrayHelper();
904 // -------------------------------------------------------------------------
905 sal_Bool
java_sql_ResultSet::convertFastPropertyValue(
906 ::com::sun::star::uno::Any
& rConvertedValue
,
907 ::com::sun::star::uno::Any
& rOldValue
,
909 const ::com::sun::star::uno::Any
& rValue
)
910 throw (::com::sun::star::lang::IllegalArgumentException
)
912 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::convertFastPropertyValue" );
913 sal_Bool bRet
= sal_False
;
916 case PROPERTY_ID_CURSORNAME
:
917 case PROPERTY_ID_RESULTSETCONCURRENCY
:
918 case PROPERTY_ID_RESULTSETTYPE
:
919 throw ::com::sun::star::lang::IllegalArgumentException();
920 case PROPERTY_ID_FETCHDIRECTION
:
921 bRet
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getFetchDirection());
923 case PROPERTY_ID_FETCHSIZE
:
924 bRet
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getFetchSize());
931 // -------------------------------------------------------------------------
932 void java_sql_ResultSet::setFastPropertyValue_NoBroadcast(
934 const ::com::sun::star::uno::Any
& rValue
936 throw (::com::sun::star::uno::Exception
)
938 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::setFastPropertyValue_NoBroadcast" );
941 case PROPERTY_ID_CURSORNAME
:
942 case PROPERTY_ID_RESULTSETCONCURRENCY
:
943 case PROPERTY_ID_RESULTSETTYPE
:
944 throw ::com::sun::star::uno::Exception();
945 case PROPERTY_ID_FETCHDIRECTION
:
946 setFetchDirection(comphelper::getINT32(rValue
));
948 case PROPERTY_ID_FETCHSIZE
:
949 setFetchSize(comphelper::getINT32(rValue
));
955 // -------------------------------------------------------------------------
956 void java_sql_ResultSet::getFastPropertyValue(
957 ::com::sun::star::uno::Any
& rValue
,
961 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getFastPropertyValue" );
966 case PROPERTY_ID_CURSORNAME
:
967 rValue
<<= getCursorName();
969 case PROPERTY_ID_RESULTSETCONCURRENCY
:
970 rValue
<<= getResultSetConcurrency();
972 case PROPERTY_ID_RESULTSETTYPE
:
973 rValue
<<= getResultSetType();
975 case PROPERTY_ID_FETCHDIRECTION
:
976 rValue
<<= getFetchDirection();
978 case PROPERTY_ID_FETCHSIZE
:
979 rValue
<<= getFetchSize();
987 // -----------------------------------------------------------------------------
988 void SAL_CALL
java_sql_ResultSet::acquire() throw()
990 java_sql_ResultSet_BASE::acquire();
992 // -----------------------------------------------------------------------------
993 void SAL_CALL
java_sql_ResultSet::release() throw()
995 java_sql_ResultSet_BASE::release();
997 // -----------------------------------------------------------------------------
998 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
java_sql_ResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
)
1000 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getPropertySetInfo" );
1001 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
1003 // -----------------------------------------------------------------------------