diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-10-01 12:28:29 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-10-01 12:28:29 +0000 |
commit | bc416a9f5635e0dcb3558a997ebf0298c3c37486 (patch) | |
tree | ef6424519b8c2ef24406d62b0edca6d9a572115a /connectivity/source/drivers/jdbc | |
parent | bbc5db1ac660640e72a7effbf70bace623c8d6c4 (diff) |
CWS-TOOLING: integrate CWS dba31b
Diffstat (limited to 'connectivity/source/drivers/jdbc')
-rw-r--r-- | connectivity/source/drivers/jdbc/JConnection.cxx | 40 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/JDriver.cxx | 9 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/PreparedStatement.cxx | 13 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/ResultSet.cxx | 15 |
4 files changed, 46 insertions, 31 deletions
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx index fc7f0eaa9b58..5ff81d3940cb 100644 --- a/connectivity/source/drivers/jdbc/JConnection.cxx +++ b/connectivity/source/drivers/jdbc/JConnection.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: JConnection.cxx,v $ - * $Revision: 1.13 $ + * $Revision: 1.13.56.2 $ * * This file is part of OpenOffice.org. * @@ -55,6 +55,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <rtl/ustrbuf.hxx> #include <jni.h> +#include "resource/common_res.hrc" #include <list> #include <memory> @@ -875,21 +876,21 @@ Any SAL_CALL java_sql_Connection::getWarnings( ) throw(SQLException, RuntimeExc // ----------------------------------------------------------------------------- namespace { - ::rtl::OUString lcl_getDriverLoadErrorMessage( const ::rtl::OUString& _rDriverClass, const ::rtl::OUString& _rDriverClassPath ) + ::rtl::OUString lcl_getDriverLoadErrorMessage( const ::connectivity::SharedResources& _aResource,const ::rtl::OUString& _rDriverClass, const ::rtl::OUString& _rDriverClassPath ) { - ::rtl::OUStringBuffer aMessageBuf; - // TODO: resource - aMessageBuf.appendAscii( "The driver class '" ); - aMessageBuf.append( _rDriverClass ); - aMessageBuf.appendAscii( "' could not be loaded" ); + ::rtl::OUString sError1( _aResource.getResourceStringWithSubstitution( + STR_NO_CLASSNAME, + "$class$", _rDriverClass + ) ); if ( _rDriverClassPath.getLength() ) { - aMessageBuf.appendAscii( " (additional driver class path: " ); - aMessageBuf.append( _rDriverClassPath ); - aMessageBuf.appendAscii( ")" ); - } - aMessageBuf.appendAscii( "." ); - return aMessageBuf.makeStringAndClear(); + const ::rtl::OUString sError2( _aResource.getResourceStringWithSubstitution( + STR_NO_CLASSNAME_PATH, + "$classpath$", _rDriverClassPath + ) ); + sError1 += sError2; + } // if ( _rDriverClassPath.getLength() ) + return sError1; } } @@ -966,7 +967,10 @@ void java_sql_Connection::loadDriverFromProperties( const ::rtl::OUString& _sDri if ( !_sDriverClass.getLength() ) { m_aLogger.log( LogLevel::SEVERE, STR_LOG_NO_DRIVER_CLASS ); - throw SQLException(::rtl::OUString::createFromAscii("The specified driver was empty!"),*this,::rtl::OUString(),1000,Any()); + ::dbtools::throwGenericSQLException( + lcl_getDriverLoadErrorMessage( getResources(),_sDriverClass, _sDriverClassPath ), + *this + ); } else { @@ -1018,7 +1022,7 @@ void java_sql_Connection::loadDriverFromProperties( const ::rtl::OUString& _sDri catch( const SQLException& e ) { throw SQLException( - lcl_getDriverLoadErrorMessage( _sDriverClass, _sDriverClassPath ), + lcl_getDriverLoadErrorMessage( getResources(),_sDriverClass, _sDriverClassPath ), *this, ::rtl::OUString(), 1000, @@ -1028,7 +1032,7 @@ void java_sql_Connection::loadDriverFromProperties( const ::rtl::OUString& _sDri catch( Exception& ) { ::dbtools::throwGenericSQLException( - lcl_getDriverLoadErrorMessage( _sDriverClass, _sDriverClassPath ), + lcl_getDriverLoadErrorMessage( getResources(),_sDriverClass, _sDriverClassPath ), *this ); } @@ -1044,12 +1048,12 @@ sal_Bool java_sql_Connection::construct(const ::rtl::OUString& url, { // initialize the java vm ::rtl::Reference< jvmaccess::VirtualMachine > xTest = java_lang_Object::getVM(getORB()); if ( !xTest.is() ) - throw SQLException(::rtl::OUString::createFromAscii("No Java installation could be found. Please check your installation!"),*this,::rtl::OUString::createFromAscii("S1000"),1000 ,Any()); + throwGenericSQLException(STR_NO_JAVA,*this); } SDBThreadAttach t; t.addRef(); // will be released in dtor if ( !t.pEnv ) - throw SQLException(::rtl::OUString::createFromAscii("No Java installation could be found. Please check your installation!"),*this,::rtl::OUString::createFromAscii("S1000"),1000 ,Any()); + throwGenericSQLException(STR_NO_JAVA,*this); ::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 diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx index e81e0b57c5c5..b184d7837c7a 100644 --- a/connectivity/source/drivers/jdbc/JDriver.cxx +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: JDriver.cxx,v $ - * $Revision: 1.43 $ + * $Revision: 1.43.56.1 $ * * This file is part of OpenOffice.org. * @@ -42,7 +42,8 @@ #include <jvmfwk/framework.h> #include "diagnose_ex.h" #include "resource/jdbc_log.hrc" - +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" #include <comphelper/componentcontext.hxx> using namespace connectivity; @@ -232,7 +233,9 @@ Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const ); return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size()); } - ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL!")) ,*this); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); + ::dbtools::throwGenericSQLException(sMessage ,*this); return Sequence< DriverPropertyInfo >(); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx index 5c87d9d10fb5..459cd4afb80d 100644 --- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx +++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: PreparedStatement.cxx,v $ - * $Revision: 1.24 $ + * $Revision: 1.24.56.1 $ * * This file is part of OpenOffice.org. * @@ -42,6 +42,8 @@ #include "connectivity/dbtools.hxx" #include "connectivity/dbexception.hxx" #include "resource/jdbc_log.hrc" +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" #include <string.h> @@ -572,10 +574,11 @@ void SAL_CALL java_sql_PreparedStatement::setObject( sal_Int32 parameterIndex, c { if(!::dbtools::implSetObject(this,parameterIndex,x)) { - ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Unknown type for parameter: "); - sMsg += ::rtl::OUString::valueOf(parameterIndex); - sMsg += ::rtl::OUString::createFromAscii(" !") ; - ::dbtools::throwGenericSQLException(sMsg,*this); + const ::rtl::OUString sError( m_pConnection->getResources().getResourceStringWithSubstitution( + STR_UNKNOWN_PARA_TYPE, + "$position$", ::rtl::OUString::valueOf(parameterIndex) + ) ); + ::dbtools::throwGenericSQLException(sError,*this); } } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index 4f1bc7514908..2fb36e3eea58 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ResultSet.cxx,v $ - * $Revision: 1.36 $ + * $Revision: 1.36.22.1 $ * * This file is part of OpenOffice.org. * @@ -51,6 +51,9 @@ #include <comphelper/types.hxx> #include "connectivity/dbtools.hxx" #include "connectivity/dbexception.hxx" +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" + #include <string.h> @@ -1530,10 +1533,12 @@ void SAL_CALL java_sql_ResultSet::updateObject( sal_Int32 columnIndex, const ::c { if(!::dbtools::implUpdateObject(this,columnIndex,x)) { - ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Unknown type for column: "); - sMsg += ::rtl::OUString::valueOf(columnIndex); - sMsg += ::rtl::OUString::createFromAscii(" !") ; - ::dbtools::throwGenericSQLException(sMsg,*this); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_UNKNOWN_COLUMN_TYPE, + "$position$", ::rtl::OUString::valueOf(columnIndex) + ) ); + ::dbtools::throwGenericSQLException(sError,*this); } } // ------------------------------------------------------------------------- |