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