Tag: cws_src680_dba24c
User: fs      
Date: 2007-10-15 13:32:39+0000
Modified:
   dba/connectivity/source/drivers/jdbc/JStatement.cxx

Log:
 #i82222# when executing statements, also put the DriverClassLoader of the 
connection in place as ContextClassLoader

File Changes:

Directory: /dba/connectivity/source/drivers/jdbc/
=================================================

File [changed]: JStatement.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/jdbc/JStatement.cxx?r1=1.3&r2=1.3.34.1
Delta lines:  +39 -29
---------------------
--- JStatement.cxx      2007-06-27 14:36:28+0000        1.3
+++ JStatement.cxx      2007-10-15 13:32:36+0000        1.3.34.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: JStatement.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.34.1 $
  *
- *  last change: $Author: hr $ $Date: 2007/06/27 14:36:28 $
+ *  last change: $Author: fs $ $Date: 2007/10/15 13:32:36 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -35,22 +35,14 @@
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_connectivity.hxx"
-#ifndef _CONNECTIVITY_JAVA_SQL_STATEMENT_HXX_
-#include "java/sql/JStatement.hxx"
-#endif
 
-#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_
+#include "java/sql/JStatement.hxx"
 #include "java/sql/ResultSet.hxx"
-#endif
-#ifndef _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_
 #include "java/sql/Connection.hxx"
-#endif
-#ifndef _CONNECTIVITY_JAVA_SQL_SQLWARNING_HXX_
 #include "java/sql/SQLWarning.hxx"
-#endif
-#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_
 #include "java/tools.hxx"
-#endif
+#include "java/ContextClassLoader.hxx"
+
 #ifndef _COMPHELPER_PROPERTY_HXX_
 #include <comphelper/property.hxx>
 #endif
@@ -332,11 +324,17 @@
                        mID  = t.pEnv->GetMethodID( getMyClass(), cMethodName, 
cSignature );OSL_ENSURE(mID,"Unknown method id!");
                if( mID ){
                        // Parameter konvertieren
-                       jstring str = convertwchar_tToJavaString(t.pEnv,sql);
-                       out = t.pEnv->CallBooleanMethod( object, mID, str );
-                       // und aufraeumen
-                       t.pEnv->DeleteLocalRef(str);
+            jdbc::LocalRef< jstring > str( t.env(), 
convertwchar_tToJavaString( t.pEnv, sql ) );
+            {
+                jdbc::ContextClassLoaderScope ccl( t.env(),
+                    m_pConnection ? m_pConnection->getDriverClassLoader() : 
jdbc::GlobalRef< jobject >(),
+                    m_aLogger,
+                    *this
+                );
+
+                           out = t.pEnv->CallBooleanMethod( object, mID, 
str.get() );
                        ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
+            }
                } //mID
        } //t.pEnv
        return out;
@@ -362,11 +360,17 @@
                        mID  = t.pEnv->GetMethodID( getMyClass(), cMethodName, 
cSignature );OSL_ENSURE(mID,"Unknown method id!");
                if( mID ){
                        // Parameter konvertieren
-                       jstring str = convertwchar_tToJavaString(t.pEnv,sql);
-                       out = t.pEnv->CallObjectMethod( object, mID, str);
-                       // und aufraeumen
-                       t.pEnv->DeleteLocalRef(str);
+            jdbc::LocalRef< jstring > str( t.env(), 
convertwchar_tToJavaString( t.pEnv, sql ) );
+            {
+                jdbc::ContextClassLoaderScope ccl( t.env(),
+                    m_pConnection ? m_pConnection->getDriverClassLoader() : 
jdbc::GlobalRef< jobject >(),
+                    m_aLogger,
+                    *this
+                );
+
+                       out = t.pEnv->CallObjectMethod( object, mID, str.get() 
);
                        ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
+            }
                } //mID
        } //t.pEnv
        // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten 
Zeigers !!!
@@ -459,11 +463,17 @@
                        mID  = t.pEnv->GetMethodID( getMyClass(), cMethodName, 
cSignature );OSL_ENSURE(mID,"Unknown method id!");
                if( mID ){
                        // Parameter konvertieren
-                       jstring str = convertwchar_tToJavaString(t.pEnv,sql);
-                       out = t.pEnv->CallIntMethod( object, mID, str );
-                       // und aufraeumen
-                       t.pEnv->DeleteLocalRef(str);
+            jdbc::LocalRef< jstring > str( t.env(), 
convertwchar_tToJavaString( t.pEnv, sql ) );
+            {
+                jdbc::ContextClassLoaderScope ccl( t.env(),
+                    m_pConnection ? m_pConnection->getDriverClassLoader() : 
jdbc::GlobalRef< jobject >(),
+                    m_aLogger,
+                    *this
+                );
+
+                       out = t.pEnv->CallIntMethod( object, mID, str.get() );
                        ThrowLoggedSQLException( m_aLogger, t.pEnv, *this );
+            }
                } //mID
        } //t.pEnv
        return (sal_Int32)out;




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to