Tag: cws_src680_sb36
User: sb      
Date: 05/07/14 05:32:12

Modified:
 /dba/connectivity/source/drivers/hsqldb/
  HDriver.cxx
 /dba/connectivity/source/drivers/jdbc/
  Connection.cxx, tools.cxx

Log:
 #i51803# Added JavaDriverClassPath.

File Changes:

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

File [changed]: HDriver.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/hsqldb/HDriver.cxx?r1=1.12&r2=1.12.8.1
Delta lines:  +6 -4
-------------------
--- HDriver.cxx 27 Jun 2005 08:24:37 -0000      1.12
+++ HDriver.cxx 14 Jul 2005 12:32:08 -0000      1.12.8.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: HDriver.cxx,v $
  *
- *  $Revision: 1.12 $
+ *  $Revision: 1.12.8.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/06/27 08:24:37 $
+ *  last change: $Author: sb $ $Date: 2005/07/14 12:32:08 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -245,7 +245,7 @@
 
                 bool bIsNewDatabase = !xStorage->hasElements();
 
-                               Sequence< PropertyValue > 
aConvertedProperties(9);
+                               Sequence< PropertyValue > 
aConvertedProperties(10);
                                sal_Int32 nPos = 0;
                                aConvertedProperties[nPos].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("storage_key"));
                 ::rtl::OUString sConnPartURL = sSystemPath.copy(0,nIndex);
@@ -257,6 +257,8 @@
                                aConvertedProperties[nPos++].Value <<= 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.comp.hsqldb.StorageFileAccess"));
                                aConvertedProperties[nPos].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass"));
                                aConvertedProperties[nPos++].Value <<= 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.hsqldb.jdbcDriver"));
+                               aConvertedProperties[nPos].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClassPath"));
+                               aConvertedProperties[nPos++].Value <<= 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$ORIGIN/classes/hsqldb.jar
 vnd.sun.star.expand:$ORIGIN/classes/sdbc_hsqldb.jar"));
                                aConvertedProperties[nPos].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsAutoRetrievingEnabled"));
                                aConvertedProperties[nPos++].Value <<= sal_True;
                                aConvertedProperties[nPos].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoRetrievingStatement"));

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

File [changed]: Connection.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/jdbc/Connection.cxx?r1=1.22&r2=1.22.60.1
Delta lines:  +69 -34
---------------------
--- Connection.cxx      16 Feb 2005 17:27:51 -0000      1.22
+++ Connection.cxx      14 Jul 2005 12:32:08 -0000      1.22.60.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: Connection.cxx,v $
  *
- *  $Revision: 1.22 $
+ *  $Revision: 1.22.60.1 $
  *
- *  last change: $Author: vg $ $Date: 2005/02/16 17:27:51 $
+ *  last change: $Author: sb $ $Date: 2005/07/14 12:32:08 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -93,6 +93,8 @@
 #include "connectivity/dbexception.hxx"
 #endif
 #include "java/util/Property.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "jvmaccess/classpath.hxx"
 #include <memory>
 
 using namespace connectivity;
