diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 15:18:56 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 15:18:56 +0000 |
commit | c25ec0608a167bcf1d891043f02273761c351701 (patch) | |
tree | 32c3e19f0b663e37ad1910e8fddeac200ad3856d /connectivity/source/drivers/jdbc |
initial import
Diffstat (limited to 'connectivity/source/drivers/jdbc')
29 files changed, 11352 insertions, 0 deletions
diff --git a/connectivity/source/drivers/jdbc/Array.cxx b/connectivity/source/drivers/jdbc/Array.cxx new file mode 100644 index 000000000000..21566a30afc3 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Array.cxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * $RCSfile: Array.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ +#include "java/sql/Array.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ +#include "java/sql/ResultSet.hxx" +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.Array +//************************************************************** + +jclass java_sql_Array::theClass = 0; + +java_sql_Array::~java_sql_Array() +{} + +jclass java_sql_Array::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/sql/Array" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Array::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +::rtl::OUString SAL_CALL java_sql_Array::getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jstring out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getBaseTypeName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + +sal_Int32 SAL_CALL java_sql_Array::getBaseType( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getBaseType"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +::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) +{ + jobjectArray out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jobject obj = XNameAccess2Map(t.pEnv,typeMap); + char * cSignature = "(Ljava/util/Map;)[Ljava/lang/Object;"; + char * cMethodName = "getArray"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, obj); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(obj); + } //mID + } //t.pEnv + return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();//copyArrayAndDelete< ::com::sun::star::uno::Any,jobject>(t.pEnv,out); +} + +::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) +{ + jobjectArray out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jobject obj = XNameAccess2Map(t.pEnv,typeMap); + char * cSignature = "(IILjava/util/Map;)[Ljava/lang/Object;"; + char * cMethodName = "getArray"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, index,count,obj); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(obj); + } //mID + } //t.pEnv + return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();//copyArrayAndDelete< ::com::sun::star::uno::Any,jobject>(t.pEnv,out); +} + +::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) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].l = XNameAccess2Map(t.pEnv,typeMap); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;"; + char * cMethodName = "getResultSet"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jobjectArray)args[0].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); + return NULL; +} + +::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) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].l = XNameAccess2Map(t.pEnv,typeMap); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;"; + char * cMethodName = "getResultSet"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, index,count,args[0].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jobjectArray)args[0].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); + return NULL; +} + + + diff --git a/connectivity/source/drivers/jdbc/Blob.cxx b/connectivity/source/drivers/jdbc/Blob.cxx new file mode 100644 index 000000000000..7a2b3ab808a5 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Blob.cxx @@ -0,0 +1,221 @@ +/************************************************************************* + * + * $RCSfile: Blob.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ +#include "java/sql/Blob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ +#include "java/io/InputStream.hxx" +#endif +#ifndef _INC_MEMORY +#include <memory.h> +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.Blob +//************************************************************** + +jclass java_sql_Blob::theClass = 0; + +java_sql_Blob::~java_sql_Blob() +{} + +jclass java_sql_Blob::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/sql/Blob" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Blob::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()J"; + char * cMethodName = "length"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} +::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL java_sql_Blob::getBytes( sal_Int64 pos, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(JI)[B"; + char * cMethodName = "getBytes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID,pos,length); + ThrowSQLException(t.pEnv,*this); + if(out) + { + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aSeq; +} + +::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_Blob::getBinaryStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/io/InputStream;"; + char * cMethodName = "getBinaryStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); +} + +sal_Int64 SAL_CALL java_sql_Blob::position( const ::com::sun::star::uno::Sequence< sal_Int8 >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + jbyteArray pByteArray = t.pEnv->NewByteArray(pattern.getLength()); + t.pEnv->SetByteArrayRegion(pByteArray,0,pattern.getLength(),(jbyte*)pattern.getConstArray()); + args[0].l = pByteArray; + // temporaere Variable initialisieren + char * cSignature = "([BI)J"; + char * cMethodName = "position"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID, args[0].l,start ); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jbyteArray)args[0].l); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} + +sal_Int64 SAL_CALL java_sql_Blob::positionOfBlob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(Ljava/sql/Blob;I)J"; + char * cMethodName = "position"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID,args[0].l,start ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} + diff --git a/connectivity/source/drivers/jdbc/Boolean.cxx b/connectivity/source/drivers/jdbc/Boolean.cxx new file mode 100644 index 000000000000..0d72ac908689 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Boolean.cxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * $RCSfile: Boolean.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_BOOLEAN_HXX_ +#include "java/lang/Boolean.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.lang.Boolean +//************************************************************** + +jclass java_lang_Boolean::theClass = 0; + +java_lang_Boolean::~java_lang_Boolean() +{} + +jclass java_lang_Boolean::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/lang/Boolean"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_lang_Boolean::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +java_lang_Boolean::java_lang_Boolean( sal_Bool _par0 ): java_lang_Object( NULL, (jobject)NULL ){ + SDBThreadAttach t; + if( !t.pEnv ) + return; + jvalue args[1]; + // Parameter konvertieren + args[0].z = _par0; + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "(Z)V"; + jobject tempObj; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); + saveRef( t.pEnv, tempObj ); + t.pEnv->DeleteLocalRef( tempObj ); + // und aufraeumen +} + + diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx new file mode 100644 index 000000000000..be6616d4b0ae --- /dev/null +++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx @@ -0,0 +1,590 @@ +/************************************************************************* + * + * $RCSfile: CallableStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_CALLABLESTATEMENT_HXX_ +#include "java/sql/CallableStatement.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ +#include "java/sql/Array.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ +#include "java/sql/Clob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ +#include "java/sql/Blob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_REF_HXX_ +#include "java/sql/Ref.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ +#include "java/sql/Timestamp.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + + +IMPLEMENT_SERVICE_INFO(java_sql_CallableStatement,"com.sun.star.sdbcx.ACallableStatement","com.sun.star.sdbc.CallableStatement"); + +//************************************************************** +//************ Class: java.sql.CallableStatement +//************************************************************** +Any SAL_CALL java_sql_CallableStatement::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = java_sql_PreparedStatement::queryInterface(rType); + if(!aRet.hasValue()) + aRet = ::cppu::queryInterface(rType,static_cast< starsdbc::XRow*>(this),static_cast< starsdbc::XOutParameters*>(this)); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL java_sql_CallableStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< starsdbc::XRow > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< starsdbc::XOutParameters > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),java_sql_PreparedStatement::getTypes()); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_CallableStatement::wasNull( ) throw(starsdbc::SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "wasNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} + +sal_Bool SAL_CALL java_sql_CallableStatement::getBoolean( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "getBoolean"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +sal_Int8 SAL_CALL java_sql_CallableStatement::getByte( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jbyte out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)B"; + char * cMethodName = "getByte"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallByteMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +Sequence< sal_Int8 > SAL_CALL java_sql_CallableStatement::getBytes( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + Sequence< sal_Int8 > aSeq; + + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + char * cSignature = "(I)[B"; + char * cMethodName = "getBytes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jbyteArray out(0); + out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + if (out) + { + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } + // und aufraeumen + } //mID + } //t.pEnv + return aSeq; +} +::com::sun::star::util::Date SAL_CALL java_sql_CallableStatement::getDate( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Date;"; + char * cMethodName = "getDate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Date( t.pEnv, out ); +} +double SAL_CALL java_sql_CallableStatement::getDouble( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jdouble out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + jvalue args[1]; + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)D"; + char * cMethodName = "getDouble"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallDoubleMethod( object, mID, args[0].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} + +float SAL_CALL java_sql_CallableStatement::getFloat( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jfloat out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)F"; + char * cMethodName = "getFloat"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallFloatMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} + +sal_Int32 SAL_CALL java_sql_CallableStatement::getInt( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getInt"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int64 SAL_CALL java_sql_CallableStatement::getLong( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jlong out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)J"; + char * cMethodName = "getLong"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID, args[0].i ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} + +Any SAL_CALL java_sql_CallableStatement::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/Object;"; + char * cMethodName = "getObject"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return Any(); //out==0 ? 0 : new java_lang_Object( t.pEnv, out ); +} + +sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jshort out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)S"; + char * cMethodName = "getShort"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallShortMethod( object, mID, args[0].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int16)out; +} + +::rtl::OUString SAL_CALL java_sql_CallableStatement::getString( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jstring out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + + ::com::sun::star::util::Time SAL_CALL java_sql_CallableStatement::getTime( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Time;"; + char * cMethodName = "getTime"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Time( t.pEnv, out ); +} + + ::com::sun::star::util::DateTime SAL_CALL java_sql_CallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Timestamp;"; + char * cMethodName = "getTimestamp"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Timestamp( t.pEnv, out ); +} + +void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(starsdbc::SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jvalue args[3]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].i = (sal_Int32)sqlType; + args[2].l = convertwchar_tToJavaString(t.pEnv,typeName); + // temporaere Variable initialisieren + char * cSignature = "(IILjava/lang/String;)V"; + char * cMethodName = "registerOutParameter"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i,args[2].l); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } + } +} +void SAL_CALL java_sql_CallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jvalue args[3]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].i = (sal_Int32)sqlType; + args[2].i = scale; + // temporaere Variable initialisieren + char * cSignature = "(III)V"; + char * cMethodName = "registerOutParameter"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i,args[2].i); + ThrowSQLException(t.pEnv,*this); + } + } +} + +jclass java_sql_CallableStatement::theClass = 0; + +jclass java_sql_CallableStatement::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/CallableStatement"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_CallableStatement::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_CallableStatement::getBinaryStream( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + Reference< starsdbc::XBlob > xBlob = getBlob(columnIndex); + return xBlob.is() ? xBlob->getBinaryStream() : Reference< ::com::sun::star::io::XInputStream >(); +} +Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_CallableStatement::getCharacterStream( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + Reference< starsdbc::XClob > xClob = getClob(columnIndex); + return xClob.is() ? xClob->getCharacterStream() : Reference< ::com::sun::star::io::XInputStream >(); +} + +Reference< starsdbc::XArray > SAL_CALL java_sql_CallableStatement::getArray( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getArray"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Array( t.pEnv, out ); +} + +Reference< starsdbc::XClob > SAL_CALL java_sql_CallableStatement::getClob( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getClob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Clob( t.pEnv, out ); +} +Reference< starsdbc::XBlob > SAL_CALL java_sql_CallableStatement::getBlob( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getBlob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Blob( t.pEnv, out ); +} + +Reference< starsdbc::XRef > SAL_CALL java_sql_CallableStatement::getRef( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getRef"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Ref( t.pEnv, out ); +} + + diff --git a/connectivity/source/drivers/jdbc/Class.cxx b/connectivity/source/drivers/jdbc/Class.cxx new file mode 100644 index 000000000000..e11dbd3a3b15 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Class.cxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * $RCSfile: Class.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_CLASS_HXX_ +#include "java/lang/Class.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.lang.Class +//************************************************************** + +jclass java_lang_Class::theClass = 0; + +java_lang_Class::~java_lang_Class() +{} + +jclass java_lang_Class::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/lang/Class"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_lang_Class::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +java_lang_Class * java_lang_Class::forName( const ::rtl::OUString& _par0 ) +{ + jobject out(NULL); + SDBThreadAttach t; + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,_par0); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;)Ljava/lang/Class;"; + char * cMethodName = "forName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetStaticMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l ); + ThrowSQLException(t.pEnv,0); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[0].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? NULL : new java_lang_Class( t.pEnv, out ); +} + +sal_Bool java_lang_Class::isAssignableFrom( java_lang_Class * _par0 ) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].l = _par0 != NULL ? ((java_lang_Object *)_par0)->getJavaObject() : NULL; + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/Class;)Z"; + char * cMethodName = "isAssignableFrom"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, args[0].l ); + ThrowSQLException(t.pEnv,0); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} + +java_lang_Object * java_lang_Class::newInstance() +{ + jobject out(NULL); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/Object;"; + char * cMethodName = "newInstance"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,0); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? NULL : new java_lang_Object( t.pEnv, out ); +} + +::rtl::OUString java_lang_Class::getName() +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,0); + aStr = JavaString2String(t.pEnv, (jstring)out ); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + diff --git a/connectivity/source/drivers/jdbc/Clob.cxx b/connectivity/source/drivers/jdbc/Clob.cxx new file mode 100644 index 000000000000..661b86541385 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Clob.cxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * $RCSfile: Clob.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ +#include "java/sql/Clob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_IO_READER_HXX_ +#include "java/io/Reader.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.Clob +//************************************************************** + +jclass java_sql_Clob::theClass = 0; + +java_sql_Clob::~java_sql_Clob() +{} + +jclass java_sql_Clob::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/sql/Clob" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Clob::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()J"; + char * cMethodName = "length"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} + +::rtl::OUString SAL_CALL java_sql_Clob::getSubString( sal_Int64 pos, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jstring out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(JI)Ljava/lang/String;"; + char * cMethodName = "getBaseTypeName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID,pos,length); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + +::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_Clob::getCharacterStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/io/Reader;"; + char * cMethodName = "getCharacterStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_io_Reader( t.pEnv, out ); +} + +sal_Int64 SAL_CALL java_sql_Clob::position( const ::rtl::OUString& searchstr, sal_Int32 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,searchstr); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;I)J"; + char * cMethodName = "position"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID, args[0].l,start ); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jstring)args[0].l); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} + +sal_Int64 SAL_CALL java_sql_Clob::positionOfClob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(Ljava/sql/Clob;I)J"; + char * cMethodName = "position"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID,args[0].l,start ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} + + diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx new file mode 100644 index 000000000000..ff93e7751a38 --- /dev/null +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -0,0 +1,3269 @@ +/************************************************************************* + * + * $RCSfile: DatabaseMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_DATABASEMETADATA_HXX_ +#include "java/sql/DatabaseMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ +#include "java/sql/Connection.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ +#include "java/sql/ResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_STRING_HXX_ +#include "java/lang/String.hxx" +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +//#ifndef _UTL_TYPES_HXX_ +//#include <unotools/types.hxx> +//#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +//************************************************************** +//************ Class: java.sql.DatabaseMetaData +//************************************************************** + +jclass java_sql_DatabaseMetaData::theClass = 0; + +java_sql_DatabaseMetaData::~java_sql_DatabaseMetaData() +{} + +jclass java_sql_DatabaseMetaData::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/DatabaseMetaData"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +// ------------------------------------------------------------------------- + + +void java_sql_DatabaseMetaData::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/ResultSet;"; + char * cMethodName = "getTypeInfo"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/ResultSet;"; + char * cMethodName = "getCatalogs"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException) +{ + jstring out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getCatalogSeparator"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + char * cSignature = "()Ljava/sql/ResultSet;"; + char * cMethodName = "getSchemas"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? new java_sql_ResultSet( t.pEnv, out ) : 0; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumnPrivileges( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[4]; + // temporaere Variable initialisieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + args[3].l = convertwchar_tToJavaString(t.pEnv,columnNamePattern); + + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTables"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l); + ThrowSQLException(t.pEnv,*this); + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + if(columnNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[3].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? new java_sql_ResultSet( t.pEnv, out ) : 0; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // temporaere Variable initialisieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern); + + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTables"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(tableNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? new java_sql_ResultSet( t.pEnv, out ) : 0; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[4]; + sal_Int32 len = types.getLength(); + if(len) + { + jobjectArray pObjArray = t.pEnv->NewObjectArray((jsize) len, java_lang_String::getMyClass(), 0); + const ::rtl::OUString* pBegin = types.getConstArray(); + for(sal_Int32 i=0;i<len;i++,++pBegin) + { + jstring aT = convertwchar_tToJavaString(t.pEnv,*pBegin); + //jstring aT = t.pEnv->NewStringUTF(_par3.GetToken(i)); + t.pEnv->SetObjectArrayElement(pObjArray,(jsize)i,aT); + } + args[3].l = pObjArray; + }else + args[3].l = 0; + // temporaere Variable initialisieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern); + + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTables"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l); + ThrowSQLException(t.pEnv,*this); + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(tableNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + //for(INT16 i=0;i<len;i++) + t.pEnv->DeleteLocalRef((jobjectArray)args[3].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? new java_sql_ResultSet( t.pEnv, out ) : 0; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedureColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jvalue args[4]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,procedureNamePattern); + args[3].l = convertwchar_tToJavaString(t.pEnv,columnNamePattern); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getProcedures"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(procedureNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + if(columnNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[3].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedures( const Any& + catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,procedureNamePattern); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getProcedures"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(procedureNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getVersionColumns( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getVersionColumns"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxBinaryLiteralLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxRowSize"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxCatalogNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxCharLiteralLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnsInIndex"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxCursorNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxConnections"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnsInTable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxStatementLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxTableNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxTablesInSelect"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getExportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getExportedKeys"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getImportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getImportedKeys"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getPrimaryKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getPrimaryKeys"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[5]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + args[3].z = unique; + args[4].z = approximate; + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/sql/ResultSet;"; + char * cMethodName = "getIndexInfo"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,args[3].z,args[4].z ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, + sal_Bool nullable ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTablePrivileges"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,scope,nullable); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern); + + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTablePrivileges"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(tableNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference( + const Any& primaryCatalog, const ::rtl::OUString& primarySchema, + const ::rtl::OUString& primaryTable, const Any& foreignCatalog, + const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[6]; + // Parameter konvertieren + args[0].l = primaryCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(primaryCatalog)) : 0; + args[1].l = primarySchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,primarySchema); + args[2].l = convertwchar_tToJavaString(t.pEnv,primaryTable); + args[3].l = foreignCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(foreignCatalog)) : 0; + args[4].l = foreignSchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,foreignSchema); + args[5].l = convertwchar_tToJavaString(t.pEnv,foreignTable); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getCrossReference"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[2].l,args[2].l,args[3].l,args[4].l,args[5].l ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(primaryCatalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(primaryTable.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + if(foreignCatalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[3].l); + if(args[4].l) + t.pEnv->DeleteLocalRef((jstring)args[4].l); + if(foreignTable.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[5].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "doesMaxRowSizeIncludeBlobs"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesLowerCaseQuotedIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesLowerCaseIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesMixedCaseQuotedIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesMixedCaseIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesUpperCaseQuotedIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesUpperCaseIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsAlterTableWithAddColumn"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsAlterTableWithDropColumn"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxIndexLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsNonNullableColumns"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)0; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getCatalogTerm"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)0; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getIdentifierQuoteString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)0; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getExtraNameCharacters"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsDifferentTableCorrelationNames"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isCatalogAtStart"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "dataDefinitionIgnoredInTransactions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "dataDefinitionCausesTransactionCommit"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsDataManipulationTransactionsOnly"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsDataDefinitionAndDataManipulationTransactions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsPositionedDelete"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsPositionedUpdate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOpenStatementsAcrossRollback"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOpenStatementsAcrossCommit"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOpenCursorsAcrossCommit"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOpenCursorsAcrossRollback"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "supportsTransactionIsolationLevel"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, level); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSchemasInDataManipulation"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsANSI92FullSQL"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsANSI92EntryLevelSQL"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsIntegrityEnhancementFacility"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSchemasInIndexDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSchemasInTableDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCatalogsInTableDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCatalogsInIndexDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCatalogsInDataManipulation"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOuterJoins"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/ResultSet;"; + char * cMethodName = "getTableTypes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxStatements"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxProcedureNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxSchemaNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsTransactions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "allProceduresAreCallable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsStoredProcedures"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSelectForUpdate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "allTablesAreSelectable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isReadOnly"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "usesLocalFiles"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "usesLocalFilePerTable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsTypeConversion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "nullPlusNonNullIsNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsColumnAliasing"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsTableCorrelationNames"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)fromType; + args[1].i = (sal_Int32)toType; + // temporaere Variable initialisieren + char * cSignature = "(II)Z"; + char * cMethodName = "supportsConvert"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, args[0].i,args[0].i ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsExpressionsInOrderBy"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsGroupBy"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsGroupByBeyondSelect"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsGroupByUnrelated"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsMultipleTransactions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsMultipleResultSets"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsLikeEscapeClause"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOrderByUnrelated"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsUnion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsUnionAll"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsMixedCaseIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsMixedCaseQuotedIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "nullsAreSortedAtEnd"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "nullsAreSortedAtStart"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "nullsAreSortedHigh"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "nullsAreSortedLow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSchemasInProcedureCalls"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSchemasInPrivilegeDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCatalogsInProcedureCalls"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCatalogsInPrivilegeDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCorrelatedSubqueries"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSubqueriesInComparisons"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSubqueriesInExists"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSubqueriesInIns"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSubqueriesInQuantifieds"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsANSI92IntermediateSQL"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) +{ + + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getURL"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getUserName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getDriverName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getDriverVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getDatabaseProductVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getDatabaseProductName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getProcedureTerm"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getSchemaTerm"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getDriverMajorVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getDefaultTransactionIsolation"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getDriverMinorVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getSQLKeywords"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getSearchStringEscape"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getStringFunctions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getTimeDateFunctions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getSystemFunctions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getNumericFunctions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsExtendedSQLGrammar"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCoreSQLGrammar"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsMinimumSQLGrammar"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsFullOuterJoins"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsLimitedOuterJoins"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnsInGroupBy"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnsInOrderBy"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnsInSelect"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxUserNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "supportsResultSetType"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(II)Z"; + char * cMethodName = "supportsResultSetConcurrency"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType,concurrency); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "ownUpdatesAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "ownDeletesAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "ownInsertsAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "othersUpdatesAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "othersDeletesAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "othersInsertsAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "updatesAreDetected"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "deletesAreDetected"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "insertsAreDetected"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsBatchUpdates"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, + const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[4]; + // temporaere Variable initialisieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,typeNamePattern); + jintArray pArray = t.pEnv->NewIntArray(types.getLength()); + t.pEnv->SetIntArrayRegion(pArray,0,types.getLength(),(jint*)types.getConstArray()); + args[3].l = pArray; + + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTables"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l); + ThrowSQLException(t.pEnv,*this); + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(schemaPattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(typeNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + if(args[3].l) + t.pEnv->DeleteLocalRef((jintArray)args[3].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? new java_sql_ResultSet( t.pEnv, out ) : 0; +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL java_sql_DatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException) +{ +// jobject out(0); +// SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); +// if( t.pEnv ){ +// char * cSignature = "()Ljava/sql/Connection;"; +// char * cMethodName = "getConnection"; +// // Java-Call absetzen +// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); +// if( mID ) +// { +// out = t.pEnv->CallObjectMethod( object, mID); +// ThrowSQLException(t.pEnv,*this); +// } //mID +// } //t.pEnv +// // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! +// return out ? new java_sql_Connection( t.pEnv, out,this ) : 0; + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/jdbc/Date.cxx b/connectivity/source/drivers/jdbc/Date.cxx new file mode 100644 index 000000000000..d024ae0ddbed --- /dev/null +++ b/connectivity/source/drivers/jdbc/Date.cxx @@ -0,0 +1,225 @@ +/************************************************************************* + * + * $RCSfile: Date.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_UTIL_DATE_HXX_ +#include "java/util/Date.hxx" +#endif + +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_DATECONVERSION_HXX_ +#include "DateConversion.hxx" +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.util.Date +//************************************************************** + +jclass java_util_Date::theClass = 0; + +java_util_Date::java_util_Date( const ::com::sun::star::util::Date& _rOut ) //: java_lang_Object( NULL, (jobject)NULL ){ +{ + SDBThreadAttach t; + if( !t.pEnv ) + return; + jvalue args[1]; + // Parameter konvertieren + args[0].j = DateConversion::toINT32(_rOut); + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "(J)V"; + jobject tempObj; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); + saveRef( t.pEnv, tempObj ); + t.pEnv->DeleteLocalRef( tempObj ); + // und aufraeumen +} + +java_util_Date::~java_util_Date() +{} + +jclass java_util_Date::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/util/Date" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_util_Date::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +sal_Int32 java_util_Date::getMinutes() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMinutes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int32 java_util_Date::getMonth() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMonth"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int32 java_util_Date::getSeconds() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getSeconds"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int32 java_util_Date::getYear() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getYear"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int32 java_util_Date::getDate() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getDate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int32 java_util_Date::getHours() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getHours"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + diff --git a/connectivity/source/drivers/jdbc/DriverManager.cxx b/connectivity/source/drivers/jdbc/DriverManager.cxx new file mode 100644 index 000000000000..bc20c0147e97 --- /dev/null +++ b/connectivity/source/drivers/jdbc/DriverManager.cxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * $RCSfile: DriverManager.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERMANAGER_HXX_ +#include "java/sql/DriverManager.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.DriverManager +//************************************************************** + +jclass java_sql_DriverManager::theClass = 0; + +java_sql_DriverManager::~java_sql_DriverManager() +{} + +jclass java_sql_DriverManager::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/DriverManager"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_DriverManager::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +jobject java_sql_DriverManager::getDriver(const ::rtl::OUString &url) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,url); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;)Ljava/sql/Driver;"; + char * cMethodName = "getDriver"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetStaticMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l ); + ThrowSQLException(t.pEnv,0); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[0].l); + } //mID + return t.pEnv->NewGlobalRef( out ); + } //t.pEnv + + return out; +} + + +void java_sql_DriverManager::setLoginTimeout(sal_Int32 _par0) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + jobject out(0); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)V"; + char * cMethodName = "setLoginTimeout"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + t.pEnv->CallStaticVoidMethod(getMyClass(), mID, _par0); + ThrowSQLException(t.pEnv,0); + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! +} + + diff --git a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx new file mode 100644 index 000000000000..b38b2dbfb92b --- /dev/null +++ b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx @@ -0,0 +1,191 @@ +/************************************************************************* + * + * $RCSfile: DriverPropertyInfo.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERPOPERTYINFO_HXX_ +#include "java/sql/DriverPropertyInfo.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_BOOLEAN_HXX_ +#include "java/lang/Boolean.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_STRING_HXX_ +#include "java/lang/String.hxx" +#endif +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + + +//************************************************************** +//************ Class: java.sql.Driver +//************************************************************** + +jclass java_sql_DriverPropertyInfo::theClass = 0; +// -------------------------------------------------------------------------------- +java_sql_DriverPropertyInfo::~java_sql_DriverPropertyInfo() +{} +// -------------------------------------------------------------------------------- +jclass java_sql_DriverPropertyInfo::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ) + { + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/DriverPropertyInfo"); + OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +// -------------------------------------------------------------------------------- +void java_sql_DriverPropertyInfo::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// -------------------------------------------------------------------------------- +java_sql_DriverPropertyInfo::operator starsdbc::DriverPropertyInfo() +{ + starsdbc::DriverPropertyInfo aInfo; + aInfo.Name = name(); + aInfo.Description = description(); + aInfo.IsRequired = required(); + aInfo.Value = value(); + aInfo.Choices = choices(); + + return aInfo; +} +// -------------------------------------------------------------------------------- +::rtl::OUString java_sql_DriverPropertyInfo::name() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jfieldID id = t.pEnv->GetFieldID(java_lang_Boolean::getMyClass(),"name","Ljava/lang/String;"); + if(id) + aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); + } //t.pEnv + return aStr; +} +// -------------------------------------------------------------------------------- +::rtl::OUString java_sql_DriverPropertyInfo::description() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jfieldID id = t.pEnv->GetFieldID(java_lang_Boolean::getMyClass(),"description","Ljava/lang/String;"); + if(id) + aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); + } //t.pEnv + return aStr; +} +// -------------------------------------------------------------------------------- +::rtl::OUString java_sql_DriverPropertyInfo::value() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jfieldID id = t.pEnv->GetFieldID(java_lang_Boolean::getMyClass(),"value","Ljava/lang/String;"); + if(id) + aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); + } //t.pEnv + return aStr; +} +// -------------------------------------------------------------------------------- +sal_Bool java_sql_DriverPropertyInfo::required() const +{ + jboolean out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jfieldID id = t.pEnv->GetFieldID(java_lang_Boolean::getMyClass(),"required","B"); + if(id) + out = t.pEnv->GetBooleanField( object, id); + } //t.pEnv + return out; +} +// -------------------------------------------------------------------------------- +Sequence< ::rtl::OUString> java_sql_DriverPropertyInfo::choices() const +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jfieldID id = t.pEnv->GetFieldID(java_lang_Boolean::getMyClass(),"choices","[Ljava/lang/String"); + if(id) + return copyArrayAndDelete(t.pEnv,(jobjectArray)t.pEnv->GetObjectField( object, id), ::rtl::OUString(),java_lang_String(NULL,NULL)); + } //t.pEnv + return Sequence< ::rtl::OUString>(); +} +// -------------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/jdbc/Exception.cxx b/connectivity/source/drivers/jdbc/Exception.cxx new file mode 100644 index 000000000000..9d579b2f226f --- /dev/null +++ b/connectivity/source/drivers/jdbc/Exception.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * $RCSfile: Exception.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include "java/lang/Exception.hxx" +using namespace connectivity; +//************************************************************** +//************ Class: java.lang.Exception +//************************************************************** + +jclass java_lang_Exception::theClass = 0; + +java_lang_Exception::~java_lang_Exception() +{} + +jclass java_lang_Exception::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/lang/Exception"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_lang_Exception::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + diff --git a/connectivity/source/drivers/jdbc/InputStream.cxx b/connectivity/source/drivers/jdbc/InputStream.cxx new file mode 100644 index 000000000000..566c0dd02df7 --- /dev/null +++ b/connectivity/source/drivers/jdbc/InputStream.cxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * $RCSfile: InputStream.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ +#include "java/io/InputStream.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _INC_MEMORY +#include <memory.h> +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.io.InputStream +//************************************************************** + +jclass java_io_InputStream::theClass = 0; + +java_io_InputStream::~java_io_InputStream() +{} + +jclass java_io_InputStream::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/io/InputStream" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_io_InputStream::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +sal_Int32 SAL_CALL java_io_InputStream::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + return readBytes(aData,nMaxBytesToRead); +} + +void SAL_CALL java_io_InputStream::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + char * cSignature = "(I)I"; + char * cMethodName = "skip"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallIntMethod( object, mID,nBytesToSkip); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv +} + +sal_Int32 SAL_CALL java_io_InputStream::available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + char * cSignature = "()Z"; + char * cMethodName = "available"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv + return out; +} +void SAL_CALL java_io_InputStream::closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + char * cSignature = "()V"; + char * cMethodName = "close"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv +} +// ----------------------------------------------------- +sal_Int32 SAL_CALL java_io_InputStream::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jbyteArray pByteArray = t.pEnv->NewByteArray(nBytesToRead); + char * cSignature = "([BII)I"; + char * cMethodName = "read"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + while(!(out = t.pEnv->CallIntMethod( object, mID,pByteArray,0,nBytesToRead))) + ThrowSQLException(t.pEnv,*this); + if(out > 0) + { + jboolean p = sal_False; + memcpy(aData.getArray(),t.pEnv->GetByteArrayElements(pByteArray,&p),out); + } + } + t.pEnv->DeleteLocalRef((jbyteArray)pByteArray); + } //t.pEnv + return out; +} + + diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx new file mode 100644 index 000000000000..80e1a7013623 --- /dev/null +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -0,0 +1,295 @@ +/************************************************************************* + * + * $RCSfile: JDriver.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVER_HXX_ +#include "java/sql/Driver.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERMANAGER_HXX_ +#include "java/sql/DriverManager.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERPOPERTYINFO_HXX_ +#include "java/sql/DriverPropertyInfo.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ +#include "java/sql/Connection.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +// ------------------------------------------------------------------------- +java_sql_Driver::java_sql_Driver(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) + : java_lang_Object(_rxFactory) +{ +} +// -------------------------------------------------------------------------------- +jclass java_sql_Driver::theClass = 0; +// -------------------------------------------------------------------------------- +java_sql_Driver::~java_sql_Driver() +{} +// static ServiceInfo +//------------------------------------------------------------------------------ +rtl::OUString java_sql_Driver::getImplementationName_Static( ) throw(RuntimeException) +{ + return ::rtl::OUString::createFromAscii("com.sun.star.sdbc.JDriver"); +} +//------------------------------------------------------------------------------ +Sequence< ::rtl::OUString > java_sql_Driver::getSupportedServiceNames_Static( ) throw (RuntimeException) +{ + Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + return aSNS; +} +//------------------------------------------------------------------ +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::java_sql_Driver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) +{ + return *(new java_sql_Driver(_rxFactory)); +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_Driver::getImplementationName( ) throw(RuntimeException) +{ + return getImplementationName_Static(); +} + +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_Driver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; +} + +// -------------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL java_sql_Driver::getSupportedServiceNames( ) throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} + +// -------------------------------------------------------------------------------- +jclass java_sql_Driver::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ) + { + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/Driver"); + OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +// -------------------------------------------------------------------------------- +void java_sql_Driver::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// ------------------------------------------------------------------------- +Reference< starsdbc::XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUString& url, const + Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(starsdbc::SQLException, RuntimeException) +{ + Reference< starsdbc::XConnection > xRet; + + object = java_sql_DriverManager::getDriver(url); + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jvalue args[2]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,url); + args[1].l = createStringPropertyArray(t.pEnv,info); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/util/Properties)Ljava/sql/Connection;"; + char * cMethodName = "connect"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethodA( getMyClass(), mID, args ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef((jstring)args[1].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + Reference< starsdbc::XConnection > xOut; + return out==0 ? 0 : new java_sql_Connection( t.pEnv, out,this ); + // return xOut; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_Driver::acceptsURL( const ::rtl::OUString& url ) throw(starsdbc::SQLException, RuntimeException) +{ + if(!object) + object = java_sql_DriverManager::getDriver(url); + + jboolean out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + if(!object) + ThrowSQLException(t.pEnv,*this); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;)Z"; + char * cMethodName = "acceptsURL"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +Sequence< starsdbc::DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(starsdbc::SQLException, RuntimeException) +{ + if(!object) + object = java_sql_DriverManager::getDriver(url); + + jobjectArray out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jvalue args[2]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,url); + args[1].l = createStringPropertyArray(t.pEnv,info); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/util/Properties)[Ljava/sql/DriverPropertyInfo;"; + char * cMethodName = "getPropertyInfo"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = (jobjectArray)t.pEnv->CallObjectMethodA( getMyClass(), mID, args ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef((jstring)args[1].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return copyArrayAndDelete( t.pEnv, out, starsdbc::DriverPropertyInfo(),java_sql_DriverPropertyInfo(NULL,NULL)); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_Driver::getMajorVersion( ) throw(RuntimeException) +{ + if(!object) + throw RuntimeException(); + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMajorVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_Driver::getMinorVersion( ) throw(RuntimeException) +{ + if(!object) + throw RuntimeException(); + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMinorVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx new file mode 100644 index 000000000000..c1caef75578e --- /dev/null +++ b/connectivity/source/drivers/jdbc/Object.cxx @@ -0,0 +1,396 @@ +/************************************************************************* + * + * $RCSfile: Object.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJJECT_HXX_ +#include "java/lang/Class.hxx" +#endif + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_ +#include <com/sun/star/uno/Exception.hpp> +#endif +#ifndef _COM_SUN_STAR_JAVA_XJAVATHREADREGISTER_11_HPP_ +#include <com/sun/star/java/XJavaThreadRegister_11.hpp> +#endif +#ifndef _COM_SUN_STAR_JAVA_XJAVAVM_HPP_ +#include <com/sun/star/java/XJavaVM.hpp> +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ +#include "java/sql/SQLException.hxx" +#endif +#ifndef _VOS_MODULE_HXX_ +#include <vos/module.hxx> +#endif +#ifndef _VOS_PROCESS_HXX_ +#include <vos/process.hxx> +#endif +#ifndef _VOS_MUTEX_HXX_ +#include <vos/mutex.hxx> +#endif +#ifndef _VOS_DYNLOAD_HXX_ +#include <vos/dynload.hxx> +#endif + +#ifndef _RTL_PROCESS_H_ +#include <rtl/process.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif + +using namespace connectivity; + +namespace starjava = com::sun::star::java; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + + +JavaVM * pJVM; +Reference< ::starjava::XJavaThreadRegister_11 > xRG11Ref; +sal_Bool bJRE_Error = sal_False; +JavaVM_ * pJRE_javaVM = NULL; + +int SDB_JRE_InitJava(const Reference<XMultiServiceFactory >& _rxFactory) +{ + int result = 0; + JNIEnv * pEnv = NULL; + + try + { + Reference< ::starjava::XJavaVM > xVM(_rxFactory->createInstance( + rtl::OUString::createFromAscii("com.sun.star.java.JavaVirtualMachine")), UNO_QUERY); + + OSL_ENSHURE(_rxFactory.is(),"SDB_JRE_InitJava: I have no factory!"); + if (!xVM.is() || !_rxFactory.is()) + throw Exception(); // -2; + + Sequence<sal_Int8> processID(16); + rtl_getGlobalProcessId( (sal_uInt8*) processID.getArray() ); + + Any uaJVM = xVM->getJavaVM( processID ); + + if (!uaJVM.hasValue()) + throw Exception(); // -5 + else + { + sal_Int32 nValue; + uaJVM >>= nValue; + pJVM = (JavaVM *)nValue; + } + + xRG11Ref = Reference< ::starjava::XJavaThreadRegister_11 >(xVM, UNO_QUERY); + if (xRG11Ref.is()) + xRG11Ref->registerThread(); + + pJVM->AttachCurrentThread(reinterpret_cast<void**>(&pEnv), NULL); + + /** + * Ist zur Zeit nicht funktionsfaehig, wegen Solaris Deadlock. + */ +// initStreamObserver(pEnv); +// if(pEnv->ExceptionOccurred()) +// { +// pEnv->ExceptionDescribe(); +// pEnv->ExceptionClear(); +// } + + } + catch (Exception e) + { + if (pEnv && pEnv->ExceptionOccurred()) + { + pEnv->ExceptionDescribe(); + pEnv->ExceptionClear(); + } + + result = -1; + } + + if(pEnv) + { + if(xRG11Ref.is()) + xRG11Ref->revokeThread(); + + if(!xRG11Ref.is() || !xRG11Ref->isThreadAttached()) + pJVM->DetachCurrentThread(); + } + + return result; +} + +SDBThreadAttach::SDBThreadAttach() : bDetach(sal_False), pEnv(NULL) +{ + attachThread(pEnv); +} + +SDBThreadAttach::SDBThreadAttach(const Reference<XMultiServiceFactory >& _rxFactory) : bDetach(sal_False), pEnv(NULL) +{ + attachThread(pEnv,_rxFactory); +} + +SDBThreadAttach::~SDBThreadAttach() +{ + detachThread(); +} + +void SDBThreadAttach::attachThread(JNIEnv * &pEnv,const Reference<XMultiServiceFactory >& _rxFactory) +{ + xInit(_rxFactory); + + if(xRG11Ref.is()) + { + xRG11Ref->registerThread(); + pJVM->AttachCurrentThread(reinterpret_cast<void**>(&pEnv), NULL); + } +} + +void SDBThreadAttach::detachThread() +{ + xInit(); + + if(xRG11Ref.is()) + { + xRG11Ref->revokeThread(); + if(!xRG11Ref->isThreadAttached()) + pJVM->DetachCurrentThread(); + } +} + +void SDBThreadAttach::xInit(const Reference<XMultiServiceFactory >& _rxFactory) +{ + StartJava(_rxFactory); +} + +sal_Bool SDBThreadAttach::IsJavaErrorOccured() +{ + return bJRE_Error; +} + +void SDBThreadAttach::setError() +{ + bJRE_Error = sal_True; +} + +static sal_Bool bStarted = sal_False; +int SDBThreadAttach::StartJava(const Reference<XMultiServiceFactory >& _rxFactory) +{ + static sal_Bool bRecFlag = sal_False; + static int err = 0; + if( !bStarted ) + { + vos::OGuard aGuard( vos::OMutex::getGlobalMutex() ); + if( !bStarted && !bRecFlag) + { + bRecFlag = sal_True; + // Application::EnterMultiThread(); + // bStarted = sal_True must set after the VM is complete initialized + err = SDB_JRE_InitJava(_rxFactory); + if(err) + setError(); + bStarted = sal_True; + } + } +// return bJRE_Error ? -1 : 0; + return err; +} + +// statische Variablen der Klasse: +jclass java_lang_Object::theClass = 0; +sal_uInt32 java_lang_Object::nObjCount = 0; + +jclass java_lang_Object::getMyClass() +{ + if( !theClass ) + { +// JNIEnv * pEnv = SDBThreadAttach::GetEnv(); + SDBThreadAttach t; + + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/lang/Object" ); + theClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + } + return theClass; +} +// der eigentliche Konstruktor +java_lang_Object::java_lang_Object(const Reference<XMultiServiceFactory >& _rxFactory) + : object( 0 ),m_xFactory(_rxFactory) +{ + SDBThreadAttach t(m_xFactory); + if( !t.pEnv ) + return; + + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "()V"; + jclass tempClass; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempClass = (jclass)t.pEnv->NewObjectA( getMyClass(), mID, NULL ); + saveRef( t.pEnv, tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); +} + +// der protected-Konstruktor fuer abgeleitete Klassen +java_lang_Object::java_lang_Object( JNIEnv * pXEnv, jobject myObj ) + : object( NULL ) +{ + SDBThreadAttach t; + if( t.pEnv && myObj ) + object = t.pEnv->NewGlobalRef( myObj ); +} + +java_lang_Object::~java_lang_Object() +{ + if( object ) + { + SDBThreadAttach t; + if( t.pEnv ) + t.pEnv->DeleteGlobalRef( object ); + } +} + +// der protected-Konstruktor fuer abgeleitete Klassen +void java_lang_Object::saveRef( JNIEnv * pXEnv, jobject myObj ) +{ + OSL_ENSHURE( myObj, "object in c++ -> Java Wrapper" ); + SDBThreadAttach t; + if( t.pEnv && myObj ) + object = t.pEnv->NewGlobalRef( myObj ); +} + + +java_lang_Class * java_lang_Object::getClass() +{ + jobject out; + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/Class;"; + char * cMethodName = "getClass"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethodA( object, mID, NULL ); + + return new java_lang_Class( t.pEnv, out ); + } //mID + } //pEnv + return NULL; +} + +::rtl::OUString java_lang_Object::toString() +{ + + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "toString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out(0); + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //pEnv + return aStr; +} +// -------------------------------------------------------------------------------- +void java_lang_Object::ThrowSQLException(JNIEnv * pEnv,const Reference< XInterface> & _rContext) throw(SQLException, RuntimeException) +{ + jthrowable jThrow = NULL; + if(pEnv && (jThrow = pEnv->ExceptionOccurred())) + { + if(pEnv->IsInstanceOf(jThrow,java_sql_SQLException_BASE::getMyClass())) + { + throw java_sql_SQLException(java_sql_SQLException_BASE(pEnv,jThrow),_rContext); + } + else if(pEnv->IsInstanceOf(jThrow,java_lang_Throwable::getMyClass())) + { + java_lang_Throwable *pThrow = new java_lang_Throwable(pEnv,jThrow); + ::rtl::OUString aMsg = pThrow->getMessage(); + delete pThrow; + throw RuntimeException(aMsg,_rContext); + } + pEnv->ExceptionClear(); + } +} + + diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx new file mode 100644 index 000000000000..4b7a5dd70e07 --- /dev/null +++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx @@ -0,0 +1,842 @@ +/************************************************************************* + * + * $RCSfile: PreparedStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_PREPAREDSTATEMENT_HXX_ +#include "java/sql/PreparedStatement.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ +#include "java/sql/ResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ +#include "java/sql/Connection.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ +#include "java/sql/Timestamp.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +//************************************************************** +//************ Class: java.sql.PreparedStatement +//************************************************************** +IMPLEMENT_SERVICE_INFO(java_sql_PreparedStatement,"com.sun.star.sdbcx.JPreparedStatement","com.sun.star.sdbc.PreparedStatement"); + +jclass java_sql_PreparedStatement::theClass = 0; + +java_sql_PreparedStatement::~java_sql_PreparedStatement() +{} + +jclass java_sql_PreparedStatement::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/PreparedStatement"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +// ------------------------------------------------------------------------- + +void java_sql_PreparedStatement::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// ------------------------------------------------------------------------- + +::com::sun::star::uno::Any SAL_CALL java_sql_PreparedStatement::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aRet = OStatement_BASE2::queryInterface(rType); + if(!aRet.hasValue()) + aRet = ::cppu::queryInterface( rType, + static_cast< XPreparedStatement*>(this), + static_cast< XParameters*>(this), + static_cast< XPreparedBatchExecution*>(this)); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL java_sql_PreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedStatement > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XParameters > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedBatchExecution > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OStatement_BASE2::getTypes()); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_PreparedStatement::execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "execute"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_PreparedStatement::executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "executeUpdate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = parameterIndex; + args[1].l = convertwchar_tToJavaString(t.pEnv,x); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/String;)V"; + char * cMethodName = "setString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[1].l); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL java_sql_PreparedStatement::getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ +// jobject out(0); +// SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); +// if( t.pEnv ){ +// +// // temporaere Variable initialisieren +// char * cSignature = "()Ljava/sql/Connection;"; +// char * cMethodName = "getConnection"; +// // Java-Call absetzen +// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); +// if( mID ){ +// out = t.pEnv->CallObjectMethod( object, mID); +// ThrowSQLException(t.pEnv,*this); +// } //mID +// } //t.pEnv +// // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! +// return out==0 ? 0 : new java_sql_Connection( t.pEnv, out ); + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- + +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_PreparedStatement::executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/ResultSet;"; + char * cMethodName = "executeQuery"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].z = x; + // temporaere Variable initialisieren + char * cSignature = "(IZ)V"; + char * cMethodName = "setBoolean"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].z); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].b = x; + // temporaere Variable initialisieren + char * cSignature = "(IB)V"; + char * cMethodName = "setByte"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].b); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = parameterIndex; + java_sql_Date aT(x); + args[1].l = aT.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Date;)V"; + char * cMethodName = "setDate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + + +void SAL_CALL java_sql_PreparedStatement::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + java_sql_Time aT(x); + args[1].l = aT.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Time;)V"; + char * cMethodName = "setTime"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + java_sql_Timestamp aT(x); + args[1].l = aT.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Timestamp;)V"; + char * cMethodName = "setTimestamp"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + + + +void SAL_CALL java_sql_PreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].d = x; + // temporaere Variable initialisieren + char * cSignature = "(ID)V"; + char * cMethodName = "setDouble"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].d); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].f = x; + // temporaere Variable initialisieren + char * cSignature = "(IF)V"; + char * cMethodName = "setFloat"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ +t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].f); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].i = (sal_Int32)x; + // temporaere Variable initialisieren + char * cSignature = "(II)V"; + char * cMethodName = "setInt"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].j = x; + // temporaere Variable initialisieren + char * cSignature = "(IJ)V"; + char * cMethodName = "setLong"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ +t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].j); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].i = (sal_Int32)sqlType; + // temporaere Variable initialisieren + char * cSignature = "(II)V"; + char * cMethodName = "setNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Clob;)V"; + char * cMethodName = "setClob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Blob;)V"; + char * cMethodName = "setBlob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Array;)V"; + char * cMethodName = "setArray"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Ref;)V"; + char * cMethodName = "setRef"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/Object;II)V"; + char * cMethodName = "setObject"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l,targetSqlType,scale); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/Object;)V"; + char * cMethodName = "setObject"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/Object;)V"; + char * cMethodName = "setObject"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].s = (sal_Int16)x; + // temporaere Variable initialisieren + char * cSignature = "(IS)V"; + char * cMethodName = "setShort"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].s); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + jbyteArray pByteArray = t.pEnv->NewByteArray(x.getLength()); + t.pEnv->SetByteArrayRegion(pByteArray,0,x.getLength(),(jbyte*)x.getConstArray()); + args[1].l = pByteArray; + // temporaere Variable initialisieren + char * cSignature = "(I[B)V"; + char * cMethodName = "setBytes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + t.pEnv->DeleteLocalRef(pByteArray); + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 parameterIndex, 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) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + jvalue args2[3]; + jbyteArray pByteArray = t.pEnv->NewByteArray(length); + Sequence< sal_Int8> aSeq; + x->readBytes(aSeq,length); + t.pEnv->SetByteArrayRegion(pByteArray,0,length,(jbyte*)aSeq.getConstArray()); + args2[0].l = pByteArray; + args2[1].i = 0; + args2[2].i = (sal_Int32)length; + + // temporaere Variable initialisieren + char * cSignatureStream = "([BII)V"; + // Java-Call absetzen + jclass aClass = t.pEnv->FindClass("java/io/CharArrayInputStream"); + jmethodID mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream ); + jobject tempObj = NULL; + if(mID2) + tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 ); + + // + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/io/InputStream;I)V"; + char * cMethodName = "setCharacterStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + t.pEnv->CallVoidMethod( object, mID, args[0].i,tempObj,length); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(pByteArray); + t.pEnv->DeleteLocalRef(tempObj); + t.pEnv->DeleteLocalRef(aClass); + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIndex, 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) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + jvalue args2[3]; + jbyteArray pByteArray = t.pEnv->NewByteArray(length); + Sequence< sal_Int8> aSeq; + x->readBytes(aSeq,length); + t.pEnv->SetByteArrayRegion(pByteArray,0,length,(jbyte*)aSeq.getConstArray()); + args2[0].l = pByteArray; + args2[1].i = 0; + args2[2].i = (sal_Int32)length; + + // temporaere Variable initialisieren + char * cSignatureStream = "([BII)V"; + // Java-Call absetzen + jclass aClass = t.pEnv->FindClass("java/io/ByteArrayInputStream"); + jmethodID mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream ); + jobject tempObj = NULL; + if(mID2) + tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 ); + + // + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/io/InputStream;I)V"; + char * cMethodName = "setBinaryStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + t.pEnv->CallVoidMethod( object, mID, args[0].i,tempObj,(sal_Int32)length); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(pByteArray); + t.pEnv->DeleteLocalRef(tempObj); + t.pEnv->DeleteLocalRef(aClass); + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "clearParameters"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_PreparedStatement::clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "clearBatch"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "addBatch"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL java_sql_PreparedStatement::executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Sequence< sal_Int32 > aSeq; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()[I"; + char * cMethodName = "executeBatch"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jintArray out = (jintArray)t.pEnv->CallObjectMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + if(out) + { + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetIntArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } + } //mID + } //t.pEnv + return aSeq; +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/jdbc/Reader.cxx b/connectivity/source/drivers/jdbc/Reader.cxx new file mode 100644 index 000000000000..11ba4fa816e2 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Reader.cxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * $RCSfile: Reader.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_IO_READER_HXX_ +#include "java/io/Reader.hxx" +#endif +#ifndef _INC_MEMORY +#include <memory.h> +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.io.Reader +//************************************************************** + +jclass java_io_Reader::theClass = 0; + +java_io_Reader::~java_io_Reader() +{} + +jclass java_io_Reader::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/io/Reader" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_io_Reader::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +sal_Int32 SAL_CALL java_io_Reader::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + return readBytes(aData,nMaxBytesToRead); +} + +void SAL_CALL java_io_Reader::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + char * cSignature = "(I)I"; + char * cMethodName = "skip"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallIntMethod( object, mID,nBytesToSkip); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv +} + +sal_Int32 SAL_CALL java_io_Reader::available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + char * cSignature = "()Z"; + char * cMethodName = "available"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv + return out; +} +void SAL_CALL java_io_Reader::closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + char * cSignature = "()V"; + char * cMethodName = "close"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv +} +// ----------------------------------------------------- +sal_Int32 SAL_CALL java_io_Reader::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + OSL_ENSHURE(aData.getLength() < nBytesToRead," Sequence is smaller than BytesToRead"); + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + jcharArray pCharArray = t.pEnv->NewCharArray(nBytesToRead); + char * cSignature = "([CII)I"; + char * cMethodName = "read"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + while(!(out = t.pEnv->CallIntMethod( object, mID,pCharArray,0,nBytesToRead))) + ThrowSQLException(t.pEnv,*this); + if(out > 0) + { + jboolean p = sal_False; + if(aData.getLength() < out) + aData.realloc(out-aData.getLength()); + + memcpy(aData.getArray(),t.pEnv->GetCharArrayElements(pCharArray,&p),out); + } + } + t.pEnv->DeleteLocalRef((jcharArray)pCharArray); + } //t.pEnv + return out; +} + diff --git a/connectivity/source/drivers/jdbc/Ref.cxx b/connectivity/source/drivers/jdbc/Ref.cxx new file mode 100644 index 000000000000..50d9c39bb548 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Ref.cxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * $RCSfile: Ref.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_REF_HXX_ +#include "java/sql/Ref.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.Ref +//************************************************************** + +jclass java_sql_Ref::theClass = 0; + +java_sql_Ref::~java_sql_Ref() +{} + +jclass java_sql_Ref::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/sql/Ref" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Ref::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +::rtl::OUString SAL_CALL java_sql_Ref::getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getBaseTypeName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx new file mode 100644 index 000000000000..94bd7aa197b4 --- /dev/null +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -0,0 +1,1842 @@ +/************************************************************************* + * + * $RCSfile: ResultSet.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ +#include "java/sql/ResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_STATEMENT_HXX_ +#include "java/sql/Statement.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_SQLWARNING_HXX_ +#include "java/sql/SQLWarning.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ +#include "java/sql/Array.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_REF_HXX_ +#include "java/sql/Ref.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ +#include "java/sql/Clob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ +#include "java/sql/Timestamp.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ +#include "java/sql/Blob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSETMETADATA_HXX_ +#include "java/sql/ResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ +#include "java/io/InputStream.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _UTL_PROPERTY_HXX_ +#include <unotools/property.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif + + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +IMPLEMENT_SERVICE_INFO(java_sql_ResultSet,"com.sun.star.sdbcx.JResultSet","com.sun.star.sdbc.ResultSet"); +//************************************************************** +//************ Class: java.sql.ResultSet +//************************************************************** + +jclass java_sql_ResultSet::theClass = 0; + +java_sql_ResultSet::~java_sql_ResultSet() +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + char * cSignature = "()V"; + char * cMethodName = "close"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + t.pEnv->CallVoidMethod( object, mID); + } +} + +jclass java_sql_ResultSet::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/ResultSet"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_ResultSet::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// ------------------------------------------------------------------------- +void java_sql_ResultSet::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + m_xMetaData = NULL; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Any SAL_CALL java_sql_ResultSet::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aRet = OPropertySetHelper::queryInterface(rType); + if(!aRet.hasValue()) + aRet = java_sql_ResultSet_BASE::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL java_sql_ResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),java_sql_ResultSet_BASE::getTypes()); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSet::findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,columnName); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;)I"; + char * cMethodName = "findColumn"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, args[0].l ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[0].l); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + + +Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/io/InputStream;"; + char * cMethodName = "getBinaryStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/io/InputStream;"; + char * cMethodName = "getCharacterStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "getBoolean"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Int8 SAL_CALL java_sql_ResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jbyte out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)B"; + char * cMethodName = "getByte"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallByteMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + Sequence< sal_Int8 > aSeq; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + char * cSignature = "(I)[B"; + char * cMethodName = "getBytes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + if (out) + { + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } + // und aufraeumen + } //mID + } //t.pEnv + return aSeq; +} +// ------------------------------------------------------------------------- + +::com::sun::star::util::Date SAL_CALL java_sql_ResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Date;"; + char * cMethodName = "getDate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Date( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +double SAL_CALL java_sql_ResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jdouble out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)D"; + char * cMethodName = "getDouble"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallDoubleMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +float SAL_CALL java_sql_ResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jfloat out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)F"; + char * cMethodName = "getFloat"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallFloatMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getInt"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSet::getRow( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jlong out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)J"; + char * cMethodName = "getLong"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +::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) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/ResultSetMetaData;"; + char * cMethodName = "getMetaData"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSetMetaData( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XArray > SAL_CALL java_sql_ResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getArray"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Array( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +Reference< XClob > SAL_CALL java_sql_ResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getClob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Clob( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XBlob > SAL_CALL java_sql_ResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getBlob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Blob( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +Reference< XRef > SAL_CALL java_sql_ResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getRef"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Ref( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + args[1].l = XNameAccess2Map(t.pEnv,typeMap); + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/Object;"; + char * cMethodName = "getObject"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethodA( object, mID, args); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jstring)args[1].l); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? Any() : Any();//new java_lang_Object( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jshort out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)S"; + char * cMethodName = "getShort"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallShortMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int16)out; +} +// ------------------------------------------------------------------------- + + +::rtl::OUString SAL_CALL java_sql_ResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jstring out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- + + +::com::sun::star::util::Time SAL_CALL java_sql_ResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Time;"; + char * cMethodName = "getTime"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Time( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + + +::com::sun::star::util::DateTime SAL_CALL java_sql_ResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Timestamp;"; + char * cMethodName = "getTimestamp"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Timestamp( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::isAfterLast( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isAfterLast"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::isFirst( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isFirst"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::isLast( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isLast"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::beforeFirst( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "isBeforeFirst"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::afterLast( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "afterLast"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "close"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::first( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "first"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::last( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "last"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "absolute"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,row); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "relative"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,row); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::previous( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "previous"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL java_sql_ResultSet::getStatement( ) throw(SQLException, RuntimeException) +{ +// jobject out(0); +// SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); +// if( t.pEnv ) +// { +// // temporaere Variable initialisieren +// char * cSignature = "()Ljava/sql/Statement;"; +// char * cMethodName = "getStatement"; +// // Java-Call absetzen +// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); +// if( mID ){ +// out = t.pEnv->CallObjectMethod( object, mID ); +// ThrowSQLException(t.pEnv,*this); +// } //mID +// } //t.pEnv +// // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! +// return out==0 ? 0 : (::cppu::OWeakObject*)new java_sql_Statement( t.pEnv, out ); + return m_aStatement.get(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::rowDeleted( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "rowDeleted"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::rowInserted( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "rowInserted"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::rowUpdated( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "rowUpdated"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isBeforeFirst"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::next( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "next"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::wasNull( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "wasNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::cancel( ) throw(::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "cancel"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "clearWarnings"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Any SAL_CALL java_sql_ResultSet::getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobject out(NULL); + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/SQLWarning;"; + char * cMethodName = "getWarnings"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? makeAny(java_sql_SQLWarning(java_sql_SQLWarning_BASE( t.pEnv, out ),*this)) : ::com::sun::star::uno::Any(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "insertRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "updateRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "deleteRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "cancelRowUpdates"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "moveToInsertRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "moveToCurrentRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)V"; + char * cMethodName = "updateNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(IZ)V"; + char * cMethodName = "updateNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(IB)V"; + char * cMethodName = "updateByte"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(IS)V"; + char * cMethodName = "updateShort"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(II)V"; + char * cMethodName = "updateInt"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(IJ)V"; + char * cMethodName = "updateLong"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +// ----------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(IF)V"; + char * cMethodName = "updateFloat"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(ID)V"; + char * cMethodName = "updateDouble"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +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) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,x); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/String)V"; + char * cMethodName = "updateString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jstring)args[0].l); + } + } +} +// ------------------------------------------------------------------------- + +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) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + jbyteArray aArray = t.pEnv->NewByteArray(x.getLength()); + t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),(jbyte*)x.getConstArray()); + + // Parameter konvertieren + args[0].l = aArray; + // temporaere Variable initialisieren + char * cSignature = "(I[B)V"; + char * cMethodName = "updateBytes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jbyteArray)args[0].l); + } + } +} +// ------------------------------------------------------------------------- + +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) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + java_sql_Date aD(x); + args[0].l = aD.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Date;)V"; + char * cMethodName = "updateDate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +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) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + java_sql_Time aD(x); + args[0].l = aD.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Time;)V"; + char * cMethodName = "updateTime"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +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) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + java_sql_Timestamp aD(x); + // Parameter konvertieren + args[0].l = aD.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(I;Ljava/sql/Timestamp;)V"; + char * cMethodName = "updateTimestamp"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +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) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/io/InputStream;I)V"; + char * cMethodName = "updateBinaryStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l,length); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jobject)args[0].l); + } + } +} +// ------------------------------------------------------------------------- +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) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/io/InputStream;I)V"; + char * cMethodName = "updateCharacterStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l,length); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jobject)args[0].l); + } + } +} +// ------------------------------------------------------------------------- +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) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + switch(x.getValueTypeClass()) + { + case TypeClass_VOID: + args[0].l = NULL; + break; + + case TypeClass_BOOLEAN: + { + sal_Bool f; + x >>= f; + updateBoolean(columnIndex,f); + } + break; + case TypeClass_BYTE: + { + sal_Int8 f; + x >>= f; + updateByte(columnIndex,f); + } + break; + case TypeClass_SHORT: + case TypeClass_UNSIGNED_SHORT: + { + sal_Int16 f; + x >>= f; + updateShort(columnIndex,f); + } + break; + case TypeClass_LONG: + case TypeClass_UNSIGNED_LONG: + { + sal_Int32 f; + x >>= f; + updateInt(columnIndex,f); + } + break; + case TypeClass_HYPER: + case TypeClass_UNSIGNED_HYPER: + { + sal_Int64 f; + x >>= f; + updateLong(columnIndex,f); + } + break; + case TypeClass_FLOAT: + { + float f; + x >>= f; + updateFloat(columnIndex,f); + } + break; + case TypeClass_DOUBLE: + updateDouble(columnIndex,connectivity::getDouble(x)); + break; + case TypeClass_CHAR: + case TypeClass_STRING: + updateString(columnIndex,connectivity::getString(x)); + break; + case TypeClass_ENUM: + default: + OSL_ENSHURE(0,"UNKOWN TYPE for java_sql_ResultSet::updateObject"); + } + return; + // Parameter konvertieren + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/Object;)V"; + char * cMethodName = "updateObject"; + // Java-Call absetzen +// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); +// if( mID ){ +// t.pEnv->CallVoidMethodA( object, mID,columnIndex,args); + ThrowSQLException(t.pEnv,*this); +// switch(x.getValueTypeClass()) +// { +// case TypeClass_CHAR: +// case TypeClass_STRING: +// t.pEnv->DeleteLocalRef((jobject)args[0].l); +// break; +// } +// } + } +} +// ------------------------------------------------------------------------- + +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) +{ + OSL_ENSHURE(0,"java_sql_ResultSet::updateNumericObject: NYI"); +// SDBThreadAttach t; +// if( t.pEnv ) +// { +// jvalue args[1]; +// // Parameter konvertieren +// args[0].l = +// // temporaere Variable initialisieren +// char * cSignature = "(I;Ljava/lang/Object;I)V"; +// char * cMethodName = "updateObject"; +// // Java-Call absetzen +// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); +// if( mID ){ +// t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l,scale); + // ThrowSQLException(t.pEnv,*this); +// t.pEnv->DeleteLocalRef((jobject)args[0].l); +// } +// } +} +// ------------------------------------------------------------------------- +//------------------------------------------------------------------------------ +sal_Int32 java_sql_ResultSet::getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getResultSetConcurrency"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +//------------------------------------------------------------------------------ +sal_Int32 java_sql_ResultSet::getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getResultSetType"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +//------------------------------------------------------------------------------ +sal_Int32 java_sql_ResultSet::getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getFetchDirection"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +//------------------------------------------------------------------------------ +sal_Int32 java_sql_ResultSet::getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getFetchSize"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +//------------------------------------------------------------------------------ +::rtl::OUString java_sql_ResultSet::getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getCursorName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + +//------------------------------------------------------------------------------ +void java_sql_ResultSet::setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)V"; + char * cMethodName = "setFetchDirection"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,_par0); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + +} +//------------------------------------------------------------------------------ +void SAL_CALL java_sql_ResultSet::refreshRow( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "refreshRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv +} +//------------------------------------------------------------------------------ +void java_sql_ResultSet::setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)V"; + char * cMethodName = "setFetchSize"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,_par0); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* java_sql_ResultSet::createArrayHelper( ) const +{ + Sequence< Property > aProps(5); + Property* pProperties = aProps.getArray(); + sal_Int32 nPos = 0; + DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY); + DECL_PROP0(FETCHDIRECTION, sal_Int32); + DECL_PROP0(FETCHSIZE, sal_Int32); + DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY); + DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); + + return new ::cppu::OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & java_sql_ResultSet::getInfoHelper() +{ + return *const_cast<java_sql_ResultSet*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +sal_Bool java_sql_ResultSet::convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException) +{ + switch(nHandle) + { + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + throw ::com::sun::star::lang::IllegalArgumentException(); + break; + case PROPERTY_ID_FETCHDIRECTION: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); + case PROPERTY_ID_FETCHSIZE: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); + default: + ; + } + return sal_False; +} +// ------------------------------------------------------------------------- +void java_sql_ResultSet::setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception) +{ + switch(nHandle) + { + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + throw ::com::sun::star::uno::Exception(); + break; + case PROPERTY_ID_FETCHDIRECTION: + setFetchDirection(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_FETCHSIZE: + setFetchSize(connectivity::getINT32(rValue)); + break; + default: + ; + } +} +// ------------------------------------------------------------------------- +void java_sql_ResultSet::getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const +{ + switch(nHandle) + { + case PROPERTY_ID_CURSORNAME: + rValue <<= getCursorName(); + break; + case PROPERTY_ID_RESULTSETCONCURRENCY: + rValue <<= getResultSetConcurrency(); + break; + case PROPERTY_ID_RESULTSETTYPE: + rValue <<= getResultSetType(); + break; + case PROPERTY_ID_FETCHDIRECTION: + rValue <<= getFetchDirection(); + break; + case PROPERTY_ID_FETCHSIZE: + rValue <<= getFetchSize(); + break; + } +} + + + diff --git a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx new file mode 100644 index 000000000000..b44bc920b6ef --- /dev/null +++ b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx @@ -0,0 +1,563 @@ +/************************************************************************* + * + * $RCSfile: ResultSetMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSETMETADATA_HXX_ +#include "java/sql/ResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +//************************************************************** +//************ Class: java.sql.ResultSetMetaData +//************************************************************** + +jclass java_sql_ResultSetMetaData::theClass = 0; + +java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData() +{} + +jclass java_sql_ResultSetMetaData::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/ResultSetMetaData"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +// ------------------------------------------------------------------------- + +void java_sql_ResultSetMetaData::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getColumnDisplaySize"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID,column); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getColumnType"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID,column); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getColumnCount"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isCaseSensitive"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = (sal_Bool)t.pEnv->CallIntMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getSchemaName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getColumnName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getTableName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getCatalogName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getColumnTypeName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getColumnLabel"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getColumnClassName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isCurrency"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = (sal_Bool)t.pEnv->CallIntMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isAutoIncrement"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = (sal_Bool)t.pEnv->CallIntMethod( object, mID, column); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isSigned"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = (sal_Bool)t.pEnv->CallIntMethod( object, mID, column); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getPrecision"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getScale"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "isNullable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isSearchable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isReadOnly"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isDefinitelyWritable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isWritable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/jdbc/SQLException.cxx b/connectivity/source/drivers/jdbc/SQLException.cxx new file mode 100644 index 000000000000..1a83ce996314 --- /dev/null +++ b/connectivity/source/drivers/jdbc/SQLException.cxx @@ -0,0 +1,186 @@ +/************************************************************************* + * + * $RCSfile: SQLException.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ +#include "java/sql/SQLException.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +//************************************************************** +//************ Class: java.sql.SQLException +//************************************************************** +java_sql_SQLException::java_sql_SQLException( const java_sql_SQLException_BASE& _rException,const Reference< XInterface> & _rContext) + : starsdbc::SQLException( _rException.getMessage(), + _rContext, + _rException.getSQLState(), + _rException.getErrorCode(), + makeAny(_rException.getNextException()) + ) +{ +} + +java_sql_SQLException_BASE::java_sql_SQLException_BASE( JNIEnv * pEnv, jobject myObj ) : java_lang_Exception( pEnv, myObj ) +{ +} + +jclass java_sql_SQLException_BASE::theClass = 0; + +java_sql_SQLException_BASE::~java_sql_SQLException_BASE() +{} + + +jclass java_sql_SQLException_BASE::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/sql/SQLException"); + OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + if(!tempClass) + { + t.pEnv->ExceptionDescribe(); + t.pEnv->ExceptionClear(); + } + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_SQLException_BASE::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +starsdbc::SQLException java_sql_SQLException_BASE::getNextException() const +{ + jobject out = NULL; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/Exception;"; + char * cMethodName = "getNextException"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,0); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? (starsdbc::SQLException)java_sql_SQLException(java_sql_SQLException_BASE(t.pEnv,out),0) : starsdbc::SQLException(); +} + +::rtl::OUString java_sql_SQLException_BASE::getSQLState() const +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getSQLState"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring) t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,0); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +sal_Int32 java_sql_SQLException_BASE::getErrorCode() const +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getErrorCode"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,0); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + diff --git a/connectivity/source/drivers/jdbc/SQLWarning.cxx b/connectivity/source/drivers/jdbc/SQLWarning.cxx new file mode 100644 index 000000000000..aec20eeeb495 --- /dev/null +++ b/connectivity/source/drivers/jdbc/SQLWarning.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * $RCSfile: SQLWarning.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_SQLWARNING_HXX_ +#include "java/sql/SQLWarning.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.SQLWarning +//************************************************************** + +jclass java_sql_SQLWarning_BASE::theClass = 0; + +java_sql_SQLWarning_BASE::~java_sql_SQLWarning_BASE() +{} + +jclass java_sql_SQLWarning_BASE::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/sql/SQLWarning" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_SQLWarning_BASE::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + diff --git a/connectivity/source/drivers/jdbc/String.cxx b/connectivity/source/drivers/jdbc/String.cxx new file mode 100644 index 000000000000..a25472d00a52 --- /dev/null +++ b/connectivity/source/drivers/jdbc/String.cxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * $RCSfile: String.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_STRING_HXX_ +#include "java/lang/String.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.lang.String +//************************************************************** + +jclass java_lang_String::theClass = 0; + +java_lang_String::~java_lang_String() +{} + +jclass java_lang_String::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/lang/String"); + OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +//-------------------------------------------------------------------------- +void java_lang_String::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +//-------------------------------------------------------------------------- +java_lang_String::java_lang_String( const ::rtl::OUString& _par0 ): java_lang_Object( NULL, (jobject)NULL ) +{ + SDBThreadAttach t; + if( !t.pEnv ) + return; + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,_par0); + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;)V"; + jobject tempObj; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); + saveRef( t.pEnv, tempObj ); + t.pEnv->DeleteLocalRef( tempObj ); + t.pEnv->DeleteLocalRef((jstring)args[0].l); +} +//-------------------------------------------------------------------------- +java_lang_String::operator ::rtl::OUString() +{ + SDBThreadAttach t; + if(!t.pEnv) + return ::rtl::OUString(); + return JavaString2String(t.pEnv,(jstring)object); +} + diff --git a/connectivity/source/drivers/jdbc/Throwable.cxx b/connectivity/source/drivers/jdbc/Throwable.cxx new file mode 100644 index 000000000000..336425836cb6 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Throwable.cxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * $RCSfile: Throwable.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_THROWABLE_HXX_ +#include "java/lang/Throwable.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.lang.Throwable +//************************************************************** + +jclass java_lang_Throwable::theClass = 0; + +java_lang_Throwable::~java_lang_Throwable() +{} + +jclass java_lang_Throwable::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/lang/Throwable"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_lang_Throwable::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +::rtl::OUString java_lang_Throwable::getMessage() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getMessage"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + +::rtl::OUString java_lang_Throwable::getLocalizedMessage() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getLocalizedMessage"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +::rtl::OUString java_lang_Throwable::toString() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "toString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + diff --git a/connectivity/source/drivers/jdbc/Timestamp.cxx b/connectivity/source/drivers/jdbc/Timestamp.cxx new file mode 100644 index 000000000000..6da40bc40653 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Timestamp.cxx @@ -0,0 +1,240 @@ +/************************************************************************* + * + * $RCSfile: Timestamp.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ +#include "java/sql/Timestamp.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_DATECONVERSION_HXX_ +#include "DateConversion.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.Date +//************************************************************** + +jclass java_sql_Date::theClass = 0; + +java_sql_Date::~java_sql_Date() +{} + +jclass java_sql_Date::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/Date"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Date::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +//************************************************************** +//************ Class: java.sql.Time +//************************************************************** + +jclass java_sql_Time::theClass = 0; + +java_sql_Time::~java_sql_Time() +{} + +jclass java_sql_Time::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/Time"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Time::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +java_sql_Time::java_sql_Time( const ::com::sun::star::util::Time& _rOut ): java_util_Date( NULL, (jobject)NULL ) +{ + SDBThreadAttach t; + if( !t.pEnv ) + return; + jvalue args[1]; + // Parameter konvertieren + args[0].j = DateConversion::toINT32(_rOut); + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "(J)V"; + jobject tempObj; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); + saveRef( t.pEnv, tempObj ); + t.pEnv->DeleteLocalRef( tempObj ); + // und aufraeumen +} + +//************************************************************** +//************ Class: java.sql.Timestamp +//************************************************************** + +jclass java_sql_Timestamp::theClass = 0; + +java_sql_Timestamp::~java_sql_Timestamp() +{} + +jclass java_sql_Timestamp::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/Timestamp"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Timestamp::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +java_sql_Timestamp::java_sql_Timestamp(const ::com::sun::star::util::DateTime& _rOut) + :java_util_Date( NULL, (jobject)NULL ) +{ + SDBThreadAttach t; + if( !t.pEnv ) + return; + jvalue args[1]; + // Parameter konvertieren + args[0].j = (jlong)DateConversion::toINT64(_rOut); + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "(J)V"; + jobject tempObj; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); + saveRef( t.pEnv, tempObj ); + t.pEnv->DeleteLocalRef( tempObj ); + // und aufraeumen +} + +sal_Int32 java_sql_Timestamp::getNanos() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getNanos"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +void java_sql_Timestamp::setNanos( sal_Int32 _par0 ) +{ + SDBThreadAttach t; + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)_par0; + // temporaere Variable initialisieren + char * cSignature = "(I)V"; + char * cMethodName = "setNanos"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i ); + // und aufraeumen + } //mID + } //t.pEnv +} + diff --git a/connectivity/source/drivers/jdbc/exports.dxp b/connectivity/source/drivers/jdbc/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/connectivity/source/drivers/jdbc/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/connectivity/source/drivers/jdbc/jdbc.xml b/connectivity/source/drivers/jdbc/jdbc.xml new file mode 100644 index 000000000000..5ed71581fd54 --- /dev/null +++ b/connectivity/source/drivers/jdbc/jdbc.xml @@ -0,0 +1,69 @@ +<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "componentdependencies.dtd"> +<COMPONENTDESCRIPTION> + +<Name> com.sun.star.sdbc.JDBCDriver </Name> + +<Description> + This component provides ... +</Description> + +<ModuleName> jdbc </ModuleName> + +<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName> + +<SupportedService> com.sun.star.sdbc.Driver </SupportedService> + +<ServiceDependency> ... </ServiceDependency> + +<ProjectBuildDependency> cppuhelper </ProjectBuildDependency> +<ProjectBuildDependency> cppu </ProjectBuildDependency> +<ProjectBuildDependency> sal </ProjectBuildDependency> +<ProjectBuildDependency> vos </ProjectBuildDependency> + +<RuntimeModuleDependency> cppuhelper </RuntimeModuleDependency> +<RuntimeModuleDependency> cppu1 </RuntimeModuleDependency> +<RuntimeModuleDependency> sal1 </RuntimeModuleDependency> +<RuntimeModuleDependency> vos </RuntimeModuleDependency> + +<Language> c++ </Language> + +<Status StatusValue="final"/> + +<Type> com.sun.star.util.XCancellable </Type> +<Type> com.sun.star.util.XNumberFormatter </Type> +<Type> com.sun.star.uno.TypeClass </Type> +<Type> com.sun.star.uno.XWeak </Type> +<Type> com.sun.star.uno.XAggregation </Type> +<Type> com.sun.star.beans.XPropertyState </Type> +<Type> com.sun.star.beans.XPropertySet </Type> +<Type> com.sun.star.beans.PropertyValue </Type> +<Type> com.sun.star.beans.XMultiPropertySet </Type> +<Type> com.sun.star.beans.XFastPropertySet </Type> +<Type> com.sun.star.lang.XTypeProvider </Type> +<Type> com.sun.star.lang.EventObject </Type> +<Type> com.sun.star.lang.XComponent </Type> +<Type> com.sun.star.lang.IllegalArgumentException </Type> +<Type> com.sun.star.lang.XMultiServiceFactory </Type> +<Type> com.sun.star.java.XJavaThreadRegister_11 </Type> +<Type> com.sun.star.java.XJavaVM </Type> +<Type> com.sun.star.sdbc.XConnection </Type> +<Type> com.sun.star.sdbc.XStatement </Type> +<Type> com.sun.star.sdbc.XResultSet </Type> +<Type> com.sun.star.sdbc.XResultSetMetaDataSupplier</Type> +<Type> com.sun.star.sdbc.XColumnLocate </Type> +<Type> com.sun.star.sdbc.XResultSetUpdate </Type> +<Type> com.sun.star.sdbc.XWarningsSupplier </Type> +<Type> com.sun.star.sdbc.XRowUpdate </Type> +<Type> com.sun.star.sdbc.XMultipleResults </Type> +<Type> com.sun.star.sdbc.XBatchExecution </Type> +<Type> com.sun.star.sdbc.XPreparedBatchExecution </Type> +<Type> com.sun.star.sdbc.XParameters </Type> +<Type> com.sun.star.sdbc.XOutParameters </Type> +<Type> com.sun.star.sdbc.DriverPropertyInfo </Type> +<Type> com.sun.star.sdbc.XRow </Type> +<Type> com.sun.star.sdb.XColumnUpdate </Type> +<Type> com.sun.star.sdb.XColumn </Type> + +</COMPONENTDESCRIPTION> + diff --git a/connectivity/source/drivers/jdbc/jservices.cxx b/connectivity/source/drivers/jdbc/jservices.cxx new file mode 100644 index 000000000000..a24b49c290ec --- /dev/null +++ b/connectivity/source/drivers/jdbc/jservices.cxx @@ -0,0 +1,209 @@ +/************************************************************************* + * + * $RCSfile: jservices.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVER_HXX_ +#include "java/sql/Driver.hxx" +#endif +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif + +using namespace connectivity; +using ::rtl::OUString; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::registry::XRegistryKey; +using ::com::sun::star::lang::XSingleServiceFactory; +using ::com::sun::star::lang::XMultiServiceFactory; + +typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) + ( + const Reference< XMultiServiceFactory > & rServiceManager, + const OUString & rComponentName, + ::cppu::ComponentInstantiation pCreateFunction, + const Sequence< OUString > & rServiceNames + ); + +//*************************************************************************************** +// +// Die vorgeschriebene C-Api muss erfuellt werden! +// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. +// + +//--------------------------------------------------------------------------------------- +void REGISTER_PROVIDER( + const OUString& aServiceImplName, + const Sequence< OUString>& Services, + const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) +{ + OUString aMainKeyName; + aMainKeyName = OUString::createFromAscii("/"); + aMainKeyName += aServiceImplName; + aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); + + Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); + OSL_ENSHURE(xNewKey.is(), "SBA::component_writeInfo : could not create a registry key !"); + + for (sal_uInt32 i=0; i<Services.getLength(); ++i) + xNewKey->createKey(Services[i]); +} + + +//--------------------------------------------------------------------------------------- +struct ProviderRequest +{ + Reference< XSingleServiceFactory > xRet; + Reference< XMultiServiceFactory > const xServiceManager; + OUString const sImplementationName; + + ProviderRequest( + void* pServiceManager, + sal_Char const* pImplementationName + ) + : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) + , sImplementationName(OUString::createFromAscii(pImplementationName)) + { + } + + inline + sal_Bool CREATE_PROVIDER( + const OUString& Implname, + const Sequence< OUString > & Services, + ::cppu::ComponentInstantiation Factory, + createFactoryFunc creator + ) + { + if (!xRet.is() && (Implname == sImplementationName)) + try + { + xRet = creator( xServiceManager, sImplementationName,Factory, Services); + } + catch(...) + { + } + return xRet.is(); + } + + void* getProvider() const { return xRet.get(); } +}; + +//--------------------------------------------------------------------------------------- + +extern "C" void SAL_CALL component_getImplementationEnvironment( + const sal_Char **ppEnvTypeName, + uno_Environment **ppEnv + ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//--------------------------------------------------------------------------------------- +extern "C" sal_Bool SAL_CALL component_writeInfo( + void* pServiceManager, + void* pRegistryKey + ) +{ + if (pRegistryKey) + try + { + Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); + + REGISTER_PROVIDER( + java_sql_Driver::getImplementationName_Static(), + java_sql_Driver::getSupportedServiceNames_Static(), xKey); + + return sal_True; + } + catch (::com::sun::star::registry::InvalidRegistryException& ) + { + OSL_ENSHURE(sal_False, "SBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); + } + + return sal_False; +} + +//--------------------------------------------------------------------------------------- +extern "C" void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, + void* pServiceManager, + void* pRegistryKey) +{ + void* pRet = 0; + if (pServiceManager) + { + ProviderRequest aReq(pServiceManager,pImplementationName); + + aReq.CREATE_PROVIDER( + java_sql_Driver::getImplementationName_Static(), + java_sql_Driver::getSupportedServiceNames_Static(), + java_sql_Driver_CreateInstance, + ::cppu::createSingleFactory); + + if(aReq.xRet.is()) + aReq.xRet->acquire(); + pRet = aReq.getProvider(); + } + + return pRet; +}; + + + diff --git a/connectivity/source/drivers/jdbc/makefile.mk b/connectivity/source/drivers/jdbc/makefile.mk new file mode 100644 index 000000000000..00621c73d2ee --- /dev/null +++ b/connectivity/source/drivers/jdbc/makefile.mk @@ -0,0 +1,187 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. +PRJINC=..$/.. +PRJNAME=connectivity +TARGET=jdbc + +USE_DEFFILE=TRUE +NO_BSYMBOLIC=TRUE + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/version.mk + +# --- Types ------------------------------------- + + +UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb + +UNOUCROUT=$(OUT)$/inc +INCPRE+=$(UNOUCROUT) + +# --- Types ------------------------------------- + +UNOTYPES+= \ + com.sun.star.util.XCancellable \ + com.sun.star.util.XNumberFormatter \ + com.sun.star.uno.TypeClass \ + com.sun.star.uno.XWeak \ + com.sun.star.uno.XAggregation \ + com.sun.star.beans.XPropertyState \ + com.sun.star.beans.XPropertySet \ + com.sun.star.beans.PropertyValue \ + com.sun.star.beans.XMultiPropertySet \ + com.sun.star.beans.XFastPropertySet \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.lang.EventObject \ + com.sun.star.lang.XComponent \ + com.sun.star.lang.IllegalArgumentException \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.java.XJavaThreadRegister_11 \ + com.sun.star.java.XJavaVM \ + com.sun.star.sdbc.XConnection \ + com.sun.star.sdbc.XStatement \ + com.sun.star.sdbc.XResultSet \ + com.sun.star.sdbc.XResultSetMetaDataSupplier \ + com.sun.star.sdbc.XColumnLocate \ + com.sun.star.sdbc.XResultSetUpdate \ + com.sun.star.sdbc.XWarningsSupplier \ + com.sun.star.sdbc.XRowUpdate \ + com.sun.star.sdbc.XMultipleResults \ + com.sun.star.sdbc.XBatchExecution \ + com.sun.star.sdbc.XPreparedBatchExecution \ + com.sun.star.sdbc.XParameters \ + com.sun.star.sdbc.XOutParameters \ + com.sun.star.sdbc.DriverPropertyInfo \ + com.sun.star.sdbc.XRow \ + com.sun.star.sdb.XColumnUpdate \ + com.sun.star.sdb.XColumn + + + +# --- Files ------------------------------------- + +SLOFILES=\ + $(SLO)$/Array.obj \ + $(SLO)$/Blob.obj \ + $(SLO)$/Boolean.obj \ + $(SLO)$/CallableStatement.obj \ + $(SLO)$/Class.obj \ + $(SLO)$/Clob.obj \ + $(SLO)$/Connection.obj \ + $(SLO)$/DatabaseMetaData.obj \ + $(SLO)$/Date.obj \ + $(SLO)$/DriverManager.obj \ + $(SLO)$/DriverPropertyInfo.obj \ + $(SLO)$/Exception.obj \ + $(SLO)$/InputStream.obj \ + $(SLO)$/JDriver.obj \ + $(SLO)$/Object.obj \ + $(SLO)$/PreparedStatement.obj \ + $(SLO)$/Reader.obj \ + $(SLO)$/Ref.obj \ + $(SLO)$/ResultSet.obj \ + $(SLO)$/ResultSetMetaData.obj \ + $(SLO)$/SQLException.obj \ + $(SLO)$/SQLWarning.obj \ + $(SLO)$/Statement.obj \ + $(SLO)$/String.obj \ + $(SLO)$/Throwable.obj \ + $(SLO)$/Timestamp.obj \ + $(SLO)$/tools.obj \ + $(SLO)$/jservices.obj + +# --- Library ----------------------------------- + +SHL1TARGET= $(JDBC_TARGET)$(JDBC_MAJOR) +SHL1STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(OSLLIB) \ + $(SALLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(SHL1TARGET) +SHL1LIBS= $(SLB)$/$(TARGET).lib \ + $(SLB)$/commontools.lib \ + $(SLB)$/resource.lib + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + + diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx new file mode 100644 index 000000000000..c8e0f97c351c --- /dev/null +++ b/connectivity/source/drivers/jdbc/tools.cxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * $RCSfile: tools.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_STRING_HXX_ +#include "java/lang/String.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_CLASS_HXX_ +#include "java/lang/Class.hxx" +#endif + +#ifndef _COM_SUN_STAR_SDBC_DRIVERPROPERTYINFO_HPP_ +#include <com/sun/star/sdbc/DriverPropertyInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +// -------------------------------------------------------------------------------- +jstring connectivity::convertwchar_tToJavaString(JNIEnv *pEnv,const ::rtl::OUString& Temp) +{ + if (pEnv) + { + ::rtl::OString aT = ::rtl::OUStringToOString(Temp,RTL_TEXTENCODING_UTF8); + return pEnv->NewString((const unsigned short *)aT.getStr(), aT.getLength()); + } + return NULL; +} + +// -------------------------------------------------------------------------------- +jobjectArray connectivity::createStringPropertyArray(JNIEnv *pEnv,const Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(starsdbc::SQLException, RuntimeException) +{ + jobjectArray aArray = pEnv->NewObjectArray(info.getLength(),java_lang_String::getMyClass(),pEnv->NewStringUTF("")); + + const ::com::sun::star::beans::PropertyValue* pBegin = info.getConstArray(); + const ::com::sun::star::beans::PropertyValue* pEnd = pBegin + info.getLength(); + + sal_Bool bFound = sal_False; + for(jsize i=0;pBegin != pEnd;++pBegin) + { + if(!bFound || pBegin->Name.compareToAscii("JDBCDRV")) + { + java_sql_SQLException_BASE::getMyClass(); + java_lang_Throwable::getMyClass(); + + ::rtl::OUString aStr; + pBegin->Value >>= aStr; + //Datenbanktreiber wird ueber einen Klassennamen erzeugt + java_lang_Class *pDrvClass = java_lang_Class::forName(aStr); + bFound = sal_True; + } + else + { + ::rtl::OUString aStr; + pBegin->Value >>= aStr; + jstring a = convertwchar_tToJavaString(pEnv,aStr.getStr()); + pEnv->SetObjectArrayElement(aArray,i++,a); + } + } + return aArray; +} +// -------------------------------------------------------------------------------- +::rtl::OUString connectivity::JavaString2String(JNIEnv *pEnv,jstring _Str) +{ + ::rtl::OUString aStr; + if(_Str) + { + jboolean bCopy(sal_True); + const jchar* pChar = pEnv->GetStringChars(_Str,&bCopy); + jsize len = pEnv->GetStringLength(_Str); + aStr = ::rtl::OUString(pChar,RTL_TEXTENCODING_UTF8); + + if(bCopy) + pEnv->ReleaseStringChars(_Str,pChar); + pEnv->DeleteLocalRef(_Str); + } + return aStr; +} +// -------------------------------------------------------------------------------- +jobject connectivity::XNameAccess2Map(JNIEnv *pEnv,const Reference< ::com::sun::star::container::XNameAccess > & _rMap) +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq = _rMap->getElementNames(); + const ::rtl::OUString *pBegin = aSeq.getConstArray(); + const ::rtl::OUString *pEnd = pBegin + aSeq.getLength(); + for(;pBegin != pEnd;++pBegin) + { + } + return 0; +} + + |