Tag: cws_src680_dba24d
User: oj      
Date: 2007-11-06 09:04:45+0000
Modified:
   dba/connectivity/source/drivers/jdbc/JConnection.cxx
   dba/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx
   dba/connectivity/source/drivers/jdbc/JDriver.cxx

Log:
 #i11746# new property to turn of currency from meta data

File Changes:

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

File [changed]: JConnection.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/jdbc/JConnection.cxx?r1=1.6&r2=1.6.18.1
Delta lines:  +24 -51
---------------------
--- JConnection.cxx     2007-09-26 14:29:37+0000        1.6
+++ JConnection.cxx     2007-11-06 09:04:43+0000        1.6.18.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: JConnection.cxx,v $
  *
- *  $Revision: 1.6 $
+ *  $Revision: 1.6.18.1 $
  *
- *  last change: $Author: hr $ $Date: 2007/09/26 14:29:37 $
+ *  last change: $Author: oj $ $Date: 2007/11/06 09:04:43 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -76,7 +76,7 @@
 #include "resource/jdbc_log.hrc"
 #include "com/sun/star/uno/XComponentContext.hpp"
 #include "jvmaccess/classpath.hxx"
-
+#include <comphelper/sequenceashashmap.hxx>
 #include <jni.h>
 
 #include <list>
@@ -210,6 +210,7 @@
     ,m_aLogger( _rDriver.getLogger() )
     ,m_bParameterSubstitution(sal_False)
     ,m_bIgnoreDriverPrivileges(sal_True)
+    ,m_bIgnoreCurrency(sal_False)
 {      
 }
 // 
-----------------------------------------------------------------------------
@@ -816,79 +817,41 @@
        return Any();
 }
 // 