@@ -735,22 +737,72 @@
        {
                const PropertyValue* pBegin     = info.getConstArray();
                const PropertyValue* pEnd       = pBegin + info.getLength();
+        const PropertyValue* pJavaDriverClass = 0;
+        const PropertyValue* pJavaDriverClassPath = 0;
                for(jsize i=0;pBegin != pEnd;++pBegin)
                {
-                       if ( !object && 
!pBegin->Name.compareToAscii("JavaDriverClass") )
+            if (!pBegin->Name.compareToAscii("JavaDriverClass"))
+            {
+                pJavaDriverClass = pBegin;
+            }
+            else if (!pBegin->Name.compareToAscii("JavaDriverClassPath"))
+            {
+                pJavaDriverClassPath = pBegin;
+            }
+                       else 
if(!pBegin->Name.compareToAscii("IsAutoRetrievingEnabled"))
+                       {
+                               pBegin->Value >>= _rbAutoRetrievingEnabled;
+                       }
+                       else 
if(!pBegin->Name.compareToAscii("AutoRetrievingStatement"))
+                       {
+                               pBegin->Value >>= _rsGeneratedValueStatement;
+                       }
+                       else 
if(!pBegin->Name.compareToAscii("ParameterNameSubstitution"))
+                       {
+                               pBegin->Value >>= _bParameterSubstitution;
+                       }
+                       else 
if(!pBegin->Name.compareToAscii("IgnoreDriverPrivileges"))
+                       {
+                               pBegin->Value >>= _bIgnoreDriverPrivileges;
+                       }
+               }
+        if ( !object && pJavaDriverClass != 0 )
                        {
                                // here I try to find the class for jdbc driver
                                java_sql_SQLException_BASE::getMyClass();
                                java_lang_Throwable::getMyClass();
 
                                ::rtl::OUString aStr;
-                               pBegin->Value >>= aStr;
+            pJavaDriverClass->Value >>= aStr;
                                OSL_ASSERT( aStr.getLength());
                                if ( aStr.getLength() )
                                {
                                        // the driver manager holds the class 
of the driver for later use
+                ::std::auto_ptr< java_lang_Class > pDrvClass;
+                if ( pJavaDriverClassPath == 0 )
+                {
                                        // if forName didn't find the class it 
will throw an exception
-                                       ::std::auto_ptr< java_lang_Class > 
pDrvClass = ::std::auto_ptr< java_lang_Class >(java_lang_Class::forName(aStr));
+                    pDrvClass = ::std::auto_ptr< java_lang_Class 
>(java_lang_Class::forName(aStr));
+                }
+                else
+                {
+                    ::rtl::OUString classpath;
+                    pJavaDriverClassPath->Value >>= classpath;
+                    pDrvClass.reset(
+                        new java_lang_Class(
+                            t.pEnv,
+                            jvmaccess::ClassPath::loadClass(
+                                Reference< XComponentContext >(
+                                    Reference< XPropertySet >(
+                                        m_pDriver->getORB(),
+                                        UNO_QUERY_THROW)->getPropertyValue(
+                                            ::rtl::OUString(
+                                                RTL_CONSTASCII_USTRINGPARAM(
+                                                    "DefaultContext"))),
+                                    UNO_QUERY_THROW),
+                                t.pEnv, classpath, aStr)));
+                    ThrowSQLException(t.pEnv, *this);
+                }
                                        if ( pDrvClass.get() )
                                        {
                                                m_pDriverobject = 
pDrvClass->newInstanceObject();
@@ -768,23 +820,6 @@
                                        }
                                }
                        }
-                       else 
if(!pBegin->Name.compareToAscii("IsAutoRetrievingEnabled"))
-                       {
-                               pBegin->Value >>= _rbAutoRetrievingEnabled;
-                       }
-                       else 
if(!pBegin->Name.compareToAscii("AutoRetrievingStatement"))
-                       {
-                               pBegin->Value >>= _rsGeneratedValueStatement;
-                       }
-                       else 
if(!pBegin->Name.compareToAscii("ParameterNameSubstitution"))
-                       {
-                               pBegin->Value >>= _bParameterSubstitution;
-                       }
-                       else 
if(!pBegin->Name.compareToAscii("IgnoreDriverPrivileges"))
-                       {
-                               pBegin->Value >>= _bIgnoreDriverPrivileges;
-                       }
-               }
        }
        catch(SQLException& e)
        {

File [changed]: tools.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/jdbc/tools.cxx?r1=1.19&r2=1.19.60.1
Delta lines:  +4 -3
-------------------
--- tools.cxx   16 Feb 2005 17:30:42 -0000      1.19
+++ tools.cxx   14 Jul 2005 12:32:09 -0000      1.19.60.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: tools.cxx,v $
  *
- *  $Revision: 1.19 $
+ *  $Revision: 1.19.60.1 $
  *
- *  last change: $Author: vg $ $Date: 2005/02/16 17:30:42 $
+ *  last change: $Author: sb $ $Date: 2005/07/14 12:32:09 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -183,6 +183,7 @@
        {
                // this is a special property to find the jdbc driver
                if( pBegin->Name.compareToAscii("JavaDriverClass") &&
+            pBegin->Name.compareToAscii("JavaDriverClassPath") &&
                        pBegin->Name.compareToAscii("CharSet") &&
                        pBegin->Name.compareToAscii("AppendTableAlias") &&
                        
pBegin->Name.compareToAscii("ParameterNameSubstitution") &&




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

Reply via email to