19b5730f6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 39b5730f6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 49b5730f6SAndrew Rist * or more contributor license agreements. See the NOTICE file 59b5730f6SAndrew Rist * distributed with this work for additional information 69b5730f6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 79b5730f6SAndrew Rist * to you under the Apache License, Version 2.0 (the 89b5730f6SAndrew Rist * "License"); you may not use this file except in compliance 99b5730f6SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 119b5730f6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 139b5730f6SAndrew Rist * Unless required by applicable law or agreed to in writing, 149b5730f6SAndrew Rist * software distributed under the License is distributed on an 159b5730f6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 169b5730f6SAndrew Rist * KIND, either express or implied. See the License for the 179b5730f6SAndrew Rist * specific language governing permissions and limitations 189b5730f6SAndrew Rist * under the License. 19cdf0e10cSrcweir * 209b5730f6SAndrew Rist *************************************************************/ 219b5730f6SAndrew Rist 229b5730f6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_connectivity.hxx" 26cdf0e10cSrcweir #include "java/sql/Array.hxx" 27cdf0e10cSrcweir #include "java/tools.hxx" 28cdf0e10cSrcweir #include "java/sql/ResultSet.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir using namespace connectivity; 31cdf0e10cSrcweir //************************************************************** 32cdf0e10cSrcweir //************ Class: java.sql.Array 33cdf0e10cSrcweir //************************************************************** 34cdf0e10cSrcweir 35cdf0e10cSrcweir jclass java_sql_Array::theClass = 0; 36cdf0e10cSrcweir 37cdf0e10cSrcweir java_sql_Array::~java_sql_Array() 38cdf0e10cSrcweir {} 39cdf0e10cSrcweir 40cdf0e10cSrcweir jclass java_sql_Array::getMyClass() const 41cdf0e10cSrcweir { 42cdf0e10cSrcweir // die Klasse muss nur einmal geholt werden, daher statisch 43cdf0e10cSrcweir if( !theClass ) 44cdf0e10cSrcweir theClass = findMyClass("java/sql/Array"); 45cdf0e10cSrcweir 46cdf0e10cSrcweir return theClass; 47cdf0e10cSrcweir } 48cdf0e10cSrcweir 49cdf0e10cSrcweir ::rtl::OUString SAL_CALL java_sql_Array::getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir static jmethodID mID(NULL); 52cdf0e10cSrcweir return callStringMethod("getBaseTypeName",mID); 53cdf0e10cSrcweir } 54cdf0e10cSrcweir 55cdf0e10cSrcweir sal_Int32 SAL_CALL java_sql_Array::getBaseType( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 56cdf0e10cSrcweir { 57cdf0e10cSrcweir static jmethodID mID(NULL); 58cdf0e10cSrcweir return callIntMethod("getBaseType",mID); 59cdf0e10cSrcweir } 60cdf0e10cSrcweir 61cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL java_sql_Array::getArray( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 62cdf0e10cSrcweir { 63cdf0e10cSrcweir jobjectArray out(0); 64*a3cdc23eSJohn Bampton SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Environment been deleted!"); 65cdf0e10cSrcweir 66cdf0e10cSrcweir { 67cdf0e10cSrcweir jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); 68cdf0e10cSrcweir static const char * cSignature = "(Ljava/util/Map;)[Ljava/lang/Object;"; 69cdf0e10cSrcweir static const char * cMethodName = "getArray"; 70cdf0e10cSrcweir static jmethodID mID(NULL); 71cdf0e10cSrcweir obtainMethodId(t.pEnv, cMethodName,cSignature, mID); 72cdf0e10cSrcweir // Java-Call absetzen 73cdf0e10cSrcweir out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, obj); 74cdf0e10cSrcweir ThrowSQLException(t.pEnv,*this); 75cdf0e10cSrcweir // und aufraeumen 76cdf0e10cSrcweir t.pEnv->DeleteLocalRef(obj); 77cdf0e10cSrcweir } //t.pEnv 78cdf0e10cSrcweir return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();//copyArrayAndDelete< ::com::sun::star::uno::Any,jobject>(t.pEnv,out); 79cdf0e10cSrcweir } 80cdf0e10cSrcweir 81cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL java_sql_Array::getArrayAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 82cdf0e10cSrcweir { 83cdf0e10cSrcweir jobjectArray out(0); 84*a3cdc23eSJohn Bampton SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Environment been deleted!"); 85cdf0e10cSrcweir 86cdf0e10cSrcweir { 87cdf0e10cSrcweir jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); 88cdf0e10cSrcweir static const char * cSignature = "(IILjava/util/Map;)[Ljava/lang/Object;"; 89cdf0e10cSrcweir static const char * cMethodName = "getArray"; 90cdf0e10cSrcweir // Java-Call absetzen 91cdf0e10cSrcweir static jmethodID mID(NULL); 92cdf0e10cSrcweir obtainMethodId(t.pEnv, cMethodName,cSignature, mID); 93cdf0e10cSrcweir out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, index,count,obj); 94cdf0e10cSrcweir ThrowSQLException(t.pEnv,*this); 95cdf0e10cSrcweir // und aufraeumen 96cdf0e10cSrcweir t.pEnv->DeleteLocalRef(obj); 97cdf0e10cSrcweir } //t.pEnv 98cdf0e10cSrcweir return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();//copyArrayAndDelete< ::com::sun::star::uno::Any,jobject>(t.pEnv,out); 99cdf0e10cSrcweir } 100cdf0e10cSrcweir 101cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSet( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 102cdf0e10cSrcweir { 103cdf0e10cSrcweir jobject out(0); 104*a3cdc23eSJohn Bampton SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Environment been deleted!"); 105cdf0e10cSrcweir { 106cdf0e10cSrcweir // Parameter konvertieren 107cdf0e10cSrcweir jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); 108cdf0e10cSrcweir // temporaere Variable initialisieren 109cdf0e10cSrcweir static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;"; 110cdf0e10cSrcweir static const char * cMethodName = "getResultSet"; 111cdf0e10cSrcweir // Java-Call absetzen 112cdf0e10cSrcweir static jmethodID mID(NULL); 113cdf0e10cSrcweir obtainMethodId(t.pEnv, cMethodName,cSignature, mID); 114cdf0e10cSrcweir out = t.pEnv->CallObjectMethod( object, mID, obj); 115cdf0e10cSrcweir ThrowSQLException(t.pEnv,*this); 116cdf0e10cSrcweir // und aufraeumen 117cdf0e10cSrcweir t.pEnv->DeleteLocalRef(obj); 118cdf0e10cSrcweir } //t.pEnv 119cdf0e10cSrcweir // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! 120cdf0e10cSrcweir // return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); 121cdf0e10cSrcweir return NULL; 122cdf0e10cSrcweir } 123cdf0e10cSrcweir 124cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSetAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 125cdf0e10cSrcweir { 126cdf0e10cSrcweir jobject out(0); 127*a3cdc23eSJohn Bampton SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Environment been deleted!"); 128cdf0e10cSrcweir { 129cdf0e10cSrcweir // Parameter konvertieren 130cdf0e10cSrcweir jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); 131cdf0e10cSrcweir // temporaere Variable initialisieren 132cdf0e10cSrcweir static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;"; 133cdf0e10cSrcweir static const char * cMethodName = "getResultSetAtIndex"; 134cdf0e10cSrcweir // Java-Call absetzen 135cdf0e10cSrcweir static jmethodID mID(NULL); 136cdf0e10cSrcweir obtainMethodId(t.pEnv, cMethodName,cSignature, mID); 137cdf0e10cSrcweir out = t.pEnv->CallObjectMethod( object, mID, index,count,obj); 138cdf0e10cSrcweir ThrowSQLException(t.pEnv,*this); 139cdf0e10cSrcweir // und aufraeumen 140cdf0e10cSrcweir t.pEnv->DeleteLocalRef(obj); 141cdf0e10cSrcweir } //t.pEnv 142cdf0e10cSrcweir // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! 143cdf0e10cSrcweir // return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); 144cdf0e10cSrcweir return NULL; 145cdf0e10cSrcweir } 146