-----------------------------------------------------------------------------
-void java_sql_Connection::loadDriverFromProperties(
-        const Sequence< PropertyValue >& info, ::rtl::OUString& 
_rsGeneratedValueStatement,
-               sal_Bool& _rbAutoRetrievingEnabled, sal_Bool& 
_bParameterSubstitution, sal_Bool& _bIgnoreDriverPrivileges )
+void java_sql_Connection::loadDriverFromProperties(const ::rtl::OUString& 
_sDriverClass,const ::rtl::OUString& _sDriverClassPath)
 {
        // first try if the jdbc driver is alraedy registered at the driver 
manager
     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
        try
        {
-        const PropertyValue* pJavaDriverClass = 0;
-        const PropertyValue* pJavaDriverClassPath = 0;
-               const PropertyValue* pBegin     = info.getConstArray();
-               const PropertyValue* pEnd       = pBegin + info.getLength();
-               for(;pBegin != pEnd;++pBegin)
-               {
-            if (!pBegin->Name.compareToAscii("JavaDriverClass"))
-            {
-                pJavaDriverClass = pBegin;
-            }
-            else if (!pBegin->Name.compareToAscii("JavaDriverClassPath"))
-            {
-                pJavaDriverClassPath = pBegin;
-            }
-                       else 
if(!pBegin->Name.compareToAscii("IsAutoRetrievingEnabled"))
-                       {
-                               OSL_VERIFY( pBegin->Value >>= 
_rbAutoRetrievingEnabled );
-                       }
-                       else 
if(!pBegin->Name.compareToAscii("AutoRetrievingStatement"))
-                       {
-                               OSL_VERIFY( pBegin->Value >>= 
_rsGeneratedValueStatement );
-                       }
-                       else 
if(!pBegin->Name.compareToAscii("ParameterNameSubstitution"))
-                       {
-                               OSL_VERIFY( pBegin->Value >>= 
_bParameterSubstitution );
-                       }
-                       else 
if(!pBegin->Name.compareToAscii("IgnoreDriverPrivileges"))
-                       {
-                               OSL_VERIFY( pBegin->Value >>= 
_bIgnoreDriverPrivileges );
-                       }
-               }
-        if ( !object && pJavaDriverClass != 0 )
+        if ( !object && _sDriverClass.getLength() )
         {
             // here I try to find the class for jdbc driver
             java_sql_SQLException_BASE::getMyClass();
             java_lang_Throwable::getMyClass();
 
-            ::rtl::OUString aStr;
-            OSL_VERIFY( pJavaDriverClass->Value >>= aStr );
-            OSL_ASSERT( aStr.getLength());
-            if ( !aStr.getLength() )
+            OSL_ASSERT( _sDriverClass.getLength());
+            if ( !_sDriverClass.getLength() )
             {
                 m_aLogger.log( LogLevel::SEVERE, STR_LOG_NO_DRIVER_CLASS );
             }
             else
             {
-                m_aLogger.log( LogLevel::INFO, STR_LOG_LOADING_DRIVER, aStr );
+                m_aLogger.log( LogLevel::INFO, STR_LOG_LOADING_DRIVER, 
_sDriverClass );
                 // the driver manager holds the class of the driver for later 
use
                 ::std::auto_ptr< java_lang_Class > pDrvClass;
-                if ( pJavaDriverClassPath == 0 )
+                if ( !_sDriverClassPath.getLength() )
                 {
                                        // if forName didn't find the class it 
will throw an exception
-                                       pDrvClass = ::std::auto_ptr< 
java_lang_Class >(java_lang_Class::forName(aStr));
+                                       pDrvClass = ::std::auto_ptr< 
java_lang_Class >(java_lang_Class::forName(_sDriverClass));
                 }
                 else
                 {
-                    ::rtl::OUString classpath;
-                    OSL_VERIFY( pJavaDriverClassPath->Value >>= classpath );
-                    
                     pDrvClass.reset(
                         new java_lang_Class(
                             t.pEnv,
                             loadClass(
                                 m_pDriver->getContext().getUNOContext(),
-                                t.pEnv, classpath, aStr
+                                t.pEnv, _sDriverClassPath, _sDriverClass
                             )
                         )
                     );
@@ -938,7 +901,17 @@
 
        ::rtl::OUString         sGeneratedValueStatement; // contains the 
statement which should be used when query for automatically generated values
        sal_Bool                        bAutoRetrievingEnabled = sal_False; // 
set to <TRUE/> when we should allow to query for generated values
-       
loadDriverFromProperties(info,sGeneratedValueStatement,bAutoRetrievingEnabled,m_bParameterSubstitution,m_bIgnoreDriverPrivileges);
+    ::comphelper::SequenceAsHashMap aMap(info);
+    ::rtl::OUString sDriverClassPath,sDriverClass;
+    sDriverClass = 
aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass")),sDriverClass);
+    sDriverClassPath = 
aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClassPath")),sDriverClassPath);
+    bAutoRetrievingEnabled = 
aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsAutoRetrievingEnabled")),bAutoRetrievingEnabled);
+    sGeneratedValueStatement = 
aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutoRetrievingStatement")),sGeneratedValueStatement);
+    m_bParameterSubstitution = 
aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParameterNameSubstitution")),m_bParameterSubstitution);
+    m_bIgnoreDriverPrivileges = 
aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreDriverPrivileges")),m_bIgnoreDriverPrivileges);
+    m_bIgnoreCurrency = 
aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreCurrency")),m_bIgnoreCurrency);
+
+       loadDriverFromProperties(sDriverClass,sDriverClassPath);
 
        enableAutoRetrievingEnabled(bAutoRetrievingEnabled);
        setAutoRetrievingStatement(sGeneratedValueStatement);

File [changed]: ResultSetMetaData.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx?r1=1.11&r2=1.11.54.1
Delta lines:  +8 -4
-------------------
--- ResultSetMetaData.cxx       2007-06-27 14:37:27+0000        1.11
+++ ResultSetMetaData.cxx       2007-11-06 09:04:43+0000        1.11.54.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: ResultSetMetaData.cxx,v $
  *
- *  $Revision: 1.11 $
+ *  $Revision: 1.11.54.1 $
  *
- *  last change: $Author: hr $ $Date: 2007/06/27 14:37:27 $
+ *  last change: $Author: oj $ $Date: 2007/11/06 09:04:43 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -39,6 +39,7 @@
 #ifndef _CONNECTIVITY_JAVA_SQL_RESULTSETMETADATA_HXX_
 #include "java/sql/ResultSetMetaData.hxx"
 #endif
+#include "java/sql/Connection.hxx"
 #ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_
 #include "java/tools.hxx"
 #endif
@@ -54,9 +55,10 @@
 //**************************************************************
 
 jclass java_sql_ResultSetMetaData::theClass = 0;
-java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject 
myObj, const java::sql::ConnectionLog& _rResultSetLogger )
+java_sql_ResultSetMetaData::java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject 
myObj, const java::sql::ConnectionLog& _rResultSetLogger, java_sql_Connection& 
_rCon  )
     :java_lang_Object( pEnv, myObj )
     ,m_aLogger( _rResultSetLogger )
+    ,m_pConnection( &_rCon )
 {
        SDBThreadAttach::addRef();
 }
@@ -347,6 +349,8 @@
 
 sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) 
throw(SQLException, RuntimeException)
 {
+    if ( m_pConnection->isIgnoreCurrencyEnabled() )
+        return sal_False;
        jboolean out(sal_False);
     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
        if( t.pEnv ){

File [changed]: JDriver.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/jdbc/JDriver.cxx?r1=1.38&r2=1.38.54.1
Delta lines:  +10 -3
--------------------
--- JDriver.cxx 2007-06-27 14:36:14+0000        1.38
+++ JDriver.cxx 2007-11-06 09:04:43+0000        1.38.54.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: JDriver.cxx,v $
  *
- *  $Revision: 1.38 $
+ *  $Revision: 1.38.54.1 $
  *
- *  last change: $Author: hr $ $Date: 2007/06/27 14:36:14 $
+ *  last change: $Author: oj $ $Date: 2007/11/06 09:04:43 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -214,6 +214,13 @@
                                ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"true" ) )
                                ,aBooleanValues)
                                );
+        aDriverInfo.push_back(DriverPropertyInfo(
+                               
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreCurrency"))
+                               
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Ignore the currency field from 
the ResultsetMetaData."))
+                               ,sal_False
+                               ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"false" ) )
+                               ,aBooleanValues)
+                               );
                return Sequence< DriverPropertyInfo 
>(&aDriverInfo[0],aDriverInfo.size());
        }
        
::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid
 URL!")) ,*this);




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

Reply via email to