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