summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/jdbc
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2000-10-24 15:34:43 +0000
committerOcke Janssen <oj@openoffice.org>2000-10-24 15:34:43 +0000
commit444c5cbdeb11577f265f256d616c921c20246e99 (patch)
tree8e057c49a4a2d97a98ea22481bd83f52f70a0a86 /connectivity/source/drivers/jdbc
parent7ca8b14889621c6ad5bf3f654bfa51476685ce7c (diff)
make strings unique for lib's
Diffstat (limited to 'connectivity/source/drivers/jdbc')
-rw-r--r--connectivity/source/drivers/jdbc/JDriver.cxx51
-rw-r--r--connectivity/source/drivers/jdbc/ResultSet.cxx17
2 files changed, 49 insertions, 19 deletions
diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx
index 80e1a7013623..424448e37956 100644
--- a/connectivity/source/drivers/jdbc/JDriver.cxx
+++ b/connectivity/source/drivers/jdbc/JDriver.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: JDriver.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $
+ * last change: $Author: oj $ $Date: 2000-10-24 16:31:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -163,10 +163,10 @@ void java_sql_Driver::saveClassRef( jclass pClass )
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< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUString& url, const
+ Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(SQLException, RuntimeException)
{
- Reference< starsdbc::XConnection > xRet;
+ Reference< XConnection > xRet;
object = java_sql_DriverManager::getDriver(url);
jobject out(0);
@@ -185,42 +185,59 @@ Reference< starsdbc::XConnection > SAL_CALL java_sql_Driver::connect( const ::rt
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
+ // und aufraeumen
+ t.pEnv->DeleteLocalRef((jstring)args[0].l);
+ t.pEnv->DeleteLocalRef((jstring)args[1].l);
+ ThrowSQLException(t.pEnv,*this);
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
- Reference< starsdbc::XConnection > xOut;
+ Reference< 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)
+sal_Bool SAL_CALL java_sql_Driver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException)
{
- if(!object)
+ try
+ {
+ if(object)
+ {
+ SDBThreadAttach t;
+ if( t.pEnv )
+ t.pEnv->DeleteGlobalRef( object );
+ object = NULL;
+ }
object = java_sql_DriverManager::getDriver(url);
+ }
+ catch(SQLException&)
+ {
+ return sal_False;
+ }
jboolean out(0);
SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelscht worden!");
if( t.pEnv )
{
if(!object)
- ThrowSQLException(t.pEnv,*this);
+ return sal_False;
+ jvalue args;
+ args.l = convertwchar_tToJavaString(t.pEnv,url);
// 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);
+ out = t.pEnv->CallBooleanMethod( object, mID,args);
+ // und aufraeumen
+ t.pEnv->DeleteLocalRef((jstring)args.l);
+ 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)
+Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(SQLException, RuntimeException)
{
if(!object)
object = java_sql_DriverManager::getDriver(url);
@@ -248,7 +265,7 @@ Sequence< starsdbc::DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyIn
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
- return copyArrayAndDelete( t.pEnv, out, starsdbc::DriverPropertyInfo(),java_sql_DriverPropertyInfo(NULL,NULL));
+ return copyArrayAndDelete( t.pEnv, out, DriverPropertyInfo(),java_sql_DriverPropertyInfo(NULL,NULL));
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL java_sql_Driver::getMajorVersion( ) throw(RuntimeException)
diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx
index b7c9bb886081..67f427b2e4bd 100644
--- a/connectivity/source/drivers/jdbc/ResultSet.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSet.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ResultSet.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: fs $ $Date: 2000-10-11 10:46:14 $
+ * last change: $Author: oj $ $Date: 2000-10-24 16:31:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -91,6 +91,7 @@
#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_
#include "java/tools.hxx"
#endif
+#define CONNECTIVITY_PROPERTY_NAME_SPACE jdbc
#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_
#include "propertyids.hxx"
#endif
@@ -110,6 +111,18 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
+// define the properties of this lib
+// this file includes the properties for this dll
+namespace connectivity
+{
+ namespace jdbc
+ {
+#ifndef CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX
+#include "UStringDescription_Impl.hxx"
+#endif
+ }
+}
+
using namespace connectivity;
using namespace ::com::sun::star::uno;