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 | 0e779477f3218d8b1325eb3e62470f7380c2546c (patch) | |
tree | 49f07432f8f482fcc5bc659fdddd8101f15d0a1d | |
parent | 71faa9e9fd955a238d3060a7f9b64818091a8573 (diff) |
CWS-TOOLING: integrate CWS dba31b
100 files changed, 1786 insertions, 1068 deletions
diff --git a/connectivity/source/commontools/CommonTools.cxx b/connectivity/source/commontools/CommonTools.cxx index aa7ecb7eb8..63d8594cdd 100644 --- a/connectivity/source/commontools/CommonTools.cxx +++ b/connectivity/source/commontools/CommonTools.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: CommonTools.cxx,v $ - * $Revision: 1.26 $ + * $Revision: 1.26.56.1 $ * * This file is part of OpenOffice.org. * @@ -223,9 +223,6 @@ namespace connectivity break; default: ; -// throw( CannotConvertException( ::rtl::OUString::createFromAscii("TYPE is not supported!"), Reference< XInterface > (), -// aDestinationClass, FailReason::TYPE_NOT_SUPPORTED, 0 ) ); - } return aRes; } diff --git a/connectivity/source/commontools/TConnection.cxx b/connectivity/source/commontools/TConnection.cxx index 247797d890..36b5c8a315 100644 --- a/connectivity/source/commontools/TConnection.cxx +++ b/connectivity/source/commontools/TConnection.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: TConnection.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.56.1 $ * * This file is part of OpenOffice.org. * @@ -33,14 +33,23 @@ #include "TConnection.hxx" #include <cppuhelper/typeprovider.hxx> #include <comphelper/types.hxx> +#include <comphelper/officeresourcebundle.hxx> +#include <connectivity/dbexception.hxx> using namespace connectivity; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::sdbc; -using namespace::osl; +using namespace com::sun::star::beans; +using namespace ::osl; //------------------------------------------------------------------------------ +OMetaConnection::OMetaConnection() + : OMetaConnection_BASE(m_aMutex) + , m_nTextEncoding(RTL_TEXTENCODING_MS_1252) +{ +} +//------------------------------------------------------------------------------ void OMetaConnection::disposing() { ::osl::MutexGuard aGuard(m_aMutex); @@ -87,4 +96,14 @@ Sequence< sal_Int8 > OMetaConnection::getUnoTunnelImplementationId() return s_aPropertyNameMap; } // ----------------------------------------------------------------------------- +void OMetaConnection::throwGenericSQLException( sal_uInt16 _nErrorResourceId,const Reference< XInterface>& _xContext ) +{ + ::rtl::OUString sErrorMessage; + if ( _nErrorResourceId ) + sErrorMessage = m_aResources.getResourceString( _nErrorResourceId ); + Reference< XInterface> xContext = _xContext; + if ( !xContext.is() ) + xContext = *this; + ::dbtools::throwGenericSQLException( sErrorMessage, xContext); +} diff --git a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx index c268b81faa..c5943e9da4 100644 --- a/connectivity/source/commontools/TDatabaseMetaDataBase.cxx +++ b/connectivity/source/commontools/TDatabaseMetaDataBase.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: TDatabaseMetaDataBase.cxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.56.1 $ * * This file is part of OpenOffice.org. * @@ -36,6 +36,9 @@ #include <comphelper/sequenceashashmap.hxx> #include <comphelper/evtlistenerhlp.hxx> #include <com/sun/star/lang/XComponent.hpp> +#include "resource/sharedresources.hxx" +#include "resource/common_res.hrc" +#include <connectivity/dbexception.hxx> using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -136,7 +139,9 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaDataBase::getTypeInfo( ) throw(SQ } catch(ParseError&) { - throw SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid Formula for TypeInfoSettings!")),*this,::rtl::OUString(),1000,Any()); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_FORMULA_WRONG)); + ::dbtools::throwGenericSQLException(sError,*this); } } diff --git a/connectivity/source/commontools/TIndexes.cxx b/connectivity/source/commontools/TIndexes.cxx index 42cbc3e9b6..e53d62bd1c 100644 --- a/connectivity/source/commontools/TIndexes.cxx +++ b/connectivity/source/commontools/TIndexes.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: TIndexes.cxx,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.56.1 $ * * This file is part of OpenOffice.org. * @@ -64,6 +64,10 @@ OIndexesHelper::OIndexesHelper(OTableHelper* _pTable, sdbcx::ObjectType OIndexesHelper::createObject(const ::rtl::OUString& _rName) { + Reference< XConnection> xConnection = m_pTable->getConnection(); + if ( !xConnection.is() ) + return NULL; + sdbcx::ObjectType xRet; ::rtl::OUString aName,aQualifier; sal_Int32 nLen = _rName.indexOf('.'); @@ -133,6 +137,9 @@ Reference< XPropertySet > OIndexesHelper::createDescriptor() // XAppend sdbcx::ObjectType OIndexesHelper::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { + Reference< XConnection> xConnection = m_pTable->getConnection(); + if ( !xConnection.is() ) + return NULL; if ( m_pTable->isNew() ) return cloneDescriptor( descriptor ); @@ -211,7 +218,8 @@ sdbcx::ObjectType OIndexesHelper::appendObject( const ::rtl::OUString& _rForName // XDrop void OIndexesHelper::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) { - if(!m_pTable->isNew()) + Reference< XConnection> xConnection = m_pTable->getConnection(); + if( xConnection.is() && !m_pTable->isNew()) { ::rtl::OUString aName,aSchema; sal_Int32 nLen = _sElementName.indexOf('.'); diff --git a/connectivity/source/commontools/TKeys.cxx b/connectivity/source/commontools/TKeys.cxx index 32ac2c4ab1..1875c3e283 100644 --- a/connectivity/source/commontools/TKeys.cxx +++ b/connectivity/source/commontools/TKeys.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: TKeys.cxx,v $ - * $Revision: 1.13 $ + * $Revision: 1.13.30.1 $ * * This file is part of OpenOffice.org. * @@ -140,6 +140,9 @@ void OKeysHelper::cloneDescriptorColumns( const sdbcx::ObjectType& _rSourceDescr // XAppend sdbcx::ObjectType OKeysHelper::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { + Reference< XConnection> xConnection = m_pTable->getConnection(); + if ( !xConnection.is() ) + return NULL; if ( m_pTable->isNew() ) { Reference< XPropertySet > xNewDescriptor( cloneDescriptor( descriptor ) ); @@ -263,7 +266,8 @@ sdbcx::ObjectType OKeysHelper::appendObject( const ::rtl::OUString& _rForName, c // XDrop void OKeysHelper::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) { - if ( !m_pTable->isNew() ) + Reference< XConnection> xConnection = m_pTable->getConnection(); + if ( xConnection.is() && !m_pTable->isNew() ) { ::rtl::OUString aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER TABLE ")); diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx index 34eb3240ef..abf83ac7c9 100644 --- a/connectivity/source/commontools/dbexception.cxx +++ b/connectivity/source/commontools/dbexception.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dbexception.cxx,v $ - * $Revision: 1.23 $ + * $Revision: 1.23.56.1 $ * * This file is part of OpenOffice.org. * @@ -38,6 +38,8 @@ #include <com/sun/star/sdbc/SQLWarning.hpp> #include <com/sun/star/sdb/SQLErrorEvent.hpp> #include "TConnection.hxx" +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" //......................................................................... namespace dbtools @@ -395,8 +397,9 @@ void SQLExceptionIteratorHelper::next( SQLExceptionInfo& _out_rInfo ) //------------------------------------------------------------ void throwFunctionSequenceException(const Reference< XInterface >& _Context, const Any& _Next) throw ( ::com::sun::star::sdbc::SQLException ) { + ::connectivity::SharedResources aResources; throw SQLException( - OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_ERRORMSG_SEQUENCE ), + aResources.getResourceString(STR_ERRORMSG_SEQUENCE), _Context, getStandardSQLState( SQL_FUNCTION_SEQUENCE_ERROR ), 0, @@ -407,8 +410,9 @@ void throwFunctionSequenceException(const Reference< XInterface >& _Context, con void throwInvalidIndexException(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context, const ::com::sun::star::uno::Any& _Next) throw ( ::com::sun::star::sdbc::SQLException ) { + ::connectivity::SharedResources aResources; throw SQLException( - OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_INVALID_INDEX), + aResources.getResourceString(STR_INVALID_INDEX), _Context, getStandardSQLState( SQL_INVALID_DESCRIPTOR_INDEX ), 0, @@ -432,11 +436,13 @@ void throwFunctionNotSupportedException(const ::rtl::OUString& _rMsg, void throwFunctionNotSupportedException( const sal_Char* _pAsciiFunctionName, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext, const ::com::sun::star::uno::Any* _pNextException ) throw ( ::com::sun::star::sdbc::SQLException ) { - ::rtl::OUString sMessage = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The driver does not support this function: " ) ); - // TODO: resource - sMessage += ::rtl::OUString::createFromAscii( _pAsciiFunctionName ); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_UNSUPPORTED_FUNCTION, + "$functionname$", ::rtl::OUString::createFromAscii( _pAsciiFunctionName ) + ) ); throw SQLException( - sMessage, + sError, _rxContext, getStandardSQLState( SQL_FUNCTION_NOT_SUPPORTED ), 0, @@ -461,9 +467,14 @@ void throwGenericSQLException(const ::rtl::OUString& _rMsg, const Reference< XIn void throwFeatureNotImplementedException( const sal_Char* _pAsciiFeatureName, const Reference< XInterface >& _rxContext, const Any* _pNextException ) throw (SQLException) { - ::rtl::OUString sMessage = ::rtl::OUString::createFromAscii( _pAsciiFeatureName ) + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": feature not implemented." ) ); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_UNSUPPORTED_FEATURE, + "$featurename$", ::rtl::OUString::createFromAscii( _pAsciiFeatureName ) + ) ); + throw SQLException( - sMessage, + sError, _rxContext, getStandardSQLState( SQL_FEATURE_NOT_IMPLEMENTED ), 0, diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx index 71485af859..bc57ed806f 100644 --- a/connectivity/source/commontools/dbmetadata.cxx +++ b/connectivity/source/commontools/dbmetadata.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dbmetadata.cxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.22.1 $ * * This file is part of OpenOffice.org. * @@ -33,6 +33,8 @@ #include <connectivity/dbmetadata.hxx> #include <connectivity/dbexception.hxx> +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" /** === begin UNO includes === **/ #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -104,7 +106,11 @@ namespace dbtools static void lcl_checkConnected( const DatabaseMetaData_Impl& _metaDataImpl ) { if ( !_metaDataImpl.xConnection.is() || !_metaDataImpl.xConnectionMetaData.is() ) - throwSQLException( "not connected", SQL_CONNECTION_DOES_NOT_EXIST, NULL ); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_NO_CONNECTION_GIVEN)); + throwSQLException( sError, SQL_CONNECTION_DOES_NOT_EXIST, NULL ); + } } //................................................................ diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 08725d9fc9..abc853793b 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dbtools.cxx,v $ - * $Revision: 1.74 $ + * $Revision: 1.74.46.1 $ * * This file is part of OpenOffice.org. * @@ -87,6 +87,9 @@ #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" + #include <algorithm> using namespace ::comphelper; @@ -1893,9 +1896,12 @@ void setObjectWithInfo(const Reference<XParameters>& _xParams, break; default: { - ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("Unknown SQL Type for PreparedStatement.setObjectWithInfo (SQL Type="); - aVal += ::rtl::OUString::valueOf(sqlType); - throw SQLException( aVal,_xParams,::rtl::OUString(),0,Any()); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_UNKNOWN_PARA_TYPE, + "$position$", ::rtl::OUString::valueOf(parameterIndex) + ) ); + ::dbtools::throwGenericSQLException(sError,NULL); } } } diff --git a/connectivity/source/commontools/propertyids.cxx b/connectivity/source/commontools/propertyids.cxx index d0ab33179d..0ca98181cc 100644 --- a/connectivity/source/commontools/propertyids.cxx +++ b/connectivity/source/commontools/propertyids.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: propertyids.cxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.56.1 $ * * This file is part of OpenOffice.org. * @@ -72,8 +72,6 @@ namespace dbtools const sal_Char* getPROPERTY_PASSWORD() { return "Password"; } const sal_Char* getPROPERTY_RELATEDCOLUMN() { return "RelatedColumn"; } - const sal_Char* getSTAT_INVALID_INDEX() { return "Invalid descriptor index"; } - const sal_Char* getPROPERTY_FUNCTION() { return "Function"; } const sal_Char* getPROPERTY_AGGREGATEFUNCTION() { return "AggregateFunction"; } const sal_Char* getPROPERTY_TABLENAME() { return "TableName"; } @@ -102,7 +100,6 @@ namespace dbtools //============================================================ //= error messages //============================================================ - const sal_Char* getERRORMSG_SEQUENCE() { return "Function sequence error"; } const sal_Char* getSQLSTATE_SEQUENCE() { return "HY010"; } const sal_Char* getSTR_DELIMITER() { return "/"; } @@ -177,8 +174,6 @@ namespace dbtools case PROPERTY_ID_DBASEPRECISIONCHANGED: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DBASEPRECISIONCHANGED()); break; } case PROPERTY_ID_ISCURRENCY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCURRENCY() ); break; } case PROPERTY_ID_ISBOOKMARKABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISBOOKMARKABLE() ); break; } - case PROPERTY_ID_INVALID_INDEX: { rtl_uString_newFromAscii(&pStr,getSTAT_INVALID_INDEX() ); break; } - case PROPERTY_ID_ERRORMSG_SEQUENCE: { rtl_uString_newFromAscii(&pStr,getERRORMSG_SEQUENCE() ); break; } case PROPERTY_ID_HY010: { rtl_uString_newFromAscii(&pStr,getSQLSTATE_SEQUENCE() ); break; } case PROPERTY_ID_DELIMITER: { rtl_uString_newFromAscii(&pStr,getSTR_DELIMITER() ); break; } case PROPERTY_ID_FORMATKEY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FORMATKEY() ); break; } diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx index 892fa782ca..8f8870ad91 100644 --- a/connectivity/source/drivers/adabas/BDriver.cxx +++ b/connectivity/source/drivers/adabas/BDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: BDriver.cxx,v $ - * $Revision: 1.24 $ + * $Revision: 1.24.56.2 $ * * This file is part of OpenOffice.org. * @@ -44,6 +44,9 @@ #include <unotools/ucbhelper.hxx> #include <unotools/ucbstreamhelper.hxx> #include <unotools/localfilehelper.hxx> +#include "resource/adabas_res.hrc" +#include "resource/sharedresources.hxx" + #include <memory> #include <sys/stat.h> @@ -437,7 +440,9 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::O return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size()); } - ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL!")) ,*this); + SharedResources aResources; + const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); + ::dbtools::throwGenericSQLException(sMessage ,*this); return Sequence< DriverPropertyInfo >(); } // -------------------------------------------------------------------------------- @@ -472,7 +477,14 @@ void SAL_CALL ODriver::createCatalog( const Sequence< PropertyValue >& info ) th createNeededDirs(aDBInfo.sDBName); if(CreateFiles(aDBInfo)) - throw SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Could not create the database files")),*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HY0000")),1000,Any()); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_NO_DISK_SPACE, + "$filename$",aDBInfo.sDBName + ) ); + ::dbtools::throwGenericSQLException(sError,*this); + } // if(CreateFiles(aDBInfo)) createDb(aDBInfo); } @@ -557,7 +569,11 @@ Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByConnection( co Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { if ( ! acceptsURL(url) ) - ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL!")) ,*this); + { + SharedResources aResources; + const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); + ::dbtools::throwGenericSQLException(sMessage ,*this); + } // if ( ! acceptsURL(url) ) return getDataDefinitionByConnection(connect(url,info)); } @@ -1059,10 +1075,12 @@ OSL_TRACE("CreateFile %d",_nSize); ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(_FileName,STREAM_WRITE)); if( !pFileStream.get()) { - ::rtl::OUString sMsg = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Could not create the database file: '")); - sMsg += _FileName; - sMsg += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'. Not enough space available!")) ; - throw SQLException(sMsg,*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HY0000")),1000,Any()); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_NO_DISK_SPACE, + "$filename$",_FileName + ) ); + ::dbtools::throwGenericSQLException(sError,*this); } (*pFileStream).SetFiller('\0'); sal_Int32 nNewSize = 0; @@ -1082,10 +1100,12 @@ OSL_TRACE("CreateFile %d",_nSize); } if(!bOK) { - ::rtl::OUString sMsg = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Could not create the database file: '")); - sMsg += _FileName; - sMsg += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'. Not enough space available!")) ; - throw SQLException(sMsg,*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HY0000")),1000,Any()); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_NO_DISK_SPACE, + "$filename$",_FileName + ) ); + ::dbtools::throwGenericSQLException(sError,*this); } return bOK; @@ -1113,13 +1133,13 @@ int ODriver::X_START(const ::rtl::OUString& sDBName) if(eError == OProcess::E_NotFound) { - ::rtl::OUString sMsg = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Program ")); - sMsg += sCommand; - sMsg += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" not found!")); - SQLException aNext(sMsg,*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("01000")),1000,Any()); - ::rtl::OUString sMsg2(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Could not start database: "))); - sMsg2 += sDBName; - throw SQLException(sMsg2,*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("01000")),1000,makeAny(aNext)); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_COMMAND_NOT_FOUND, + "$databasename$",sDBName, + "$progname$",sCommand + ) ); + ::dbtools::throwGenericSQLException(sError,*this); } OSL_ASSERT(eError == OProcess::E_None); @@ -1758,7 +1778,9 @@ void ODriver::convertOldVersion(const ::rtl::OUString& sDBName,const TDatabaseSt if ( !_rDbInfo.sControlUser.getLength() || !_rDbInfo.sControlPassword.getLength()) { - throw SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The current database need to be converted. Please insert control user and password.")),*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")),1000,Any()); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_DATABASE_NEEDS_CONVERTING) ); + ::dbtools::throwGenericSQLException(sError,*this); } String sCommandFile = m_sDbWorkURL; sCommandFile += String::CreateFromAscii("/xparam.prt"); diff --git a/connectivity/source/drivers/adabas/BPreparedStatement.cxx b/connectivity/source/drivers/adabas/BPreparedStatement.cxx index be88bfcb4e..4a4de6808a 100644 --- a/connectivity/source/drivers/adabas/BPreparedStatement.cxx +++ b/connectivity/source/drivers/adabas/BPreparedStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: BPreparedStatement.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.56.1 $ * * This file is part of OpenOffice.org. * @@ -67,12 +67,12 @@ void OAdabasPreparedStatement::setUsingBookmarks(sal_Bool /*_bUseBookmark*/) // ----------------------------------------------------------------------------- void OAdabasPreparedStatement::setResultSetConcurrency(sal_Int32 /*_par0*/) { - ::dbtools::throwFeatureNotImplementedException( "non-standard result set concurrencies: ", *this ); + ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetConcurrency", *this ); } // ----------------------------------------------------------------------------- void OAdabasPreparedStatement::setResultSetType(sal_Int32 /*_par0*/) { - ::dbtools::throwFeatureNotImplementedException( "non-standard result set types: ", *this ); + ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetType", *this ); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/adabas/BStatement.cxx b/connectivity/source/drivers/adabas/BStatement.cxx index 2ed6565876..f58cebfa3e 100644 --- a/connectivity/source/drivers/adabas/BStatement.cxx +++ b/connectivity/source/drivers/adabas/BStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: BStatement.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.56.1 $ * * This file is part of OpenOffice.org. * @@ -63,12 +63,12 @@ void OAdabasStatement::setUsingBookmarks(sal_Bool /*_bUseBookmark*/) // ----------------------------------------------------------------------------- void OAdabasStatement::setResultSetConcurrency(sal_Int32 /*_par0*/) { - ::dbtools::throwFeatureNotImplementedException( "non-standard result set concurrencies: ", *this ); + ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetConcurrency", *this ); } // ----------------------------------------------------------------------------- void OAdabasStatement::setResultSetType(sal_Int32 /*_par0*/) { - ::dbtools::throwFeatureNotImplementedException( "non-standard result set types: ", *this ); + ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetType", *this ); } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OAdabasStatement::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/adabas/BTable.cxx b/connectivity/source/drivers/adabas/BTable.cxx index 807e1daaa0..bfd598929c 100644 --- a/connectivity/source/drivers/adabas/BTable.cxx +++ b/connectivity/source/drivers/adabas/BTable.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: BTable.cxx,v $ - * $Revision: 1.36 $ + * $Revision: 1.36.56.1 $ * * This file is part of OpenOffice.org. * @@ -144,9 +144,6 @@ void SAL_CALL OAdabasTable::alterColumnByName( const ::rtl::OUString& colName, c if(!isNew()) { -// if(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) != colName) -// throw SQLException(::rtl::OUString::createFromAscii("Not supported by this driver!"),*this,::rtl::OUString::createFromAscii("S1000"),0,Any() ); - beginTransAction(); try diff --git a/connectivity/source/drivers/adabas/BUser.cxx b/connectivity/source/drivers/adabas/BUser.cxx index b3b0d916d2..a672cf906e 100644 --- a/connectivity/source/drivers/adabas/BUser.cxx +++ b/connectivity/source/drivers/adabas/BUser.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: BUser.cxx,v $ - * $Revision: 1.18 $ + * $Revision: 1.17.56.2 $ * * This file is part of OpenOffice.org. * @@ -39,6 +39,7 @@ #include "connectivity/dbexception.hxx" #include <com/sun/star/sdbcx/Privilege.hpp> #include <com/sun/star/sdbcx/PrivilegeObject.hpp> +#include "resource/adabas_res.hrc" using namespace connectivity::adabas; using namespace ::com::sun::star::uno; @@ -197,7 +198,7 @@ sal_Int32 SAL_CALL OAdabasUser::getGrantablePrivileges( const ::rtl::OUString& o void SAL_CALL OAdabasUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException) { if ( objType != PrivilegeObject::TABLE ) - ::dbtools::throwSQLException( "Privilege not granted: Only table privileges can be granted", "01007", *this ); + m_pConnection->throwGenericSQLException(STR_PRIVILEGE_NOT_GRANTED,*this); ::osl::MutexGuard aGuard(m_aMutex); ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges); @@ -222,7 +223,7 @@ void SAL_CALL OAdabasUser::grantPrivileges( const ::rtl::OUString& objName, sal_ void SAL_CALL OAdabasUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException) { if ( objType != PrivilegeObject::TABLE ) - ::dbtools::throwSQLException( "Privilege not revoked: Only table privileges can be revoked", "01006", *this ); + m_pConnection->throwGenericSQLException(STR_PRIVILEGE_NOT_REVOKED,*this); ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); diff --git a/connectivity/source/drivers/adabas/BUsers.cxx b/connectivity/source/drivers/adabas/BUsers.cxx index 8888568da8..6062b63854 100644 --- a/connectivity/source/drivers/adabas/BUsers.cxx +++ b/connectivity/source/drivers/adabas/BUsers.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: BUsers.cxx,v $ - * $Revision: 1.19 $ + * $Revision: 1.19.56.1 $ * * This file is part of OpenOffice.org. * @@ -39,6 +39,7 @@ #include <comphelper/types.hxx> #include "connectivity/dbexception.hxx" #include "connectivity/dbtools.hxx" +#include "resource/adabas_res.hrc" using namespace ::comphelper; using namespace connectivity; @@ -108,7 +109,7 @@ void OUsers::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) if(xRow->getString(1) == sDbaUser) { ::comphelper::disposeComponent(xStmt); - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("This user couldn't be deleted. Otherwise the database stays in a inconsistent state."),static_cast<XTypeProvider*>(this)); + m_pConnection->throwGenericSQLException(STR_USER_NO_DELETE,static_cast< XDrop* >( this )); } } ::comphelper::disposeComponent(xStmt); diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx index 3d5a61c997..473f57e681 100644 --- a/connectivity/source/drivers/ado/AColumns.cxx +++ b/connectivity/source/drivers/ado/AColumns.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: AColumns.cxx,v $ - * $Revision: 1.22 $ + * $Revision: 1.22.56.1 $ * * This file is part of OpenOffice.org. * @@ -41,6 +41,7 @@ #include <comphelper/property.hxx> #include <comphelper/types.hxx> #include <connectivity/dbexception.hxx> +#include "resource/ado_res.hrc" using namespace connectivity::ado; using namespace connectivity; @@ -72,10 +73,7 @@ sdbcx::ObjectType OColumns::appendObject( const ::rtl::OUString&, const Referenc { OAdoColumn* pColumn = NULL; if ( !getImplementation( pColumn, descriptor ) || pColumn == NULL ) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Could not append column: invalid column descriptor." ), - static_cast<XTypeProvider*>(this) - ); + m_pConnection->throwGenericSQLException( STR_INVALID_COLUMN_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); WpADOColumn aColumn = pColumn->getColumnImpl(); diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx index 32978ed581..33c1f80b4a 100644 --- a/connectivity/source/drivers/ado/ADriver.cxx +++ b/connectivity/source/drivers/ado/ADriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ADriver.cxx,v $ - * $Revision: 1.19 $ + * $Revision: 1.19.56.1 $ * * This file is part of OpenOffice.org. * @@ -38,8 +38,11 @@ #include "ado/adoimp.hxx" #include <com/sun/star/lang/DisposedException.hpp> #include "connectivity/dbexception.hxx" +#include "resource/ado_res.hrc" +#include "resource/sharedresources.hxx" +using namespace connectivity; using namespace connectivity::ado; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -140,11 +143,20 @@ sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) { return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:ado:"),9)); } +// ----------------------------------------------------------------------------- +void ODriver::impl_checkURL_throw(const ::rtl::OUString& _sUrl) +{ + if ( !acceptsURL(_sUrl) ) + { + SharedResources aResources; + const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); + ::dbtools::throwGenericSQLException(sMessage ,*this); + } // if ( !acceptsURL(_sUrl) ) +} // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) { - if ( !acceptsURL(url) ) - ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL!")) ,*this); + impl_checkURL_throw(url); return Sequence< DriverPropertyInfo >(); } // -------------------------------------------------------------------------------- @@ -201,8 +213,7 @@ Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByConnection( co // -------------------------------------------------------------------------------- Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { - if ( ! acceptsURL(url) ) - ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL!")) ,*this); + impl_checkURL_throw(url); return getDataDefinitionByConnection(connect(url,info)); } diff --git a/connectivity/source/drivers/ado/AGroups.cxx b/connectivity/source/drivers/ado/AGroups.cxx index 979fbbe8a1..5e366825f1 100644 --- a/connectivity/source/drivers/ado/AGroups.cxx +++ b/connectivity/source/drivers/ado/AGroups.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: AGroups.cxx,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.56.1 $ * * This file is part of OpenOffice.org. * @@ -31,16 +31,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_connectivity.hxx" #include "ado/AGroups.hxx" -#ifndef _CONNECTIVITY_ADO_GROUP_HXX_ #include "ado/AGroup.hxx" -#endif #include "ado/ATable.hxx" +#include "ado/AConnection.hxx" #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include "connectivity/sdbcx/IRefreshable.hxx" #include "TConnection.hxx" #include <comphelper/types.hxx> #include <connectivity/dbexception.hxx> +#include "resource/ado_res.hrc" using namespace comphelper; using namespace connectivity; @@ -73,10 +73,7 @@ sdbcx::ObjectType OGroups::appendObject( const ::rtl::OUString& _rForName, const { OAdoGroup* pGroup = NULL; if ( !getImplementation(pGroup,descriptor) || pGroup == NULL ) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Could not create group: invalid object descriptor." ), - static_cast<XTypeProvider*>(this) - ); + m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_GROUP_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); m_aCollection.Append( pGroup->getImpl() ); return createObject( _rForName ); diff --git a/connectivity/source/drivers/ado/AIndexes.cxx b/connectivity/source/drivers/ado/AIndexes.cxx index ae938beb67..0246348e58 100644 --- a/connectivity/source/drivers/ado/AIndexes.cxx +++ b/connectivity/source/drivers/ado/AIndexes.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: AIndexes.cxx,v $ - * $Revision: 1.17 $ + * $Revision: 1.17.56.1 $ * * This file is part of OpenOffice.org. * @@ -39,7 +39,7 @@ #include "TConnection.hxx" #include <comphelper/types.hxx> #include <connectivity/dbexception.hxx> - +#include "resource/ado_res.hrc" using namespace ::comphelper; @@ -71,19 +71,13 @@ sdbcx::ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, cons { OAdoIndex* pIndex = NULL; if ( !getImplementation(pIndex,descriptor) || pIndex == NULL ) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Could not create index: invalid object descriptor." ), - static_cast<XTypeProvider*>(this) - ); + m_pConnection->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); ADOIndexes* pIndexes = m_aCollection; if ( FAILED( pIndexes->Append( OLEVariant( _rForName ), OLEVariant( pIndex->getImpl() ) ) ) ) { ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this)); - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Could not append index." ), - static_cast<XTypeProvider*>(this) - ); + m_pConnection->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); } return new OAdoIndex(isCaseSensitive(),m_pConnection,pIndex->getImpl()); diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx index 090987ee3c..abe6bb3113 100644 --- a/connectivity/source/drivers/ado/AKeys.cxx +++ b/connectivity/source/drivers/ado/AKeys.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: AKeys.cxx,v $ - * $Revision: 1.20 $ + * $Revision: 1.20.56.1 $ * * This file is part of OpenOffice.org. * @@ -43,6 +43,7 @@ #include "ado/Awrapado.hxx" #include <comphelper/property.hxx> #include <connectivity/dbexception.hxx> +#include "resource/ado_res.hrc" using namespace ::comphelper; using namespace connectivity; @@ -74,10 +75,7 @@ sdbcx::ObjectType OKeys::appendObject( const ::rtl::OUString&, const Reference< { OAdoKey* pKey = NULL; if ( !getImplementation( pKey, descriptor ) || pKey == NULL) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Could not create key: invalid object descriptor." ), - static_cast<XTypeProvider*>(this) - ); + m_pConnection->throwGenericSQLException( STR_INVALID_KEY_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); // To pass as column parameter to Key's Apppend method OLEVariant vOptional; @@ -103,10 +101,7 @@ sdbcx::ObjectType OKeys::appendObject( const ::rtl::OUString&, const Reference< { ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this)); // just make sure that an SQLExceptionis thrown here - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Could not append key." ), - static_cast<XTypeProvider*>(this) - ); + m_pConnection->throwGenericSQLException( STR_INVALID_KEY_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); } return new OAdoKey(isCaseSensitive(),m_pConnection,pKey->getImpl()); diff --git a/connectivity/source/drivers/ado/ATables.cxx b/connectivity/source/drivers/ado/ATables.cxx index 46db96151d..384607bdef 100644 --- a/connectivity/source/drivers/ado/ATables.cxx +++ b/connectivity/source/drivers/ado/ATables.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ATables.cxx,v $ - * $Revision: 1.21 $ + * $Revision: 1.21.56.1 $ * * This file is part of OpenOffice.org. * @@ -38,14 +38,13 @@ #include <com/sun/star/sdbc/KeyRule.hpp> #include <com/sun/star/sdbcx/KeyType.hpp> #include "ado/ACatalog.hxx" -#ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_ #include "ado/AConnection.hxx" -#endif #include "ado/Awrapado.hxx" #include "TConnection.hxx" #include <comphelper/types.hxx> #include <cppuhelper/interfacecontainer.h> #include <connectivity/dbexception.hxx> +#include "resource/ado_res.hrc" using namespace ::cppu; using namespace connectivity; @@ -83,10 +82,7 @@ sdbcx::ObjectType OTables::appendObject( const ::rtl::OUString&, const Reference { OAdoTable* pTable = NULL; if ( !getImplementation( pTable, descriptor ) || pTable == NULL ) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Could not create table: invalid object descriptor." ), - static_cast<XTypeProvider*>(this) - ); + m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_TABLE_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid"); if(!m_aCollection.Append(pTable->getImpl())) diff --git a/connectivity/source/drivers/ado/AUsers.cxx b/connectivity/source/drivers/ado/AUsers.cxx index 3fb8beb32e..bf66d1d6f8 100644 --- a/connectivity/source/drivers/ado/AUsers.cxx +++ b/connectivity/source/drivers/ado/AUsers.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: AUsers.cxx,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.56.1 $ * * This file is part of OpenOffice.org. * @@ -33,11 +33,13 @@ #include "ado/AUsers.hxx" #include "ado/AUser.hxx" #include "ado/ATable.hxx" +#include "ado/AConnection.hxx" #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include "connectivity/sdbcx/IRefreshable.hxx" #include <comphelper/types.hxx> #include <connectivity/dbexception.hxx> +#include "resource/ado_res.hrc" using namespace comphelper; using namespace connectivity; @@ -70,10 +72,7 @@ sdbcx::ObjectType OUsers::appendObject( const ::rtl::OUString& _rForName, const { OUserExtend* pUser = NULL; if ( !getImplementation( pUser, descriptor ) || pUser == NULL ) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Could not create user: invalid object descriptor." ), - static_cast<XTypeProvider*>(this) - ); + m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_USER_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); ADOUsers* pUsers = (ADOUsers*)m_aCollection; pUsers->Append(OLEVariant(pUser->getImpl()),OLEString(pUser->getPassword())); diff --git a/connectivity/source/drivers/ado/AViews.cxx b/connectivity/source/drivers/ado/AViews.cxx index 12cbd7b034..ed95efea6c 100644 --- a/connectivity/source/drivers/ado/AViews.cxx +++ b/connectivity/source/drivers/ado/AViews.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: AViews.cxx,v $ - * $Revision: 1.17 $ + * $Revision: 1.17.56.1 $ * * This file is part of OpenOffice.org. * @@ -34,13 +34,12 @@ #include "ado/AView.hxx" #include "ado/ATables.hxx" #include "ado/ACatalog.hxx" -#ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_ #include "ado/AConnection.hxx" -#endif #include "ado/Awrapado.hxx" #include "TConnection.hxx" #include <comphelper/types.hxx> #include <connectivity/dbexception.hxx> +#include "resource/ado_res.hrc" using namespace ::comphelper; @@ -75,18 +74,12 @@ sdbcx::ObjectType OViews::appendObject( const ::rtl::OUString& _rForName, const { OAdoView* pView = NULL; if ( !getImplementation( pView, descriptor ) || pView == NULL ) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Could not create view: invalid object descriptor." ), - static_cast<XTypeProvider*>(this) - ); + m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_VIEW_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); WpADOCommand aCommand; aCommand.Create(); if ( !aCommand.IsValid() ) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Could not create view: no command object." ), - static_cast<XTypeProvider*>(this) - ); + m_pCatalog->getConnection()->throwGenericSQLException( STR_VIEW_NO_COMMAND_ERROR,static_cast<XTypeProvider*>(this) ); ::rtl::OUString sName( _rForName ); aCommand.put_Name(sName); diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx index d61b1476b0..650c77a244 100644 --- a/connectivity/source/drivers/ado/Aolevariant.cxx +++ b/connectivity/source/drivers/ado/Aolevariant.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: Aolevariant.cxx,v $ - * $Revision: 1.15 $ + * $Revision: 1.15.56.1 $ * * This file is part of OpenOffice.org. * @@ -37,6 +37,8 @@ #include <com/sun/star/util/Date.hpp> #include <com/sun/star/util/DateTime.hpp> #include "diagnose_ex.h" +#include "resource/sharedresources.hxx" +#include "resource/ado_res.hrc" using namespace connectivity::ado; OLEString::OLEString() @@ -437,8 +439,10 @@ void OLEVariant::ChangeType(VARTYPE vartype, const OLEVariant* pSrc) 0, vartype ) ) ) { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_TYPE_NOT_CONVERT)); throw ::com::sun::star::sdbc::SQLException( - ::rtl::OUString::createFromAscii( "Could not convert type!" ), + sError, NULL, ::rtl::OUString::createFromAscii( "S1000" ), 1000, diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx index 8fb24e00e6..4f3997943a 100644 --- a/connectivity/source/drivers/calc/CConnection.cxx +++ b/connectivity/source/drivers/calc/CConnection.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: CConnection.cxx,v $ - * $Revision: 1.18 $ + * $Revision: 1.18.22.1 $ * * This file is part of OpenOffice.org. * @@ -163,8 +163,6 @@ Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc() // instead of at the first access to it if ( !m_xDoc.is() ) { - SharedResources aResourceLoader; - Any aErrorDetails; if ( aLoaderException.hasValue() ) { @@ -172,7 +170,7 @@ Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc() OSL_VERIFY( aLoaderException >>= aLoaderError ); SQLException aDetailException; - aDetailException.Message = aResourceLoader.getResourceStringWithSubstitution( + aDetailException.Message = m_aResources.getResourceStringWithSubstitution( STR_LOAD_FILE_ERROR_MESSAGE, "$exception_type$", aLoaderException.getValueTypeName(), "$error_message$", aLoaderError.Message @@ -180,7 +178,7 @@ Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc() aErrorDetails <<= aDetailException; } - const ::rtl::OUString sError( aResourceLoader.getResourceStringWithSubstitution( + const ::rtl::OUString sError( m_aResources.getResourceStringWithSubstitution( STR_COULD_NOT_LOAD_FILE, "$filename$", m_aFileName ) ); diff --git a/connectivity/source/drivers/calc/CDriver.cxx b/connectivity/source/drivers/calc/CDriver.cxx index de5de558b6..3400940c24 100644 --- a/connectivity/source/drivers/calc/CDriver.cxx +++ b/connectivity/source/drivers/calc/CDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: CDriver.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.56.1 $ * * This file is part of OpenOffice.org. * @@ -34,6 +34,8 @@ #include "calc/CConnection.hxx" #include <com/sun/star/lang/DisposedException.hpp> #include "connectivity/dbexception.hxx" +#include "resource/sharedresources.hxx" +#include "resource/calc_res.hrc" using namespace connectivity::calc; using namespace connectivity::file; @@ -99,7 +101,11 @@ sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) { if ( !acceptsURL(url) ) - ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL!")) ,*this); + { + 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/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx index ab0e9fbb9a..2858e8e21e 100644 --- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx +++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DDatabaseMetaData.cxx,v $ - * $Revision: 1.35 $ + * $Revision: 1.35.56.1 $ * * This file is part of OpenOffice.org. * @@ -367,5 +367,15 @@ sal_Bool SAL_CALL ODbaseDatabaseMetaData::isReadOnly( ) throw(SQLException, Run return bReadOnly; } // ----------------------------------------------------------------------------- +sal_Bool ODbaseDatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( ) +{ + return sal_True; +} +// ----------------------------------------------------------------------------- +sal_Bool ODbaseDatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( ) +{ + return sal_True; +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DDriver.cxx b/connectivity/source/drivers/dbase/DDriver.cxx index 4c87372a7d..3a2139bdb9 100644 --- a/connectivity/source/drivers/dbase/DDriver.cxx +++ b/connectivity/source/drivers/dbase/DDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DDriver.cxx,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.56.1 $ * * This file is part of OpenOffice.org. * @@ -34,6 +34,7 @@ #include "dbase/DConnection.hxx" #include <com/sun/star/lang/DisposedException.hpp> #include "connectivity/dbexception.hxx" +#include "resource/dbase_res.hrc" using namespace connectivity::dbase; using namespace connectivity::file; @@ -119,7 +120,9 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::O return Sequence< DriverPropertyInfo >(&(aDriverInfo[0]),aDriverInfo.size()); } - ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL!")) ,*this); + 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/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index 302746fcc1..01d936324e 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DIndex.cxx,v $ - * $Revision: 1.43 $ + * $Revision: 1.43.56.1 $ * * This file is part of OpenOffice.org. * @@ -51,6 +51,7 @@ #include "dbase/DResultSet.hxx" #include "diagnose_ex.h" #include <comphelper/types.hxx> +#include "resource/dbase_res.hrc" using namespace ::comphelper; // ------------------------------------------------------------------------- @@ -168,9 +169,11 @@ sal_Bool ODbaseIndex::openIndexFile() } if(!m_pFileStream) { - ::rtl::OUString sErrMsg = ::rtl::OUString::createFromAscii("Could not open index: "); - sErrMsg += sFile; - ::dbtools::throwGenericSQLException( sErrMsg, *this ); + const ::rtl::OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution( + STR_COULD_NOT_LOAD_FILE, + "$filename$", sFile + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); } } @@ -439,11 +442,7 @@ BOOL ODbaseIndex::DropImpl() if(UCBContentHelper::Exists(sPath)) { if(!UCBContentHelper::Kill(sPath)) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("The index could not be deleted. An unknown error while accessing the file system occured."), - // TODO: resource - *m_pTable - ); + m_pTable->getConnection()->throwGenericSQLException(STR_COULD_NOT_DELETE_INDEX,*m_pTable); } // InfDatei abgleichen @@ -487,23 +486,21 @@ BOOL ODbaseIndex::CreateImpl() // Anlegen des Index ::rtl::OUString sFile = getCompletePath(); if(UCBContentHelper::Exists(sFile)) - throw SQLException( - ::rtl::OUString::createFromAscii("The index name can't be used, as it is already used for another table."), - *this, - OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE), - 1000, - Any() - ); - + { + const ::rtl::OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution( + STR_COULD_NOT_CREATE_INDEX_NAME, + "$filename$", sFile + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); + } // Index ist nur einstufig if (m_pColumns->getCount() > 1) - throw SQLException(::rtl::OUString::createFromAscii("Not capable! Only one column per index."),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); + m_pTable->getConnection()->throwGenericSQLException(STR_ONL_ONE_COLUMN_PER_INDEX,*this); - Reference<XFastPropertySet> xCol; - ::cppu::extractInterface(xCol,m_pColumns->getByIndex(0)); + Reference<XFastPropertySet> xCol(m_pColumns->getByIndex(0),UNO_QUERY); // ist die Spalte schon indiziert ? - if (!xCol.is()) + if ( !xCol.is() ) ::dbtools::throwFunctionSequenceException(*this); // else if (pColumn && pColumn->IsIndexed()) // { @@ -519,7 +516,13 @@ BOOL ODbaseIndex::CreateImpl() // create the index file m_pFileStream = OFileTable::createStream_simpleError(sFile,STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC); if (!m_pFileStream) - throw SQLException(::rtl::OUString::createFromAscii("Could not access index file!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); + { + const ::rtl::OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution( + STR_COULD_NOT_LOAD_FILE, + "$filename$", sFile + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); + } m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); m_pFileStream->SetBufferSize(512); @@ -560,13 +563,12 @@ BOOL ODbaseIndex::CreateImpl() xSet = xStmt->executeQuery(aStatement); } - catch(Exception& e) + catch(const Exception& ) { - closeImpl(); if(UCBContentHelper::Exists(sFile)) UCBContentHelper::Kill(sFile); - throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,makeAny(e)); + m_pTable->getConnection()->throwGenericSQLException(STR_COULD_NOT_CREATE_INDEX,*this); } if (!xSet.is()) { @@ -574,7 +576,7 @@ BOOL ODbaseIndex::CreateImpl() closeImpl(); if(UCBContentHelper::Exists(sFile)) UCBContentHelper::Kill(sFile); - throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); + m_pTable->getConnection()->throwGenericSQLException(STR_COULD_NOT_CREATE_INDEX,*this); } // Setzen der Headerinfo @@ -643,10 +645,7 @@ BOOL ODbaseIndex::CreateImpl() closeImpl(); if(UCBContentHelper::Exists(sFile)) UCBContentHelper::Kill(sFile); - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Can not create index. Values are not unique!"), - *this - ); + m_pTable->getConnection()->throwGenericSQLException(STR_COULD_NOT_CREATE_INDEX_NOT_UNIQUE,*this); } } aInsertKey.setValue(aValue); @@ -666,7 +665,7 @@ BOOL ODbaseIndex::CreateImpl() closeImpl(); if(UCBContentHelper::Exists(sFile)) UCBContentHelper::Kill(sFile); - throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); + m_pTable->getConnection()->throwGenericSQLException(STR_COULD_NOT_CREATE_INDEX,*this); } Release(); createINFEntry(); diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx index 7ba5fc255f..5c7e5b93d3 100644 --- a/connectivity/source/drivers/dbase/DIndexes.cxx +++ b/connectivity/source/drivers/dbase/DIndexes.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DIndexes.cxx,v $ - * $Revision: 1.18 $ + * $Revision: 1.18.56.1 $ * * This file is part of OpenOffice.org. * @@ -35,6 +35,7 @@ #include <connectivity/dbexception.hxx> #include <unotools/ucbhelper.hxx> #include <comphelper/types.hxx> +#include "resource/dbase_res.hrc" using namespace ::comphelper; @@ -60,11 +61,14 @@ sdbcx::ObjectType ODbaseIndexes::createObject(const ::rtl::OUString& _rName) sFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER); sFile += _rName; sFile += ::rtl::OUString::createFromAscii(".ndx"); - if(!UCBContentHelper::Exists(sFile)) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Index file doesn't exists." ), - // TODO: resource - *m_pTable ); + if ( !UCBContentHelper::Exists(sFile) ) + { + const ::rtl::OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution( + STR_COULD_NOT_LOAD_FILE, + "$filename$", sFile + ) ); + ::dbtools::throwGenericSQLException( sError, *m_pTable ); + } sdbcx::ObjectType xRet; SvStream* pFileStream = ::connectivity::file::OFileTable::createStream_simpleError(sFile,STREAM_READ | STREAM_NOCREATE| STREAM_SHARE_DENYWRITE); @@ -83,10 +87,13 @@ sdbcx::ObjectType ODbaseIndexes::createObject(const ::rtl::OUString& _rName) pIndex->openIndexFile(); } else - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Could not open index file."), - // TODO: resource - *m_pTable ); + { + const ::rtl::OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution( + STR_COULD_NOT_LOAD_FILE, + "$filename$", sFile + ) ); + ::dbtools::throwGenericSQLException( sError, *m_pTable ); + } return xRet; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DResultSet.cxx b/connectivity/source/drivers/dbase/DResultSet.cxx index a3dce8617c..3fdddf6f43 100644 --- a/connectivity/source/drivers/dbase/DResultSet.cxx +++ b/connectivity/source/drivers/dbase/DResultSet.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DResultSet.cxx,v $ - * $Revision: 1.25 $ + * $Revision: 1.25.56.2 $ * * This file is part of OpenOffice.org. * @@ -39,6 +39,7 @@ #include "dbase/DCode.hxx" #include <comphelper/types.hxx> #include <connectivity/dbexception.hxx> +#include "resource/dbase_res.hrc" using namespace ::comphelper; @@ -135,7 +136,11 @@ sal_Int32 SAL_CALL ODbaseResultSet::compareBookmarks( const Any& lhs, const Any& { sal_Int32 nFirst(0),nSecond(0),nResult(0); if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) ) - ::dbtools::throwSQLException( "XRowLocate::compareBookmarks: Invalid bookmark value", "HY111", *this ); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sMessage = aResources.getResourceString(STR_INVALID_BOOKMARK); + ::dbtools::throwGenericSQLException(sMessage ,*this); + } // if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) ) // have a look at CompareBookmark // we can't use the names there because we already have defines with the same name from the parser @@ -235,7 +240,7 @@ void SAL_CALL ODbaseResultSet::release() throw() // ----------------------------------------------------------------------------- OSQLAnalyzer* ODbaseResultSet::createAnalyzer() { - return new OFILEAnalyzer(); + return new OFILEAnalyzer(m_pTable->getConnection()); } // ----------------------------------------------------------------------------- sal_Int32 ODbaseResultSet::getCurrentFilePos() const diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index e82737b5f9..53d71a9702 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DTable.cxx,v $ - * $Revision: 1.107 $ + * $Revision: 1.107.30.2 $ * * This file is part of OpenOffice.org. * @@ -60,6 +60,7 @@ #include "connectivity/dbtools.hxx" #include "connectivity/FValue.hxx" #include "connectivity/dbconversion.hxx" +#include "resource/dbase_res.hrc" #include <algorithm> @@ -795,10 +796,11 @@ BOOL ODbaseTable::CreateImpl() if ( m_pConnection->isCheckEnabled() && ::dbtools::convertName2SQLName(m_Name,::rtl::OUString()) != m_Name ) { - ::rtl::OUString sError(RTL_CONSTASCII_USTRINGPARAM("The Name '")); - sError += m_Name; - sError += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' doesn't match SQL naming constraints.")); - ::dbtools::throwGenericSQLException(sError,*this); + const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( + STR_SQL_NAME_ERROR, + "$name$", m_Name + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); } INetURLObject aURL; @@ -881,10 +883,12 @@ BOOL ODbaseTable::CreateImpl() } catch(const Exception&) { - ::rtl::OUString sMessage = ::rtl::OUString::createFromAscii("[StarOffice Base dbase] The memo file '"); - sMessage += aName; - sMessage += ::rtl::OUString::createFromAscii(" already exists."); - throwGenericSQLException(sMessage, static_cast<XNamed*>(this)); + + const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( + STR_COULD_NOT_DELETE_FILE, + "$name$", aName + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); } } if (!CreateMemoFile(aURL)) @@ -899,17 +903,10 @@ BOOL ODbaseTable::CreateImpl() else m_aHeader.db_typ = dBaseIII; -// if (GetDBFConnection()->GetShowDeleted()) -// nPrivileges = SDB_PR_READ | SDB_PR_INSERT | SDB_PR_UPDATE | -// SDB_PR_ALTER | SDB_PR_DROP; -// else - // nPrivileges = SDB_PR_READ | SDB_PR_INSERT | SDB_PR_UPDATE | - // SDB_PR_DELETE | SDB_PR_ALTER | SDB_PR_DROP; - return TRUE; } // ----------------------------------------------------------------------------- -void ODbaseTable::throwInvalidColumnType(const ::rtl::OUString& _sError,const ::rtl::OUString& _sColumnName) +void ODbaseTable::throwInvalidColumnType(const sal_uInt16 _nErrorId,const ::rtl::OUString& _sColumnName) { try { @@ -920,11 +917,11 @@ void ODbaseTable::throwInvalidColumnType(const ::rtl::OUString& _sError,const :: { } - ::rtl::OUString sMsg = _sError; - sMsg += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")); - sMsg += _sColumnName; - sMsg += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" !")); - ::dbtools::throwGenericSQLException( sMsg, *this ); + const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( + _nErrorId, + "$columnname$", _sColumnName + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); } //------------------------------------------------------------------ // erzeugt grundsaetzlich dBase IV Datei Format @@ -974,10 +971,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) ::rtl::OString aCol; if ( DBTypeConversion::convertUnicodeString( aName, aCol, m_eEncoding ) > nMaxFieldLength) { - ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Invalid column name length for column: "); - sMsg += aName; - sMsg += ::rtl::OUString::createFromAscii("!"); - ::dbtools::throwGenericSQLException( sMsg, *this ); + throwInvalidColumnType( STR_INVALID_COLUMN_NAME_LENGTH, aName ); } (*m_pFileStream) << aCol.getStr(); @@ -1011,7 +1005,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) break; default: { - throwInvalidColumnType(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid column type for column: ")), aName); + throwInvalidColumnType(STR_INVALID_COLUMN_TYPE, aName); } } @@ -1029,7 +1023,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) OSL_ENSURE(nPrecision < 255, "ODbaseTable::Create: Column zu lang!"); if (nPrecision > 254) { - throwInvalidColumnType(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid precision for column: ")), aName); + throwInvalidColumnType(STR_INVALID_COLUMN_PRECISION, aName); } (*m_pFileStream) << (BYTE) Min((ULONG)nPrecision, 255UL); //Feldlaenge nRecLength = nRecLength + (USHORT)::std::min((USHORT)nPrecision, (USHORT)255UL); @@ -1041,7 +1035,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) "ODbaseTable::Create: Feldlaenge muss groesser Nachkommastellen sein!"); if (nPrecision < nScale) { - throwInvalidColumnType(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Precision is less than scale for column: ")), aName); + throwInvalidColumnType(STR_INVALID_PRECISION_SCALE, aName); } if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt { @@ -1075,9 +1069,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) nRecLength += 10; break; default: - { - throwInvalidColumnType(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid column type for column: ")), aName); - } + throwInvalidColumnType(STR_INVALID_COLUMN_TYPE, aName); } m_pFileStream->Write(aBuffer, 14); } @@ -1438,17 +1430,14 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const if (pIndex->Find(0,*rRow[nPos])) { // es existiert kein eindeutiger Wert - ::rtl::OUString sMessage(RTL_CONSTASCII_USTRINGPARAM("Duplicate value found in column \"")); if ( !aColName.getLength() ) { m_pColumns->getByIndex(i) >>= xCol; OSL_ENSURE(xCol.is(),"ODbaseTable::UpdateBuffer column is null!"); xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName; xCol = NULL; - } - sMessage += aColName; - sMessage += ::rtl::OUString::createFromAscii( "\"!"); - ::dbtools::throwGenericSQLException( sMessage, *this ); + } // if ( !aColName.getLength() ) + throwInvalidColumnType(STR_DUPLICATE_VALUE_IN_COLUMN,aColName); } } } @@ -1582,7 +1571,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const // ein const_cast, da GetFormatPrecision am SvNumberFormat nicht const ist, obwohl es das eigentlich // sein koennte und muesste - ByteString aDefaultValue = ::rtl::math::doubleToString( n, rtl_math_StringFormat_F, nScale, '.', NULL, 0); + const ByteString aDefaultValue( ::rtl::math::doubleToString( n, rtl_math_StringFormat_F, nScale, '.', NULL, 0)); sal_Int32 nRealLen = aDefaultValue.Len(); BOOL bValidLength = nRealLen <= nLen; if ( bValidLength ) @@ -1593,7 +1582,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const if ( n < 0.0 ) // for the sign '-' --nRealLen; - bValidLength = nRealLen < nRealPrecision; + bValidLength = nRealLen <= nRealPrecision; if ( bValidLength ) { strncpy(pData,aDefaultValue.GetBuffer(),nLen); @@ -1607,15 +1596,13 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const OSL_ENSURE(xCol.is(),"ODbaseTable::UpdateBuffer column is null!"); xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName; - String sError; - sError.AppendAscii("The \""); - sError += aColName.getStr(); - sError.AppendAscii("\" column has been defined as a \"Decimal\" type, the max. length is "); - sError += String::CreateFromInt32(nRealPrecision); - sError.AppendAscii(" characters (with "); - sError += String::CreateFromInt32(nScale); - sError.AppendAscii(" decimal places).\n\nThe specified value is longer than the number of digits allowed."); - throwGenericSQLException(sError, static_cast<XNamed*>(this)); + const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( + STR_INVALID_COLUMN_DECIMAL_VALUE, + "$columnname$", aColName, + "$precision$", String::CreateFromInt32(nRealPrecision), + "$scale$", String::CreateFromInt32(nScale) + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); } } break; case DataType::BIT: @@ -1673,11 +1660,11 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const if ( xCol.is() ) xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName; - ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii( "invalid value for column '" ); - sMsg += aColName; - sMsg += ::rtl::OUString::createFromAscii("'"); - - throw SQLException( sMsg, *this, sSQLState, nErrorCode, aSQLError ); + const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( + STR_INVALID_COLUMN_VALUE, + "$columnname$", aColName + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); } // Und weiter ... nByteOffset += nLen; @@ -1909,10 +1896,11 @@ void ODbaseTable::alterColumn(sal_Int32 index, // construct the new table if(!pNewTable->CreateImpl()) { - ::rtl::OUString sError = ::rtl::OUString::createFromAscii("Could not alter column \""); - sError += ::comphelper::getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - sError += ::rtl::OUString::createFromAscii("\". May be the file system is write protected."); - throwGenericSQLException(sError,*this ); + const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( + STR_COLUMN_NOT_ALTERABLE, + "$columnname$", ::comphelper::getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); } pNewTable->construct(); @@ -2063,10 +2051,11 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) // construct the new table if(!pNewTable->CreateImpl()) { - ::rtl::OUString sError = ::rtl::OUString::createFromAscii("Could not add new column \""); - sError += ::comphelper::getString(_xNewColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - sError += ::rtl::OUString::createFromAscii("\". May be the file system is write protected."); - throwGenericSQLException(sError,*this ); + const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( + STR_COLUMN_NOT_ADDABLE, + "$columnname$", ::comphelper::getString(_xNewColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); } BOOL bAlreadyDroped = FALSE; @@ -2134,10 +2123,11 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos) if(!pNewTable->CreateImpl()) { xHold = pNewTable = NULL; - ::rtl::OUString sError = ::rtl::OUString::createFromAscii("Could not drop column at position \""); - sError += ::rtl::OUString::valueOf(_nPos); - sError += ::rtl::OUString::createFromAscii("\". May be the file system is write protected."); - throwGenericSQLException(sError,*this ); + const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( + STR_COLUMN_NOT_DROP, + "$position$", ::rtl::OUString::valueOf(_nPos) + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); } pNewTable->construct(); // copy the data @@ -2166,9 +2156,7 @@ String ODbaseTable::createTempFile() String sName(m_Name); TempFile aTempFile(sName,&sExt,&sTempName); if(!aTempFile.IsValid()) - ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii( "Error while alter table." ), - // TODO: resource - *this ); + getConnection()->throwGenericSQLException(STR_COULD_NOT_ALTER_TABLE,*this); INetURLObject aURL; aURL.SetSmartProtocol(INET_PROT_FILE); @@ -2240,10 +2228,12 @@ void ODbaseTable::throwInvalidDbaseFormat() { FileClose(); // no dbase file - ::rtl::OUString sMessage = ::rtl::OUString::createFromAscii("[StarOffice Base dbase] The file '"); - sMessage += getEntry(m_pConnection,m_Name); - sMessage += ::rtl::OUString::createFromAscii(" is an invalid (or unrecognized) dBase file."); - throwGenericSQLException(sMessage, static_cast<XNamed*>(this)); + + const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( + STR_SQL_NAME_ERROR, + "$filename$", getEntry(m_pConnection,m_Name) + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); } // ----------------------------------------------------------------------------- void ODbaseTable::refreshHeader() diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx index 72ba776240..988a98f0bd 100644 --- a/connectivity/source/drivers/dbase/DTables.cxx +++ b/connectivity/source/drivers/dbase/DTables.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DTables.cxx,v $ - * $Revision: 1.27 $ + * $Revision: 1.27.56.1 $ * * This file is part of OpenOffice.org. * @@ -38,12 +38,12 @@ #include <com/sun/star/sdbc/KeyRule.hpp> #include <com/sun/star/sdbcx/KeyType.hpp> #include "file/FCatalog.hxx" -#ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_ #include "file/FConnection.hxx" -#endif #include <com/sun/star/lang/XUnoTunnel.hpp> #include "dbase/DCatalog.hxx" #include <comphelper/types.hxx> +#include "resource/dbase_res.hrc" +#include "connectivity/dbexception.hxx" using namespace ::comphelper; using namespace connectivity; @@ -128,8 +128,13 @@ void ODbaseTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementNam pTable->DropImpl(); } else - throw SQLException(::rtl::OUString::createFromAscii("Can't drop table ") + _sElementName,static_cast<XTypeProvider*>(this),OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE),1000,Any()); - + { + const ::rtl::OUString sError( static_cast<OFileCatalog&>(m_rParent).getConnection()->getResources().getResourceStringWithSubstitution( + STR_TABLE_NOT_DROP, + "$tablename$", _sElementName + ) ); + ::dbtools::throwGenericSQLException( sError, NULL ); + } } // ------------------------------------------------------------------------- Any SAL_CALL ODbaseTables::queryInterface( const Type & rType ) throw(RuntimeException) diff --git a/connectivity/source/drivers/evoab/LConnection.cxx b/connectivity/source/drivers/evoab/LConnection.cxx index 217d2d9a37..60107d6dbb 100644 --- a/connectivity/source/drivers/evoab/LConnection.cxx +++ b/connectivity/source/drivers/evoab/LConnection.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: LConnection.cxx,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.56.1 $ * * This file is part of OpenOffice.org. * @@ -43,12 +43,11 @@ #include <comphelper/processfactory.hxx> #include <vos/process.hxx> #include <tools/debug.hxx> -#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX #include "LDebug.hxx" -#endif #include "diagnose_ex.h" #include <comphelper/sequence.hxx> #include <connectivity/dbexception.hxx> +#include "resource/common_res.hrc" using namespace connectivity::evoab; using namespace connectivity::file; @@ -173,8 +172,7 @@ void OEvoabConnection::construct(const ::rtl::OUString& url,const Sequence< Prop else { OSL_TRACE( "No subschema given!!!\n"); - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("No subschema provided"),NULL); + throwGenericSQLException(STR_URI_SYNTAX_ERROR ,*this); } } else diff --git a/connectivity/source/drivers/evoab/LDriver.cxx b/connectivity/source/drivers/evoab/LDriver.cxx index 9ef5671884..f63b1d7c35 100644 --- a/connectivity/source/drivers/evoab/LDriver.cxx +++ b/connectivity/source/drivers/evoab/LDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: LDriver.cxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.42.1 $ * * This file is part of OpenOffice.org. * @@ -41,9 +41,9 @@ #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <ucbhelper/content.hxx> #include <tools/debug.hxx> -#ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" #include "LDebug.hxx" -#endif using namespace osl; using namespace connectivity::evoab; @@ -500,6 +500,10 @@ rtl::OUString OEvoabDriver::translateFileErrorMessage( oslFileError nFileErr) Sequence< DriverPropertyInfo > SAL_CALL OEvoabDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) { if ( !acceptsURL(url) ) - ::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); + } // if ( !acceptsURL(url) ) return Sequence< DriverPropertyInfo >(); } diff --git a/connectivity/source/drivers/evoab2/NDriver.cxx b/connectivity/source/drivers/evoab2/NDriver.cxx index df8ef37ac4..961a1cf6a3 100644 --- a/connectivity/source/drivers/evoab2/NDriver.cxx +++ b/connectivity/source/drivers/evoab2/NDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: NDriver.cxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.56.1 $ * * This file is part of OpenOffice.org. * @@ -46,6 +46,9 @@ #include <tools/debug.hxx> #include "NDebug.hxx" #include <signal.h> +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" + using namespace osl; using namespace connectivity::evoab; //using namespace connectivity::file; @@ -162,7 +165,12 @@ sal_Bool SAL_CALL OEvoabDriver::acceptsURL( const ::rtl::OUString& url ) Sequence< DriverPropertyInfo > SAL_CALL OEvoabDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) { if ( ! acceptsURL(url) ) - ::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); + } // if ( ! acceptsURL(url) ) + // if you have somthing special to say return it here :-) return Sequence< DriverPropertyInfo >(); } diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx index 634b78ce98..685d24a40f 100644 --- a/connectivity/source/drivers/evoab2/NResultSet.cxx +++ b/connectivity/source/drivers/evoab2/NResultSet.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: NResultSet.cxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.56.1 $ * * This file is part of OpenOffice.org. * @@ -40,9 +40,7 @@ #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <comphelper/types.hxx> #include <connectivity/dbexception.hxx> -#ifndef _CONNECTIVITY_TSORTINDEX_HXX_ #include <TSortIndex.hxx> -#endif #include <rtl/string.hxx> #include <vector> #include <algorithm> @@ -53,9 +51,8 @@ #include <cppuhelper/typeprovider.hxx> #include <com/sun/star/lang/DisposedException.hpp> #include "propertyids.hxx" -#ifndef _SVTOOLS_LOGINDLG_HXX #include <svtools/logindlg.hxx> -#endif +#include "resource/evoab2_res.hrc" using namespace ::comphelper; using namespace connectivity; @@ -225,9 +222,7 @@ void OEvoabResultSet::construct( EBookQuery *pQuery, rtl::OString aTable, bool b if( bIsWithoutWhere && !isLocal( pBook ) ) { OSL_TRACE( "large query on non-local book - ignored" ); - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( - "Use SQL Query with \"where clause\" or \"criteria\", to get the results." ), NULL ); + m_pConnection->throwGenericSQLException(STR_USE_WHERE_CRIT,*this); } else { diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx index 80b4e90997..2dd6a53d87 100644 --- a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: NResultSetMetaData.cxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.7.56.2 $ * * This file is part of OpenOffice.org. * @@ -35,6 +35,7 @@ #include "connectivity/dbexception.hxx" #include <com/sun/star/sdbc/DataType.hpp> #include "NDebug.hxx" +#include "resource/evoab2_res.hrc" using namespace connectivity::evoab; using namespace com::sun::star::uno; @@ -64,9 +65,14 @@ void OEvoabResultSetMetaData::setEvoabFields(const ::vos::ORef<connectivity::OSQ (*aIter)->getPropertyValue(aName) >>= aFieldName; guint nFieldNumber = findEvoabField(aFieldName); if (nFieldNumber == (guint)-1) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Invalid column name: ") + aFieldName, - NULL); + { + :.connectivity::SharedResource aResource; + const ::rtl::OUString sError( aResource.getResourceStringWithSubstitution( + STR_INVALID_COLUMNNAME, + "$columnname$", aFieldName + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); + } m_aEvoabFields.push_back(nFieldNumber); } } diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx index 473c4f9d84..6a37650657 100644 --- a/connectivity/source/drivers/evoab2/NStatement.cxx +++ b/connectivity/source/drivers/evoab2/NStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: NStatement.cxx,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.2.1 $ * * This file is part of OpenOffice.org. * @@ -262,13 +262,10 @@ EBookQuery *OStatement_Base::whereAnalysis( const OSQLParseNode* parseTree ) thr // odbc date (SQL_ISRULE( parseTree->getChild( 2 ), set_fct_spec ) && SQL_ISPUNCTUATION( parseTree->getChild( 2 )->getChild( 0 ), "{" ) ) ) ) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Query too complex" ), NULL); + getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this); - if (pPrec->getNodeType() != SQL_NODE_EQUAL && - pPrec->getNodeType() != SQL_NODE_NOTEQUAL) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Operator too complex" ), NULL); + if (pPrec->getNodeType() != SQL_NODE_EQUAL && pPrec->getNodeType() != SQL_NODE_NOTEQUAL) + getConnection()->throwGenericSQLException(STR_OPERATOR_TOO_COMPLEX,*this); rtl::OUString aMatchString; rtl::OUString aColumnName; @@ -302,8 +299,7 @@ EBookQuery *OStatement_Base::whereAnalysis( const OSQLParseNode* parseTree ) thr } if( ! SQL_ISRULE( parseTree->getChild( 0 ), column_ref) ) - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Invalid Statement - Not a Column"), NULL ); + getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_COLUMN,*this); OSQLParseNode *pColumn = parseTree->getChild( 0 ); // Match Item OSQLParseNode *pAtom = parseTree->getChild( parseTree->count() - 2 ); // Match String @@ -316,8 +312,7 @@ EBookQuery *OStatement_Base::whereAnalysis( const OSQLParseNode* parseTree ) thr ( pAtom->getChild( 0 ) && pAtom->getChild( 0 )->getNodeType() == SQL_NODE_STRING ) ) ) { OSL_TRACE( "analyseSQL : pAtom->count() = %d\n", pAtom->count() ); - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "Invalid Statement - Not a String" ), NULL ); + getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,*this); } const sal_Unicode WILDCARD = '%'; @@ -347,21 +342,16 @@ EBookQuery *OStatement_Base::whereAnalysis( const OSQLParseNode* parseTree ) thr else if( bNotLike ) { // We currently can't handle a 'NOT LIKE' when there are '%' - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "not like statement too complex" ), NULL ); + getConnection()->throwGenericSQLException(STR_QUERY_NOT_LIKE_TOO_COMPLEX,*this); } else if( (aMatchString.indexOf ( WILDCARD ) == aMatchString.lastIndexOf ( WILDCARD ) ) ) { // One occurance of '%' matches... if ( aMatchString.indexOf ( WILDCARD ) == 0 ) pResult = createTest( aColumnName, E_BOOK_QUERY_ENDS_WITH, aMatchString.copy( 1 ) ); - else if ( aMatchString.indexOf ( WILDCARD ) == aMatchString.getLength() - 1 ) pResult = createTest( aColumnName, E_BOOK_QUERY_BEGINS_WITH, aMatchString.copy( 0, aMatchString.getLength() - 1 ) ); - else - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "like statement contains wildcard in the middle" ), NULL ); - + getConnection()->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD,*this); if( pResult && bNotLike ) pResult = e_book_query_not( pResult, TRUE ); @@ -373,11 +363,10 @@ EBookQuery *OStatement_Base::whereAnalysis( const OSQLParseNode* parseTree ) thr pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString.copy (1, aMatchString.getLength() - 2) ); } else - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii( "like statement contains too many wildcards" ), NULL ); + getConnection()->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD_MANY,*this); } else - OSL_ASSERT( "Serious internal error" ); + OSL_ASSERT( "Serious internal error" ); } return pResult; @@ -473,11 +462,8 @@ Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUS e_book_query_unref( pQuery ); xColumns = m_aSQLIterator.getSelectColumns(); if (!xColumns.isValid()) - { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Invalid selection of columns"), - NULL); - } + getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this); + OEvoabResultSetMetaData *pMeta = (OEvoabResultSetMetaData *) pResult->getMetaData().get(); pMeta->setEvoabFields(xColumns); } diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index 15b025aaeb..4b68c873f1 100644 --- a/connectivity/source/drivers/file/FConnection.cxx +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: FConnection.cxx,v $ - * $Revision: 1.51 $ + * $Revision: 1.51.30.2 $ * * This file is part of OpenOffice.org. * @@ -50,6 +50,7 @@ #include <connectivity/dbexception.hxx> #include <osl/thread.h> #include <osl/nlsupport.h> +#include "resource/file_res.hrc" using namespace connectivity::file; using namespace dbtools; @@ -107,34 +108,17 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV { osl_incrementInterlockedCount( &m_refCount ); - { - sal_Int32 nLen = url.indexOf(':'); - nLen = url.indexOf(':',nLen+1); - ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD; - - String aFileName = aDSN; - INetURLObject aURL; - aURL.SetSmartProtocol(INET_PROT_FILE); - { - SvtPathOptions aPathOptions; - aFileName = aPathOptions.SubstituteVariable(aFileName); - } - aURL.SetSmartURL(aFileName); - - setURL(aURL.GetMainURL(INetURLObject::NO_DECODE)); - } - ::rtl::OUString aExt; - const PropertyValue *pBegin = info.getConstArray(); - const PropertyValue *pEnd = pBegin + info.getLength(); - for(;pBegin != pEnd;++pBegin) + const PropertyValue *pIter = info.getConstArray(); + const PropertyValue *pEnd = pIter + info.getLength(); + for(;pIter != pEnd;++pIter) { - if(0 == pBegin->Name.compareToAscii("Extension")) - OSL_VERIFY( pBegin->Value >>= aExt ); - else if(0 == pBegin->Name.compareToAscii("CharSet")) + if(0 == pIter->Name.compareToAscii("Extension")) + OSL_VERIFY( pIter->Value >>= aExt ); + else if(0 == pIter->Name.compareToAscii("CharSet")) { ::rtl::OUString sIanaName; - OSL_VERIFY( pBegin->Value >>= sIanaName ); + OSL_VERIFY( pIter->Value >>= sIanaName ); ::dbtools::OCharsetMap aLookupIanaName; ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.find(sIanaName, ::dbtools::OCharsetMap::IANA()); @@ -143,15 +127,33 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV else m_nTextEncoding = RTL_TEXTENCODING_DONTKNOW; } - else if (0 == pBegin->Name.compareToAscii("ShowDeleted")) + else if (0 == pIter->Name.compareToAscii("ShowDeleted")) { - OSL_VERIFY( pBegin->Value >>= m_bShowDeleted ); + OSL_VERIFY( pIter->Value >>= m_bShowDeleted ); } - else if (0 == pBegin->Name.compareToAscii("EnableSQL92Check")) + else if (0 == pIter->Name.compareToAscii("EnableSQL92Check")) { - pBegin->Value >>= m_bCheckSQL92; + pIter->Value >>= m_bCheckSQL92; } - } // for(;pBegin != pEnd;++pBegin) + } // for(;pIter != pEnd;++pIter) + + { + sal_Int32 nLen = url.indexOf(':'); + nLen = url.indexOf(':',nLen+1); + ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD; + + String aFileName = aDSN; + INetURLObject aURL; + aURL.SetSmartProtocol(INET_PROT_FILE); + { + SvtPathOptions aPathOptions; + aFileName = aPathOptions.SubstituteVariable(aFileName); + } + + aURL.SetSmartURL(aFileName); + + setURL(aURL.GetMainURL(INetURLObject::NO_DECODE)); + } if ( m_nTextEncoding == RTL_TEXTENCODING_DONTKNOW ) { @@ -443,22 +445,16 @@ Sequence< sal_Int8 > OConnection::getUnoTunnelImplementationId() void OConnection::throwUrlNotValid(const ::rtl::OUString & _rsUrl,const ::rtl::OUString & _rsMessage) { SQLException aError; - aError.Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to create a content for the URL given.")); + aError.Message = getResources().getResourceStringWithSubstitution( + STR_NO_VALID_FILE_URL, + "$URL$", _rsUrl + ); + aError.SQLState = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")); aError.ErrorCode = 0; aError.Context = static_cast< XConnection* >(this); - SQLException aUrlError; - if(_rsUrl.getLength()) - { - aUrlError.Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL: ")); - aUrlError.Message += _rsUrl; - } - else - aUrlError.Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No URL supplied!")); - - aError.NextException <<= aUrlError; if (_rsMessage.getLength()) - aUrlError.NextException <<= SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UCB message: ")) += _rsMessage, aError.Context, ::rtl::OUString(), 0, Any()); + aError.NextException <<= SQLException(_rsMessage, aError.Context, ::rtl::OUString(), 0, Any()); throw aError; } diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index b33abff09b..709dbe481d 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: FDriver.cxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.56.2 $ * * This file is part of OpenOffice.org. * @@ -36,6 +36,9 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <comphelper/types.hxx> #include "connectivity/dbexception.hxx" +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" + using namespace connectivity::file; using namespace com::sun::star::uno; @@ -164,9 +167,27 @@ Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const ::rt ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0")) ,aBoolean) ); + aDriverInfo.push_back(DriverPropertyInfo( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseRelativePath")) + ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Handle the connection url as relative path.")) + ,sal_False + ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0")) + ,aBoolean) + ); + aDriverInfo.push_back(DriverPropertyInfo( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) + ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The URL of the database document which is used to create an absolute path.")) + ,sal_False + ,::rtl::OUString() + ,Sequence< ::rtl::OUString >()) + ); return Sequence< DriverPropertyInfo >(&(aDriverInfo[0]),aDriverInfo.size()); - } - ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL!")) ,*this); + } // if ( acceptsURL(url) ) + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); + ::dbtools::throwGenericSQLException(sMessage ,*this); + } // if ( ! acceptsURL(url) ) return Sequence< DriverPropertyInfo >(); } // -------------------------------------------------------------------------------- @@ -212,7 +233,11 @@ Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { if ( ! acceptsURL(url) ) - ::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 getDataDefinitionByConnection(connect(url,info)); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index 5ae4ecf5d4..911ad684c9 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: FPreparedStatement.cxx,v $ - * $Revision: 1.42 $ + * $Revision: 1.42.56.1 $ * * This file is part of OpenOffice.org. * @@ -48,6 +48,7 @@ #include <comphelper/types.hxx> #include <com/sun/star/sdbc/ColumnValue.hpp> #include <tools/debug.hxx> +#include "resource/file_res.hrc" using namespace connectivity; using namespace comphelper; @@ -392,11 +393,7 @@ Reference<XResultSet> OPreparedStatement::initResultSet() // check if we got enough paramters if ( (m_aParameterRow.isValid() && ( m_aParameterRow->size() -1 ) < m_xParamColumns->size()) || (m_xParamColumns.isValid() && !m_aParameterRow.isValid() && !m_aParameterRow->empty()) ) - throw SQLException(::rtl::OUString::createFromAscii("Invalid count of parameters supplied!") - ,*this - ,::rtl::OUString::createFromAscii("S1000") - ,1000 - ,Any()); + m_pConnection->throwGenericSQLException(STR_INVALID_PARA_COUNT,*this); m_pResultSet->OpenImpl(); m_pResultSet->setMetaData(getMetaData()); diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index f047fc4597..aad78bf644 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: FResultSet.cxx,v $ - * $Revision: 1.102 $ + * $Revision: 1.102.30.1 $ * * This file is part of OpenOffice.org. * @@ -36,13 +36,9 @@ #include <iostream> #endif #include "connectivity/sdbcx/VColumn.hxx" -#ifndef _CONNECTIVITY_FILE_ORESULTSET_HXX_ #include "file/FResultSet.hxx" -#endif #include "file/FResultSetMetaData.hxx" -#ifndef _COM_SUN_STAR_SQLC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> -#endif #include <com/sun/star/sdbc/ColumnValue.hpp> #include <comphelper/property.hxx> #include <com/sun/star/lang/DisposedException.hpp> @@ -53,20 +49,19 @@ #include "connectivity/dbconversion.hxx" #include "connectivity/dbtools.hxx" #include <cppuhelper/propshlp.hxx> -#ifndef _ITERATOR_ #include <iterator> -#endif #include <tools/debug.hxx> #include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/sdbc/FetchDirection.hpp> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <com/sun/star/sdbcx/XIndexesSupplier.hpp> - #include <algorithm> #include <comphelper/extract.hxx> #include "connectivity/dbexception.hxx" #include <comphelper/types.hxx> +#include "resource/file_res.hrc" +#include "resource/sharedresources.hxx" using namespace ::comphelper; @@ -88,6 +83,16 @@ using namespace com::sun::star::container; #else #define MAX_KEYSET_SIZE 0x40000 // 256K #endif + +namespace +{ + void lcl_throwError(sal_uInt16 _nErrorId,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xContext) + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sMessage = aResources.getResourceString(_nErrorId); + ::dbtools::throwGenericSQLException(sMessage ,_xContext); + } +} //------------------------------------------------------------------------------ IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.drivers.file.ResultSet","com.sun.star.sdbc.ResultSet"); DBG_NAME( file_OResultSet ) @@ -602,7 +607,8 @@ void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) checkDisposed(OResultSet_BASE::rBHelper.bDisposed); if(!m_pTable || m_pTable->isReadOnly()) - ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii( "Table is readonly."), *this ); + lcl_throwError(STR_TABLE_READONLY,*this); + m_bRowUpdated = m_pTable->UpdateRow(m_aInsertRow.getBody(), m_aRow,m_xColsIdx); *(*m_aInsertRow)[0] = (sal_Int32)(*m_aRow)[0]->getValue(); @@ -616,11 +622,11 @@ void SAL_CALL OResultSet::deleteRow() throw(SQLException, RuntimeException) if(!m_pTable || m_pTable->isReadOnly()) - ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii( "Table is readonly." ), *this ); + lcl_throwError(STR_TABLE_READONLY,*this); if (m_bShowDeleted) - ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii( "Row could not be deleted. The option \"Display inactive records\" is set."), *this ); + lcl_throwError(STR_DELETE_ROW,*this); if(m_aRow->isDeleted()) - ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii( "Row was already deleted."), *this ); + lcl_throwError(STR_ROW_ALREADY_DELETED,*this); sal_Int32 nPos = (sal_Int32)(*m_aRow)[0]->getValue(); m_bRowDeleted = m_pTable->DeleteRow(m_xColumns.getBody()); @@ -661,7 +667,7 @@ void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeExcepti checkDisposed(OResultSet_BASE::rBHelper.bDisposed); if(!m_pTable || m_pTable->isReadOnly()) - ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii( "Table is readonly!" ), *this ); + lcl_throwError(STR_TABLE_READONLY,*this); m_bInserted = sal_True; @@ -1272,14 +1278,10 @@ BOOL OResultSet::OpenImpl() { const OSQLTables& xTabs = m_aSQLIterator.getTables(); if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is()) - throwGenericSQLException( ::rtl::OUString::createFromAscii("The statement is invalid."), - static_cast<XWeak*>(this), - makeAny( m_aSQLIterator.getErrors() ) - ); + lcl_throwError(STR_QUERY_TOO_COMPLEX,*this); + if ( xTabs.size() > 1 || m_aSQLIterator.hasErrors() ) - throwGenericSQLException( ::rtl::OUString::createFromAscii("The statement is invalid. it contains more than one table."), - static_cast<XWeak*>(this), - makeAny( m_aSQLIterator.getErrors() ) ); + lcl_throwError(STR_QUERY_MORE_TABLES,*this); OSQLTable xTable = xTabs.begin()->second; m_xColumns = m_aSQLIterator.getSelectColumns(); @@ -1323,7 +1325,8 @@ BOOL OResultSet::OpenImpl() if(isCount()) { if(m_xColumns->size() > 1) - throwGenericSQLException(::rtl::OUString::createFromAscii("Count can only be used as single column!"),*this ); + lcl_throwError(STR_QUERY_COMPLEX_COUNT,*this); + m_nRowCountResult = 0; // Vorlaeufig einfach ueber alle Datensaetze iterieren und // dabei die Aktionen bearbeiten (bzw. einfach nur zaehlen): diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index e1a032487f..eb60975c26 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: FStatement.cxx,v $ - * $Revision: 1.44 $ + * $Revision: 1.44.56.1 $ * * This file is part of OpenOffice.org. * @@ -34,9 +34,7 @@ #include "file/FStatement.hxx" #include "file/FConnection.hxx" #include "file/FDriver.hxx" -#ifndef _CONNECTIVITY_FILE_ORESULTSET_HXX_ #include "file/FResultSet.hxx" -#endif #include <comphelper/property.hxx> #include <comphelper/uno3.hxx> #include <osl/thread.h> @@ -47,6 +45,7 @@ #include <comphelper/sequence.hxx> #include <cppuhelper/typeprovider.hxx> #include "connectivity/dbexception.hxx" +#include "resource/file_res.hrc" #include <algorithm> #include <tools/debug.hxx> @@ -373,7 +372,7 @@ Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeExcep // ----------------------------------------------------------------------------- OSQLAnalyzer* OStatement_Base::createAnalyzer() { - return new OSQLAnalyzer(); + return new OSQLAnalyzer(m_pConnection); } // ----------------------------------------------------------------------------- void OStatement_Base::anylizeSQL() @@ -468,31 +467,23 @@ void OStatement_Base::construct(const ::rtl::OUString& sql) throw(SQLException, // sanity checks if ( xTabs.empty() ) // no tables -> nothing to operate on -> error - throwGenericSQLException( ::rtl::OUString::createFromAscii("The statement is invalid. It contains no valid table."), - static_cast<XWeak*>(this), - makeAny( m_aSQLIterator.getErrors() ) ); + m_pConnection->throwGenericSQLException(STR_QUERY_NO_TABLE,*this); if ( xTabs.size() > 1 || m_aSQLIterator.hasErrors() ) // more than one table -> can't operate on them -> error - throwGenericSQLException( ::rtl::OUString::createFromAscii("The statement is invalid. It contains more than one table."), - static_cast<XWeak*>(this), - makeAny( m_aSQLIterator.getErrors() ) ); + m_pConnection->throwGenericSQLException(STR_QUERY_MORE_TABLES,*this); if ( (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT) && m_aSQLIterator.getSelectColumns()->empty() ) // SELECT statement without columns -> error - throwGenericSQLException( ::rtl::OUString::createFromAscii("The statement is invalid. It contains no valid column names."), - static_cast<XWeak*>(this), - makeAny( m_aSQLIterator.getErrors() ) ); + m_pConnection->throwGenericSQLException(STR_QUERY_NO_COLUMN,*this); if ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_CREATE_TABLE ) // CREATE TABLE is not supported at all - throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The \"CREATE TABLE\" of statement is not supported.")), - static_cast<XWeak*>(this)); + m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this); if ( ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_ODBC_CALL ) || ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_UNKNOWN ) ) // ODBC call or unknown statement type -> error - throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("This kind of statement is not supported.")), - static_cast<XWeak*>(this)); + m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this); // at this moment we support only one table per select statement Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xTabs.begin()->second,UNO_QUERY); diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx index 82c14babdc..3cc089206c 100644 --- a/connectivity/source/drivers/file/fanalyzer.cxx +++ b/connectivity/source/drivers/file/fanalyzer.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: fanalyzer.cxx,v $ - * $Revision: 1.26 $ + * $Revision: 1.26.56.1 $ * * This file is part of OpenOffice.org. * @@ -37,7 +37,8 @@ #include <comphelper/extract.hxx> #include "connectivity/sqlnode.hxx" #include "connectivity/dbexception.hxx" - +#include "file/FConnection.hxx" +#include "resource/file_res.hrc" using namespace ::connectivity; using namespace ::connectivity::file; @@ -48,8 +49,9 @@ using namespace ::com::sun::star::container; DBG_NAME( file_OSQLAnalyzer ) //------------------------------------------------------------------ -OSQLAnalyzer::OSQLAnalyzer() - :m_bHasSelectionCode(sal_False) +OSQLAnalyzer::OSQLAnalyzer(OConnection* _pConnection) + :m_pConnection(_pConnection) + ,m_bHasSelectionCode(sal_False) ,m_bSelectionFirstTime(sal_True) { DBG_CTOR( file_OSQLAnalyzer, NULL ); @@ -98,7 +100,7 @@ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode) } else if ( ( SQL_ISRULE(pColumnRef,general_set_fct) && pColumnRef->count() != 4 ) ) { - ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Statement too complex. Only \"COUNT(*)\" is supported.")),NULL); + m_pConnection->throwGenericSQLException(STR_QUERY_COMPLEX_COUNT,NULL); } else m_aSelectionEvaluations.push_back( TPredicates() ); diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index ce23b0adea..9436510087 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: fcomp.cxx,v $ - * $Revision: 1.30 $ + * $Revision: 1.30.30.2 $ * * This file is part of OpenOffice.org. * @@ -42,10 +42,11 @@ #include "connectivity/dbexception.hxx" #include "connectivity/dbconversion.hxx" #include <com/sun/star/sdb/SQLFilterOperator.hpp> - +#include "resource/file_res.hrc" #include "file/FStringFunctions.hxx" #include "file/FDateFunctions.hxx" #include "file/FNumericFunctions.hxx" +#include "file/FConnection.hxx" #include <com/sun/star/sdb/SQLFilterOperator.hpp> using namespace connectivity; @@ -112,7 +113,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) OSQLParseNode *pColumnRef = pSelection->getChild(i)->getChild(0); if ( SQL_ISRULE(pColumnRef,general_set_fct) && pColumnRef->count() != 4 ) { - ::dbtools::throwGenericSQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Statement too complex. Only \"COUNT(*)\" is supported.")),NULL); + m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_COMPLEX_COUNT,NULL); } } } @@ -253,7 +254,7 @@ OOperand* OPredicateCompiler::execute_COMPARE(OSQLParseNode* pPredicateNode) th // upper, lower etc. SQL_ISRULE(pPredicateNode->getChild(2),fold)) ) { - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Statement too complex"),NULL); + m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL); return NULL; } @@ -279,44 +280,6 @@ OOperand* OPredicateCompiler::execute_COMPARE(OSQLParseNode* pPredicateNode) th execute(pPredicateNode->getChild(2)); m_aCodeList.push_back( new OOp_COMPARE(ePredicateType) ); - // wenn es sich um eine Vergleichsoperation auf datum/Zeit handelt, dann - // erfolgt jetzt bereits eine Umwandlung fuer die Konstante -// if (pOb) -// { -// switch (pPredicateNode->getChild(2)->getNodeType()) -// { -// case SQL_NODE_STRING: -// { -// OOperandConst* pConst = PTR_CAST(OOperandConst,m_aCodeList[m_aCodeList.size() - 2]); -// switch (pOb->getDBType()) -// { -// case DataType::DECIMAL: -// case DataType::NUMERIC: -// case DataType::REAL: -// case DataType::DOUBLE: -// case DataType::TIMESTAMP: -// case DataType::DATE: -// case DataType::TIME: -// { -// try -// { -// pConst->setValue(makeAny(pConst->getValue().getDouble())); -// } -// catch( Exception&) -// { -// ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Datatype mismatch"),NULL); -// } -// } break; -// case DataType::TINYINT: -// case DataType::SMALLINT: -// case DataType::INTEGER: -// case DataType::BIT: -// ; -// ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Datatype mismatch"),NULL); -// } -// } -// } -// } return NULL; } @@ -337,21 +300,18 @@ OOperand* OPredicateCompiler::execute_LIKE(OSQLParseNode* pPredicateNode) throw( if (!(pAtom->getNodeType() == SQL_NODE_STRING || SQL_ISRULE(pAtom,parameter))) { - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Invalid Statement"),NULL); - return NULL; + m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,NULL); } if (pOptEscape->count() != 0) { if (pOptEscape->count() != 2) { - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Invalid Statement"),NULL); - return NULL; + m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,NULL); } OSQLParseNode *pEscNode = pOptEscape->getChild(1); if (pEscNode->getNodeType() != SQL_NODE_STRING) { - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Invalid Statement"),NULL); - return NULL; + m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,NULL); } else cEscape = pEscNode->getTokenValue().toChar(); @@ -381,8 +341,7 @@ OOperand* OPredicateCompiler::execute_BETWEEN(OSQLParseNode* pPredicateNode) thr && !(p2ndtValue->getNodeType() == SQL_NODE_STRING || SQL_ISRULE(p2ndtValue,parameter)) ) { - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Invalid Statement"),NULL); - return NULL; + m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_INVALID_BETWEEN,NULL); } sal_Bool bNot = SQL_ISTOKEN(pPredicateNode->getChild(1),NOT); @@ -489,9 +448,11 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr if(!m_orgColumns->hasByName(aColumnName)) { - ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Column not found: "); - sMsg += aColumnName; - ::dbtools::throwGenericSQLException( sMsg, NULL ); + const ::rtl::OUString sError( m_pAnalyzer->getConnection()->getResources().getResourceStringWithSubstitution( + STR_INVALID_COLUMNNAME, + "$columnname$", aColumnName + ) ); + ::dbtools::throwGenericSQLException( sError, NULL ); } ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCol; try @@ -502,7 +463,11 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr } else {// Column existiert nicht im Resultset - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Invalid Statement"),NULL); + const ::rtl::OUString sError( m_pAnalyzer->getConnection()->getResources().getResourceStringWithSubstitution( + STR_INVALID_COLUMNNAME, + "$columnname$", aColumnName + ) ); + ::dbtools::throwGenericSQLException( sError, NULL ); } } catch(Exception &) @@ -559,7 +524,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr } } else - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Statement too complex"),NULL); + m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL); } else if( SQL_ISRULE(pPredicateNode,fold) ) @@ -579,7 +544,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr } else { - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Statement too complex"),NULL); + m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,NULL); } if (pOperand) m_aCodeList.push_back(pOperand); @@ -942,7 +907,7 @@ OOperand* OPredicateCompiler::executeFunction(OSQLParseNode* pPredicateNode) thr pOperator = new OOp_Locate(); break; default: - ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Function not supported, yet."),NULL); + m_pAnalyzer->getConnection()->throwGenericSQLException(STR_QUERY_FUNCTION_NOT_SUPPORTED,NULL); } m_aCodeList.push_back(pOperator); diff --git a/connectivity/source/drivers/flat/EDriver.cxx b/connectivity/source/drivers/flat/EDriver.cxx index f6b9fe91fc..b493c53aad 100644 --- a/connectivity/source/drivers/flat/EDriver.cxx +++ b/connectivity/source/drivers/flat/EDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: EDriver.cxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.56.1 $ * * This file is part of OpenOffice.org. * @@ -35,6 +35,8 @@ #include <com/sun/star/lang/DisposedException.hpp> #include "connectivity/dbexception.hxx" #include <comphelper/sequence.hxx> +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" using namespace connectivity::flat; @@ -136,7 +138,9 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::O return ::comphelper::concatSequences(OFileDriver::getPropertyInfo(url,info ), 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/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx index a14be65857..37eda3922d 100644 --- a/connectivity/source/drivers/hsqldb/HConnection.cxx +++ b/connectivity/source/drivers/hsqldb/HConnection.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: HConnection.cxx,v $ - * $Revision: 1.12 $ + * $Revision: 1.11.56.3 $ * * This file is part of OpenOffice.org. * @@ -56,6 +56,9 @@ #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> +#include "resource/sharedresources.hxx" +#include "resource/hsqldb_res.hrc" + /** === begin UNO using === **/ using ::com::sun::star::util::XFlushListener; using ::com::sun::star::lang::EventObject; @@ -239,12 +242,16 @@ namespace connectivity { namespace hsqldb return NULL; if ( !_DocumentUI.is() ) + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_NO_DOCUMENTUI)); throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The provided DocumentUI is not allowed to be NULL." ) ), + sError, *this, 0 ); - // TODO: resource + } // if ( !_DocumentUI.is() ) + // Reference< XExecutableDialog > xEditor = impl_createLinkedTableEditor_throw( _DocumentUI, _TableName ); // return xEditor.get(); @@ -266,9 +273,9 @@ namespace connectivity { namespace hsqldb catch( const RuntimeException& ) { throw; } catch( const Exception& ) { - throw WrappedTargetException( ::rtl::OUString::createFromAscii( "error while obtaining the connection's table container" ), - *this, ::cppu::getCaughtException() ); - // TODO: resource + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_NO_TABLE_CONTAINER)); + throw WrappedTargetException( sError ,*this, ::cppu::getCaughtException() ); } OSL_POSTCOND( xTables.is(), "OHsqlConnection::impl_getTableContainer_throw: post condition not met!" ); @@ -306,9 +313,9 @@ namespace connectivity { namespace hsqldb catch( const RuntimeException& ) { throw; } catch( const Exception& ) { - throw WrappedTargetException( ::rtl::OUString::createFromAscii( "error while creating the table editor dialog" ), - *this, ::cppu::getCaughtException() ); - // TODO: resource + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_NO_TABLE_EDITOR_DIALOG)); + throw WrappedTargetException( sError ,*this, ::cppu::getCaughtException() ); } return xDialog; } @@ -332,9 +339,14 @@ namespace connectivity { namespace hsqldb } if ( !bDoesExist ) - throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "There is no table named " ) ) + _rTableName, - *this, 0 ); - // TODO: resource + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_NO_TABLENAME, + "$tablename$", _rTableName + )); + throw IllegalArgumentException( sError,*this, 0 ); + } // if ( !bDoesExist ) } // ------------------------------------------------------------------- diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index b60cc241cc..243aa6b802 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: HDriver.cxx,v $ - * $Revision: 1.28 $ + * $Revision: 1.28.56.1 $ * * This file is part of OpenOffice.org. * @@ -55,6 +55,8 @@ #include <connectivity/dbexception.hxx> #include <comphelper/namedvaluecollection.hxx> #include <unotools/confignode.hxx> +#include "resource/hsqldb_res.hrc" +#include "resource/sharedresources.hxx" //........................................................................ namespace connectivity @@ -198,19 +200,21 @@ namespace connectivity } if ( !xStorage.is() || !sURL.getLength() ) - throw SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No storage property was set.")) - ,*this - ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HY0000")) - ,1000,Any()); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sMessage = aResources.getResourceString(STR_NO_STROAGE); + ::dbtools::throwGenericSQLException(sMessage ,*this); + } ::rtl::OUString sSystemPath; osl_getSystemPathFromFileURL( sURL.pData, &sSystemPath.pData ); sal_Int32 nIndex = sSystemPath.lastIndexOf('.'); if ( !sURL.getLength() || !sSystemPath.getLength() ) - throw SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The file URL is not correct.")) - ,*this - ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HY0000")) - ,1000,Any()); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sMessage = aResources.getResourceString(STR_INVALID_FILE_URL); + ::dbtools::throwGenericSQLException(sMessage ,*this); + } bool bIsNewDatabase = !xStorage->hasElements(); @@ -415,8 +419,12 @@ namespace connectivity Reference< XTablesSupplier > SAL_CALL ODriverDelegator::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw (SQLException, RuntimeException) { if ( ! acceptsURL(url) ) - ::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 getDataDefinitionByConnection(connect(url,info)); } diff --git a/connectivity/source/drivers/hsqldb/HUser.cxx b/connectivity/source/drivers/hsqldb/HUser.cxx index 0e841ee43c..41a97c0942 100644 --- a/connectivity/source/drivers/hsqldb/HUser.cxx +++ b/connectivity/source/drivers/hsqldb/HUser.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: HUser.cxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.6.56.2 $ * * This file is part of OpenOffice.org. * @@ -38,6 +38,7 @@ #include <com/sun/star/sdbcx/Privilege.hpp> #include <com/sun/star/sdbcx/PrivilegeObject.hpp> #include "TConnection.hxx" +#include "resource/hsqldb_res.hrc" using namespace connectivity; using namespace connectivity::hsqldb; @@ -227,7 +228,12 @@ sal_Int32 SAL_CALL OHSQLUser::getGrantablePrivileges( const ::rtl::OUString& obj void SAL_CALL OHSQLUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException) { if ( objType != PrivilegeObject::TABLE ) - ::dbtools::throwSQLException( "Privilege not granted: Only table privileges can be granted", "01007", *this ); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_GRANTED)); + ::dbtools::throwGenericSQLException(sError,*this); + } // if ( objType != PrivilegeObject::TABLE ) + ::osl::MutexGuard aGuard(m_aMutex); @@ -253,7 +259,11 @@ void SAL_CALL OHSQLUser::grantPrivileges( const ::rtl::OUString& objName, sal_In void SAL_CALL OHSQLUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException) { if ( objType != PrivilegeObject::TABLE ) - ::dbtools::throwSQLException( "Privilege not revoked: Only table privileges can be revoked", "01006", *this ); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_REVOKED)); + ::dbtools::throwGenericSQLException(sError,*this); + } // if ( objType != PrivilegeObject::TABLE ) ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx index 6f0085cda1..e180db8e19 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 f84ca99562..4ec3f5de67 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 5ac411a167..5dfa4c4f6e 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 046cfc0119..8aee9ca368 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); } } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/kab/KDriver.cxx b/connectivity/source/drivers/kab/KDriver.cxx index b8f7bf9deb..59398f2c14 100644 --- a/connectivity/source/drivers/kab/KDriver.cxx +++ b/connectivity/source/drivers/kab/KDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: KDriver.cxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.56.2 $ * * This file is part of OpenOffice.org. * @@ -42,6 +42,8 @@ /** === end UNO includes === **/ #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> +#include "resource/kab_res.hrc" +#include "resource/sharedresources.hxx" using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -216,20 +218,23 @@ bool KabImplModule::impl_doAllowNewKDEVersion() // -------------------------------------------------------------------------------- void KabImplModule::impl_throwNoKdeException() { - impl_throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No suitable KDE installation was found." ) ) ); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString( + STR_NO_KDE_INST + ) ); + impl_throwGenericSQLException( sError ); } // -------------------------------------------------------------------------------- void KabImplModule::impl_throwKdeTooOldException() { - ::rtl::OUStringBuffer aMessage; - aMessage.appendAscii( "KDE version " ); - aMessage.append( (sal_Int32)MIN_KDE_VERSION_MAJOR ); - aMessage.append( (sal_Unicode)'.' ); - aMessage.append( (sal_Int32)MIN_KDE_VERSION_MINOR ); - aMessage.appendAscii( " or higher is required to access the KDE Address Book." ); - - impl_throwGenericSQLException( aMessage.makeStringAndClear() ); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_KDE_VERSION_TOO_OLD, + "$major$",::rtl::OUString::valueOf((sal_Int32)MIN_KDE_VERSION_MAJOR), + "$minor$",::rtl::OUString::valueOf((sal_Int32)MIN_KDE_VERSION_MINOR) + ) ); + impl_throwGenericSQLException( sError ); } // -------------------------------------------------------------------------------- @@ -245,21 +250,20 @@ void KabImplModule::impl_throwGenericSQLException( const ::rtl::OUString& _rMess // -------------------------------------------------------------------------------- void KabImplModule::impl_throwKdeTooNewException() { - ::rtl::OUStringBuffer aMessage; - aMessage.appendAscii( "The found KDE version is too new. Only KDE up to version " ); - aMessage.append( (sal_Int32)MAX_KDE_VERSION_MAJOR ); - aMessage.append( (sal_Unicode)'.' ); - aMessage.append( (sal_Int32)MAX_KDE_VERSION_MINOR ); - aMessage.appendAscii( " is known to work with this product.\n" ); + ::connectivity::SharedResources aResources; SQLException aError; - aError.Message = aMessage.makeStringAndClear(); + aError.Message = aResources.getResourceStringWithSubstitution( + STR_KDE_VERSION_TOO_NEW, + "$major$",::rtl::OUString::valueOf((sal_Int32)MIN_KDE_VERSION_MAJOR), + "$minor$",::rtl::OUString::valueOf((sal_Int32)MIN_KDE_VERSION_MINOR) + ); aError.SQLState = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "S1000" ) ); aError.ErrorCode = 0; SQLContext aDetails; - aMessage.appendAscii( "If you are sure that your KDE version works, " ); - aMessage.appendAscii( "you might execute the following Basic macro to disable this version check:\n\n" ); + ::rtl::OUStringBuffer aMessage; + aMessage.append( aResources.getResourceString(STR_KDE_VERSION_TOO_NEW_WORK_AROUND) ); aMessage.appendAscii( "Sub disableKDEMaxVersionCheck\n" ); aMessage.appendAscii( " BasicLibraries.LoadLibrary( \"Tools\" )\n" ); diff --git a/connectivity/source/drivers/kab/KPreparedStatement.cxx b/connectivity/source/drivers/kab/KPreparedStatement.cxx index d83975479d..f7c7fcf384 100644 --- a/connectivity/source/drivers/kab/KPreparedStatement.cxx +++ b/connectivity/source/drivers/kab/KPreparedStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: KPreparedStatement.cxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.56.2 $ * * This file is part of OpenOffice.org. * @@ -34,6 +34,8 @@ #include "KPreparedStatement.hxx" #include "propertyids.hxx" #include <connectivity/dbexception.hxx> +#include "resource/kab_res.hrc" +#include "resource/sharedresources.hxx" using namespace connectivity::kab; using namespace com::sun::star::uno; @@ -49,10 +51,7 @@ void KabPreparedStatement::checkAndResizeParameters(sal_Int32 nParams) throw(SQL m_aParameterRow = new OValueVector(); if (nParams < 1) - ::dbtools::throwSQLException( - "SQL statement parameters are numbered starting at 1.", - ::dbtools::SQL_INVALID_DESCRIPTOR_INDEX, - *(KabPreparedStatement *) this); + ::dbtools::throwInvalidIndexException(*(KabPreparedStatement *) this,Any()); if (nParams >= (sal_Int32) (*m_aParameterRow).size()) (*m_aParameterRow).resize(nParams); @@ -65,9 +64,11 @@ void KabPreparedStatement::setKabFields() const throw(SQLException) xColumns = m_aSQLIterator.getSelectColumns(); if (!xColumns.isValid()) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Invalid selection of columns"), - NULL); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString( + STR_INVALID_COLUMN_SELECTION + ) ); + ::dbtools::throwGenericSQLException(sError,NULL); } m_xMetaData->setKabFields(xColumns); } @@ -80,10 +81,13 @@ void KabPreparedStatement::resetParameters() const throw(SQLException) void KabPreparedStatement::getNextParameter(::rtl::OUString &rParameter) const throw(SQLException) { if (m_nParameterIndex >= (sal_Int32) (*m_aParameterRow).size()) - ::dbtools::throwSQLException( - "More parameters in SQL statement than set.", - ::dbtools::SQL_INVALID_DESCRIPTOR_INDEX, - *(KabPreparedStatement *) this); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString( + STR_INVALID_PARA_COUNT + ) ); + ::dbtools::throwGenericSQLException(sError,*(KabPreparedStatement *) this); + } // if (m_nParameterIndex >= (sal_Int32) (*m_aParameterRow).size()) rParameter = (*m_aParameterRow)[m_nParameterIndex]; @@ -197,66 +201,66 @@ void SAL_CALL KabPreparedStatement::setNull(sal_Int32 parameterIndex, sal_Int32) // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setObjectNull(sal_Int32, sal_Int32, const ::rtl::OUString&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setObjectNull", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setBoolean(sal_Int32, sal_Bool) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setBoolean", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setByte(sal_Int32, sal_Int8) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setByte", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setShort(sal_Int32, sal_Int16) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setShort", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setInt(sal_Int32, sal_Int32) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setInt", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setLong(sal_Int32, sal_Int64) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setFloat(sal_Int32, float) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setFloat", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setDouble(sal_Int32, double) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setDouble", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setString(sal_Int32 parameterIndex, const ::rtl::OUString &x) throw(SQLException, RuntimeException) @@ -271,103 +275,103 @@ void SAL_CALL KabPreparedStatement::setString(sal_Int32 parameterIndex, const :: // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setBytes(sal_Int32, const Sequence< sal_Int8 >&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setBytes", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setDate(sal_Int32, const Date&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setDate", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setTime(sal_Int32, const Time&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setTime", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setTimestamp(sal_Int32, const DateTime&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setTimestamp", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setBinaryStream(sal_Int32, const Reference< ::com::sun::star::io::XInputStream >&, sal_Int32) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setBinaryStream", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setCharacterStream(sal_Int32, const Reference< ::com::sun::star::io::XInputStream >&, sal_Int32) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setCharacterStream", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setObject(sal_Int32, const Any&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setObject", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setObjectWithInfo(sal_Int32, const Any&, sal_Int32, sal_Int32) throw(SQLException, RuntimeException) { - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); - ::osl::MutexGuard aGuard( m_aMutex ); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setObjectWithInfo", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setRef(sal_Int32, const Reference< XRef >&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setRef", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setBlob(sal_Int32, const Reference< XBlob >&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setBlob", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setClob(sal_Int32, const Reference< XClob >&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setClob", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::setArray(sal_Int32, const Reference< XArray >&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setArray", NULL); } // ------------------------------------------------------------------------- void SAL_CALL KabPreparedStatement::clearParameters() throw(SQLException, RuntimeException) { -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("clearParameters", NULL); } // ------------------------------------------------------------------------- void KabPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) diff --git a/connectivity/source/drivers/kab/KResultSet.cxx b/connectivity/source/drivers/kab/KResultSet.cxx index 2bf0c7be48..1455fd2b94 100644 --- a/connectivity/source/drivers/kab/KResultSet.cxx +++ b/connectivity/source/drivers/kab/KResultSet.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: KResultSet.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.46.2 $ * * This file is part of OpenOffice.org. * @@ -41,6 +41,8 @@ #include <com/sun/star/sdbcx/CompareBookmark.hpp> #include "TConnection.hxx" #include <connectivity/dbexception.hxx> +#include "resource/kab_res.hrc" +#include "resource/sharedresources.hxx" using namespace connectivity::kab; using namespace cppu; @@ -174,9 +176,13 @@ sal_Int32 SAL_CALL KabResultSet::findColumn(const ::rtl::OUString& columnName) t columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) return i; - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Invalid column name: ") + columnName, - NULL); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_INVALID_COLUMNNAME, + "$columnname$",columnName + ) ); + ::dbtools::throwGenericSQLException(sError,NULL); + // Unreachable: OSL_ASSERT(false); return 0; @@ -224,7 +230,7 @@ sal_Bool SAL_CALL KabResultSet::getBoolean(sal_Int32) throw(SQLException, Runtim ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getBoolean", NULL); return sal_False; } @@ -234,7 +240,7 @@ sal_Int8 SAL_CALL KabResultSet::getByte(sal_Int32) throw(SQLException, RuntimeEx ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getByte", NULL); sal_Int8 nRet = 0; return nRet; @@ -245,7 +251,7 @@ sal_Int16 SAL_CALL KabResultSet::getShort(sal_Int32) throw(SQLException, Runtime ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getShort", NULL); sal_Int16 nRet = 0; return nRet; @@ -256,7 +262,7 @@ sal_Int32 SAL_CALL KabResultSet::getInt(sal_Int32) throw(SQLException, RuntimeEx ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getInt", NULL); sal_Int32 nRet = 0; return nRet; @@ -267,7 +273,7 @@ sal_Int64 SAL_CALL KabResultSet::getLong(sal_Int32) throw(SQLException, RuntimeE ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getLong", NULL); return sal_Int64(); } @@ -277,7 +283,7 @@ float SAL_CALL KabResultSet::getFloat(sal_Int32) throw(SQLException, RuntimeExce ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getFloat", NULL); float nVal(0); return nVal; @@ -288,7 +294,7 @@ double SAL_CALL KabResultSet::getDouble(sal_Int32) throw(SQLException, RuntimeEx ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getDouble", NULL); double nRet = 0; return nRet; @@ -299,7 +305,7 @@ Sequence< sal_Int8 > SAL_CALL KabResultSet::getBytes(sal_Int32) throw(SQLExcepti ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("", NULL); return Sequence< sal_Int8 >(); } @@ -309,7 +315,7 @@ Date SAL_CALL KabResultSet::getDate(sal_Int32) throw(SQLException, RuntimeExcept ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getDate", NULL); Date aRet; return aRet; @@ -320,7 +326,7 @@ Time SAL_CALL KabResultSet::getTime(sal_Int32) throw(SQLException, RuntimeExcept ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getTime", NULL); Time nRet; return nRet; @@ -371,7 +377,7 @@ Reference< XInputStream > SAL_CALL KabResultSet::getBinaryStream(sal_Int32) thro ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getBinaryStream", NULL); return NULL; } @@ -381,7 +387,7 @@ Reference< XInputStream > SAL_CALL KabResultSet::getCharacterStream(sal_Int32) t ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getCharacterStream", NULL); return NULL; } @@ -391,7 +397,7 @@ Any SAL_CALL KabResultSet::getObject(sal_Int32, const Reference< ::com::sun::sta ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getObject", NULL); return Any(); } @@ -401,7 +407,7 @@ Reference< XRef > SAL_CALL KabResultSet::getRef(sal_Int32) throw(SQLException, R ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getRef", NULL); return NULL; } @@ -411,7 +417,7 @@ Reference< XBlob > SAL_CALL KabResultSet::getBlob(sal_Int32) throw(SQLException, ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getBlob", NULL); return NULL; } @@ -421,7 +427,7 @@ Reference< XClob > SAL_CALL KabResultSet::getClob(sal_Int32) throw(SQLException, ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getClob", NULL); return NULL; } @@ -431,7 +437,7 @@ Reference< XArray > SAL_CALL KabResultSet::getArray(sal_Int32) throw(SQLExceptio ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getArray", NULL); return NULL; } diff --git a/connectivity/source/drivers/kab/KStatement.cxx b/connectivity/source/drivers/kab/KStatement.cxx index 5ea1f678cc..d612b77976 100644 --- a/connectivity/source/drivers/kab/KStatement.cxx +++ b/connectivity/source/drivers/kab/KStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: KStatement.cxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.56.1 $ * * This file is part of OpenOffice.org. * @@ -40,6 +40,9 @@ #include "korder.hxx" #include "TConnection.hxx" #include <connectivity/dbexception.hxx> +#include "resource/kab_res.hrc" +#include "resource/sharedresources.hxx" + #if OSL_DEBUG_LEVEL > 0 # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) @@ -57,6 +60,16 @@ using namespace com::sun::star::container; using namespace com::sun::star::io; using namespace com::sun::star::util; +namespace +{ + void lcl_throwError(sal_uInt16 _nErrorId) + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(_nErrorId) ); + ::dbtools::throwGenericSQLException(sError,NULL); + } +} + IMPLEMENT_SERVICE_INFO(KabStatement, "com.sun.star.sdbc.drivers.KabStatement", "com.sun.star.sdbc.Statement"); //------------------------------------------------------------------------------ KabCommonStatement::KabCommonStatement(KabConnection* _pConnection ) @@ -82,16 +95,12 @@ void KabCommonStatement::disposing() // ----------------------------------------------------------------------------- void KabCommonStatement::resetParameters() const throw(::com::sun::star::sdbc::SQLException) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Parameters can appear only in prepared statements."), - NULL); + lcl_throwError(STR_PARA_ONLY_PREPARED); } // ----------------------------------------------------------------------------- void KabCommonStatement::getNextParameter(::rtl::OUString &) const throw(::com::sun::star::sdbc::SQLException) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Parameters can appear only in prepared statements."), - NULL); + lcl_throwError(STR_PARA_ONLY_PREPARED); } // ----------------------------------------------------------------------------- KabCondition *KabCommonStatement::analyseWhereClause(const OSQLParseNode *pParseNode) const throw(SQLException) @@ -232,9 +241,9 @@ KabCondition *KabCommonStatement::analyseWhereClause(const OSQLParseNode *pParse } } } - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Syntax error or keyword not recognized."), - NULL); + + lcl_throwError(STR_QUERY_TOO_COMPLEX); + // Unreachable: OSL_ASSERT(false); return 0; @@ -282,9 +291,7 @@ KabOrder *KabCommonStatement::analyseOrderByClause(const OSQLParseNode *pParseNo } } } - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Syntax error or keyword not recognized."), - NULL); + lcl_throwError(STR_QUERY_TOO_COMPLEX); // Unreachable: OSL_ASSERT(false); return 0; @@ -311,9 +318,7 @@ void KabCommonStatement::setKabFields(KabResultSet *pResult) const throw(SQLExce xColumns = m_aSQLIterator.getSelectColumns(); if (!xColumns.isValid()) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Invalid selection of columns"), - NULL); + lcl_throwError(STR_INVALID_COLUMN_SELECTION); } pMeta = static_cast<KabResultSetMetaData *>(pResult->getMetaData().get()); pMeta->setKabFields(xColumns); @@ -444,9 +449,7 @@ OSL_TRACE("KDE Address book - SQL Request: %s", OUtoCStr(sql)); // To be continued: UPDATE // DELETE // etc... - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Unsupported SQL statement"), - NULL); + lcl_throwError(STR_QUERY_TOO_COMPLEX); } return xRS; diff --git a/connectivity/source/drivers/kab/kfields.cxx b/connectivity/source/drivers/kab/kfields.cxx index b2aa610e35..6e5eaa378b 100644 --- a/connectivity/source/drivers/kab/kfields.cxx +++ b/connectivity/source/drivers/kab/kfields.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: kfields.cxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.56.1 $ * * This file is part of OpenOffice.org. * @@ -32,6 +32,8 @@ #include "precompiled_connectivity.hxx" #include "kfields.hxx" +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" using namespace ::connectivity::kab; using namespace ::com::sun::star::sdbc; @@ -80,9 +82,12 @@ sal_uInt32 findKabField(const ::rtl::OUString& columnName) throw(SQLException) return nResult; } - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Invalid column name: ") + columnName, - NULL); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_INVALID_COLUMNNAME, + "$columnname$",columnName + ) ); + ::dbtools::throwGenericSQLException(sError,NULL); // Unreachable: OSL_ASSERT(false); return 0; diff --git a/connectivity/source/drivers/kab/makefile.mk b/connectivity/source/drivers/kab/makefile.mk index ebd9be9679..87228f89ba 100644 --- a/connectivity/source/drivers/kab/makefile.mk +++ b/connectivity/source/drivers/kab/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.8 $ +# $Revision: 1.8.56.1 $ # # This file is part of OpenOffice.org. # @@ -71,6 +71,7 @@ SHL1OBJS=$(SLOFILES) SHL1STDLIBS=\ $(CPPULIB) \ $(CPPUHELPERLIB) \ + $(DBTOOLSLIB) \ $(SALLIB) SHL1DEPN= diff --git a/connectivity/source/drivers/macab/MacabDriver.cxx b/connectivity/source/drivers/macab/MacabDriver.cxx index 2e794ca965..46b8ffcbe5 100755 --- a/connectivity/source/drivers/macab/MacabDriver.cxx +++ b/connectivity/source/drivers/macab/MacabDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MacabDriver.cxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.56.1 $ * * This file is part of OpenOffice.org. * @@ -41,6 +41,7 @@ /** === end UNO includes === **/ #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> +#include "resource/macab_res.hrc" using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -144,7 +145,11 @@ void MacabImplModule::init() // -------------------------------------------------------------------------------- void MacabImplModule::impl_throwNoMacOSException() { - impl_throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No suitable Mac OS installation was found." ) ) ); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString( + STR_NO_MAC_OS_FOUND + ) ); + impl_throwGenericSQLException( sError ); } // -------------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/macab/MacabPreparedStatement.cxx b/connectivity/source/drivers/macab/MacabPreparedStatement.cxx index a7a8969fd8..b64f3947d3 100755 --- a/connectivity/source/drivers/macab/MacabPreparedStatement.cxx +++ b/connectivity/source/drivers/macab/MacabPreparedStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MacabPreparedStatement.cxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.56.2 $ * * This file is part of OpenOffice.org. * @@ -35,6 +35,8 @@ #include "MacabAddressBook.hxx" #include "propertyids.hxx" #include <connectivity/dbexception.hxx> +#include "resource/macab_res.hrc" +#include "resource/sharedresources.hxx" using namespace connectivity::macab; using namespace com::sun::star::uno; @@ -50,10 +52,7 @@ void MacabPreparedStatement::checkAndResizeParameters(sal_Int32 nParams) throw(S m_aParameterRow = new OValueVector(); if (nParams < 1) - ::dbtools::throwSQLException( - "SQL statement parameters are numbered starting at 1.", - ::dbtools::SQL_INVALID_DESCRIPTOR_INDEX, - *(MacabPreparedStatement *) this); + ::dbtools::throwInvalidIndexException(*(MacabPreparedStatement *) this,Any()); if (nParams >= (sal_Int32) (*m_aParameterRow).size()) (*m_aParameterRow).resize(nParams); @@ -66,9 +65,11 @@ void MacabPreparedStatement::setMacabFields() const throw(SQLException) xColumns = m_aSQLIterator.getSelectColumns(); if (!xColumns.isValid()) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Invalid selection of columns"), - NULL); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString( + STR_INVALID_COLUMN_SELECTION + ) ); + ::dbtools::throwGenericSQLException(sError,NULL); } m_xMetaData->setMacabFields(xColumns); } @@ -81,10 +82,13 @@ void MacabPreparedStatement::resetParameters() const throw(SQLException) void MacabPreparedStatement::getNextParameter(::rtl::OUString &rParameter) const throw(SQLException) { if (m_nParameterIndex >= (sal_Int32) (*m_aParameterRow).size()) - ::dbtools::throwSQLException( - "More parameters in SQL statement than set.", - ::dbtools::SQL_INVALID_DESCRIPTOR_INDEX, - *(MacabPreparedStatement *) this); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString( + STR_INVALID_PARA_COUNT + ) ); + ::dbtools::throwGenericSQLException(sError,*(MacabPreparedStatement *) this); + } rParameter = (*m_aParameterRow)[m_nParameterIndex]; @@ -210,66 +214,66 @@ void SAL_CALL MacabPreparedStatement::setNull(sal_Int32 parameterIndex, sal_Int3 // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setObjectNull(sal_Int32, sal_Int32, const ::rtl::OUString&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setObjectNull", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setBoolean(sal_Int32, sal_Bool) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setBoolean", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setByte(sal_Int32, sal_Int8) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setByte", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setShort(sal_Int32, sal_Int16) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setShort", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setInt(sal_Int32, sal_Int32) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setInt", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setLong(sal_Int32, sal_Int64) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setLong", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setFloat(sal_Int32, float) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setFloat", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setDouble(sal_Int32, double) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setDouble", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setString(sal_Int32 parameterIndex, const ::rtl::OUString &x) throw(SQLException, RuntimeException) @@ -284,103 +288,103 @@ void SAL_CALL MacabPreparedStatement::setString(sal_Int32 parameterIndex, const // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setBytes(sal_Int32, const Sequence< sal_Int8 >&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setBytes", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setDate(sal_Int32, const Date&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setDate", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setTime(sal_Int32, const Time&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setTime", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setTimestamp(sal_Int32, const DateTime&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setTimestamp", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setBinaryStream(sal_Int32, const Reference< ::com::sun::star::io::XInputStream >&, sal_Int32) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setBinaryStream", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setCharacterStream(sal_Int32, const Reference< ::com::sun::star::io::XInputStream >&, sal_Int32) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setCharacterStream", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setObject(sal_Int32, const Any&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setObject", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setObjectWithInfo(sal_Int32, const Any&, sal_Int32, sal_Int32) throw(SQLException, RuntimeException) { - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); - ::osl::MutexGuard aGuard( m_aMutex ); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setObjectWithInfo", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setRef(sal_Int32, const Reference< XRef >&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setRef", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setBlob(sal_Int32, const Reference< XBlob >&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setBlob", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setClob(sal_Int32, const Reference< XClob >&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setClob", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::setArray(sal_Int32, const Reference< XArray >&) throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); + + -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("setArray", NULL); } // ------------------------------------------------------------------------- void SAL_CALL MacabPreparedStatement::clearParameters() throw(SQLException, RuntimeException) { -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("clearParameters", NULL); } // ------------------------------------------------------------------------- void MacabPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) diff --git a/connectivity/source/drivers/macab/MacabResultSet.cxx b/connectivity/source/drivers/macab/MacabResultSet.cxx index 8c81e42c06..25113f9cf3 100755 --- a/connectivity/source/drivers/macab/MacabResultSet.cxx +++ b/connectivity/source/drivers/macab/MacabResultSet.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MacabResultSet.cxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.56.2 $ * * This file is part of OpenOffice.org. * @@ -43,6 +43,8 @@ #include <com/sun/star/sdbcx/CompareBookmark.hpp> #include "TConnection.hxx" #include <connectivity/dbexception.hxx> +#include "resource/sharedresources.hxx" +#include "resource/macab_res.hrc" using namespace connectivity::macab; using namespace cppu; @@ -201,9 +203,12 @@ sal_Int32 SAL_CALL MacabResultSet::findColumn(const ::rtl::OUString& columnName) columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) return i; - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Invalid column name: ") + columnName, - NULL); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_NO_ELEMENT_NAME, + "$name$", columnName + ) ); + ::dbtools::throwGenericSQLException(sError , *this); // Unreachable: OSL_ASSERT(false); return 0; @@ -241,7 +246,7 @@ sal_Bool SAL_CALL MacabResultSet::getBoolean(sal_Int32) throw(SQLException, Runt ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getBoolean", NULL); return sal_False; } @@ -251,7 +256,7 @@ sal_Int8 SAL_CALL MacabResultSet::getByte(sal_Int32) throw(SQLException, Runtime ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getByte", NULL); sal_Int8 nRet = 0; return nRet; @@ -262,7 +267,7 @@ sal_Int16 SAL_CALL MacabResultSet::getShort(sal_Int32) throw(SQLException, Runti ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getShort", NULL); sal_Int16 nRet = 0; return nRet; @@ -389,7 +394,7 @@ Sequence< sal_Int8 > SAL_CALL MacabResultSet::getBytes(sal_Int32) throw(SQLExcep ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getBytes", NULL); return Sequence< sal_Int8 >(); } @@ -399,7 +404,7 @@ Date SAL_CALL MacabResultSet::getDate(sal_Int32) throw(SQLException, RuntimeExce ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getDate", NULL); Date aRet; return aRet; @@ -410,7 +415,7 @@ Time SAL_CALL MacabResultSet::getTime(sal_Int32) throw(SQLException, RuntimeExce ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getTime", NULL); Time nRet; return nRet; @@ -448,7 +453,7 @@ Reference< XInputStream > SAL_CALL MacabResultSet::getBinaryStream(sal_Int32) th ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getBinaryStream", NULL); return NULL; } @@ -458,7 +463,7 @@ Reference< XInputStream > SAL_CALL MacabResultSet::getCharacterStream(sal_Int32) ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getCharacterStream", NULL); return NULL; } @@ -468,7 +473,7 @@ Any SAL_CALL MacabResultSet::getObject(sal_Int32, const Reference< ::com::sun::s ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getObject", NULL); return Any(); } @@ -478,7 +483,7 @@ Reference< XRef > SAL_CALL MacabResultSet::getRef(sal_Int32) throw(SQLException, ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getRef", NULL); return NULL; } @@ -488,7 +493,7 @@ Reference< XBlob > SAL_CALL MacabResultSet::getBlob(sal_Int32) throw(SQLExceptio ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getBlob", NULL); return NULL; } @@ -498,7 +503,7 @@ Reference< XClob > SAL_CALL MacabResultSet::getClob(sal_Int32) throw(SQLExceptio ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getClob", NULL); return NULL; } @@ -508,7 +513,7 @@ Reference< XArray > SAL_CALL MacabResultSet::getArray(sal_Int32) throw(SQLExcept ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(MacabResultSet_BASE::rBHelper.bDisposed); -::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +::dbtools::throwFunctionNotSupportedException("getArray", NULL); return NULL; } diff --git a/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx b/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx index 8feaf69b08..b063fd6ba7 100755 --- a/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx +++ b/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MacabResultSetMetaData.cxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.56.2 $ * * This file is part of OpenOffice.org. * @@ -36,6 +36,7 @@ #include "MacabRecords.hxx" #include "MacabAddressBook.hxx" #include "macabutilities.hxx" +#include "resource/macab_res.hrc" using namespace connectivity::macab; using namespace com::sun::star::uno; @@ -65,10 +66,7 @@ void MacabResultSetMetaData::setMacabFields(const ::vos::ORef<connectivity::OSQL // In case, somehow, we don't have anything with the name m_sTableName if(aRecords == NULL) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("No Such Table!"), - NULL); - return; + impl_throwError(STR_NO_TABLE); } aHeader = aRecords->getHeader(); @@ -102,10 +100,7 @@ sal_Int32 SAL_CALL MacabResultSetMetaData::getColumnType(sal_Int32 column) throw // In case, somehow, we don't have anything with the name m_sTableName if(aRecords == NULL) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("No Such Table!"), - NULL); - return -1; + impl_throwError(STR_NO_TABLE); } aHeader = aRecords->getHeader(); @@ -113,11 +108,7 @@ sal_Int32 SAL_CALL MacabResultSetMetaData::getColumnType(sal_Int32 column) throw if(aField == NULL) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("No column at location: ") + - ::rtl::OUString::valueOf(column), - NULL); - + ::dbtools::throwInvalidIndexException(*this,Any()); return -1; } @@ -150,10 +141,7 @@ sal_Bool SAL_CALL MacabResultSetMetaData::isCaseSensitive(sal_Int32) throw(SQLEx // In case, somehow, we don't have anything with the name m_sTableName if(aRecords == NULL) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("No Such Table!"), - NULL); - return ::rtl::OUString(); + impl_throwError(STR_NO_TABLE); } aHeader = aRecords->getHeader(); diff --git a/connectivity/source/drivers/macab/MacabStatement.cxx b/connectivity/source/drivers/macab/MacabStatement.cxx index bdf68c97a4..29c8477234 100755 --- a/connectivity/source/drivers/macab/MacabStatement.cxx +++ b/connectivity/source/drivers/macab/MacabStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MacabStatement.cxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.56.3 $ * * This file is part of OpenOffice.org. * @@ -41,6 +41,8 @@ #include "macaborder.hxx" #include "TConnection.hxx" #include <connectivity/dbexception.hxx> +#include "resource/sharedresources.hxx" +#include "resource/macab_res.hrc" #if OSL_DEBUG_LEVEL > 0 # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) @@ -58,6 +60,19 @@ using namespace com::sun::star::container; using namespace com::sun::star::io; using namespace com::sun::star::util; +namespace connectivity +{ + namespace macab + { + void impl_throwError(sal_uInt16 _nErrorId) + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(_nErrorId) ); + ::dbtools::throwGenericSQLException(sError,NULL); + } + } +} + IMPLEMENT_SERVICE_INFO(MacabStatement, "com.sun.star.sdbc.drivers.MacabStatement", "com.sun.star.sdbc.Statement"); //------------------------------------------------------------------------------ MacabCommonStatement::MacabCommonStatement(MacabConnection* _pConnection ) @@ -83,20 +98,12 @@ void MacabCommonStatement::disposing() // ----------------------------------------------------------------------------- void MacabCommonStatement::resetParameters() const throw(::com::sun::star::sdbc::SQLException) { - - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(MacabCommonStatement_BASE::rBHelper.bDisposed); - - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Parameters can appear only in prepared statements."), - NULL); + impl_throwError(STR_PARA_ONLY_PREPARED); } // ----------------------------------------------------------------------------- void MacabCommonStatement::getNextParameter(::rtl::OUString &) const throw(::com::sun::star::sdbc::SQLException) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Parameters can appear only in prepared statements."), - NULL); + impl_throwError(STR_PARA_ONLY_PREPARED); } // ----------------------------------------------------------------------------- MacabCondition *MacabCommonStatement::analyseWhereClause(const OSQLParseNode *pParseNode) const throw(SQLException) @@ -237,9 +244,7 @@ MacabCondition *MacabCommonStatement::analyseWhereClause(const OSQLParseNode *pP } } } - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Syntax error or keyword not recognized."), - NULL); + impl_throwError(STR_QUERY_TOO_COMPLEX); // Unreachable: OSL_ASSERT(false); return 0; @@ -287,9 +292,7 @@ MacabOrder *MacabCommonStatement::analyseOrderByClause(const OSQLParseNode *pPar } } } - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Syntax error or keyword not recognized."), - NULL); + impl_throwError(STR_QUERY_TOO_COMPLEX); // Unreachable: OSL_ASSERT(false); return 0; @@ -317,9 +320,11 @@ void MacabCommonStatement::setMacabFields(MacabResultSet *pResult) const throw(S xColumns = m_aSQLIterator.getSelectColumns(); if (!xColumns.isValid()) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Invalid selection of columns"), - NULL); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString( + STR_INVALID_COLUMN_SELECTION + ) ); + ::dbtools::throwGenericSQLException(sError,NULL); } pMeta = static_cast<MacabResultSetMetaData *>(pResult->getMetaData().get()); pMeta->setMacabFields(xColumns); @@ -448,9 +453,7 @@ OSL_TRACE("Mac OS Address book - SQL Request: %s", OUtoCStr(sql)); // In case, somehow, we don't have anything with the name m_sTableName if(aRecords == NULL) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("No Such Table!"), - NULL); + impl_throwError(STR_NO_TABLE); } else { @@ -472,9 +475,7 @@ OSL_TRACE("Mac OS Address book - SQL Request: %s", OUtoCStr(sql)); // To be continued: UPDATE // DELETE // etc... - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Unsupported SQL statement"), - NULL); + impl_throwError(STR_QUERY_TOO_COMPLEX); } m_xResultSet = Reference<XResultSet>(pResult); diff --git a/connectivity/source/drivers/macab/macabutilities.hxx b/connectivity/source/drivers/macab/macabutilities.hxx index 58bff9a9b4..7d89e0aba0 100644 --- a/connectivity/source/drivers/macab/macabutilities.hxx +++ b/connectivity/source/drivers/macab/macabutilities.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: macabutilities.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.56.1 $ * * This file is part of OpenOffice.org. * @@ -145,6 +145,7 @@ namespace connectivity return dataType; } + void impl_throwError(sal_uInt16 _nErrorId); } } diff --git a/connectivity/source/drivers/macab/makefile.mk b/connectivity/source/drivers/macab/makefile.mk index 286d01b7e5..4b6cc65fa0 100755 --- a/connectivity/source/drivers/macab/makefile.mk +++ b/connectivity/source/drivers/macab/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.3 $ +# $Revision: 1.3.56.1 $ # # This file is part of OpenOffice.org. # @@ -65,6 +65,7 @@ SHL1OBJS=$(SLOFILES) SHL1STDLIBS=\ $(CPPULIB) \ $(CPPUHELPERLIB) \ + $(DBTOOLSLIB) \ $(SALLIB) SHL1DEPN= diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx index 7bb338504a..ec39cd7929 100644 --- a/connectivity/source/drivers/mozab/MConnection.cxx +++ b/connectivity/source/drivers/mozab/MConnection.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MConnection.cxx,v $ - * $Revision: 1.28 $ + * $Revision: 1.28.56.2 $ * * This file is part of OpenOffice.org. * @@ -45,10 +45,9 @@ #include "diagnose_ex.h" #include "resource/mozab_res.hrc" +#include "resource/common_res.hrc" #include <comphelper/officeresourcebundle.hxx> -#include <boost/shared_ptr.hpp> - #if OSL_DEBUG_LEVEL > 0 # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) #else /* OSL_DEBUG_LEVEL */ @@ -129,19 +128,6 @@ OConnection::OConnection(MozabDriver* _pDriver) { m_pDriver->acquire(); - try - { - Reference< XPropertySet > xFactoryProps( m_pDriver->getMSFactory(), UNO_QUERY_THROW ); - Reference< XComponentContext > xContext( - xFactoryProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ), - UNO_QUERY_THROW - ); - m_pImplData->pResourceBundle.reset( new ::comphelper::OfficeResourceBundle( xContext, "cnr" ) ); - } - catch( const Exception& ) - { - OSL_ENSURE( false, "OConnection::OConnection: could not obtain the component context!" ); - } } //----------------------------------------------------------------------------- OConnection::~OConnection() @@ -186,7 +172,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV else { OSL_TRACE( "No subschema given!!!\n"); - throwGenericSQLException( STR_URI_SYNTAX_ERROR ); + throwGenericSQLException( STR_URI_SYNTAX_ERROR,*this ); } } else @@ -297,7 +283,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV m_sMozillaURI += m_sHostName; } else - throwGenericSQLException( STR_NO_HOSTNAME ); + throwGenericSQLException( STR_NO_HOSTNAME ,*this); if ( nPortNumber > 0 ) { m_sMozillaURI += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(":") ); @@ -309,7 +295,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV m_sMozillaURI += sBaseDN; } else - throwGenericSQLException( STR_NO_BASEDN ); + throwGenericSQLException( STR_NO_BASEDN ,*this); // Addition of a fake query to enable the Mozilla LDAP directory to work correctly. m_sMozillaURI += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?(or(DisplayName,=,DontDoThisAtHome)))")); @@ -326,7 +312,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV else { OSL_TRACE("Invalid subschema given!!!\n"); - throwGenericSQLException( STR_URI_SYNTAX_ERROR ); + throwGenericSQLException( STR_URI_SYNTAX_ERROR ,*this); } OSL_TRACE("Moz URI = %s, %s\n", ((OUtoCStr(m_sMozillaURI)) ? (OUtoCStr(m_sMozillaURI)):("NULL")), usesFactory() ? "uses factory" : "no factory"); @@ -340,7 +326,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV if ( isLDAP() ) { if ( !_aDbHelper.testLDAPConnection( this ) ) { OSL_TRACE("testLDAPConnection : FAILED\n" ); - throwGenericSQLException( _aDbHelper.getErrorResourceId() ); + throwGenericSQLException( _aDbHelper.getErrorResourceId() ,*this); } else { OSL_TRACE("testLDAPConnection : SUCCESS\n" ); @@ -351,7 +337,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV ::std::vector< ::rtl::OUString > tables; ::std::vector< ::rtl::OUString > types; if ( !_aDbHelper.getTableStrings( this, tables, types ) ) { - throwGenericSQLException( _aDbHelper.getErrorResourceId() ); + throwGenericSQLException( _aDbHelper.getErrorResourceId() ,*this); } } @@ -381,7 +367,11 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const :: // the pre // create a statement // the statement can only be executed more than once - Reference< XPreparedStatement > xReturn = new OPreparedStatement(this,_sSql); + OPreparedStatement* pPrepared = new OPreparedStatement(this,_sSql); + Reference< XPreparedStatement > xReturn = pPrepared; + if ( !pPrepared->lateInit() ) + throw SQLException(); + m_aStatements.push_back(WeakReferenceHelper(xReturn)); return xReturn; } @@ -561,21 +551,4 @@ MNameMapper* OConnection::getNameMapper () } // ----------------------------------------------------------------------------- -void OConnection::throwGenericSQLException( sal_Int32 _nErrorResourceId ) -{ - ::boost::shared_ptr< ::comphelper::OfficeResourceBundle > pResourceBundle; - { - ::osl::MutexGuard aGuard( m_aMutex ); - pResourceBundle = m_pImplData->pResourceBundle; - } - - OSL_ENSURE( pResourceBundle.get(), "OConnection::throwGenericSQLException: no resource bundle?" ); - // this means that we're disposed, and how could anybody request us to throw an exception then? - - ::rtl::OUString sErrorMessage; - if ( pResourceBundle.get() && _nErrorResourceId ) - sErrorMessage = pResourceBundle->loadString( _nErrorResourceId ); - ::dbtools::throwGenericSQLException( sErrorMessage, *this ); -} - } } // namespace connectivity::mozab diff --git a/connectivity/source/drivers/mozab/MConnection.hxx b/connectivity/source/drivers/mozab/MConnection.hxx index b6a1bed40f..3b72d95230 100644 --- a/connectivity/source/drivers/mozab/MConnection.hxx +++ b/connectivity/source/drivers/mozab/MConnection.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MConnection.hxx,v $ - * $Revision: 1.18 $ + * $Revision: 1.18.56.1 $ * * This file is part of OpenOffice.org. * @@ -199,8 +199,6 @@ namespace connectivity return ::com::sun::star::mozilla::MozillaProductType_Mozilla; } - void throwGenericSQLException( sal_Int32 _nErrorResourceId ); - // Get Ldap BindDN (user name) rtl::OUString getBindDN() const { return m_sBindDN; } // Get Ldap Password diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx index f324864a9f..e8851bb3f3 100644 --- a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx +++ b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MDatabaseMetaData.cxx,v $ - * $Revision: 1.16 $ + * $Revision: 1.16.56.1 $ * * This file is part of OpenOffice.org. * @@ -40,7 +40,7 @@ #include <connectivity/FValue.hxx> #include <com/sun/star/sdbc/ColumnValue.hpp> #include <com/sun/star/sdbc/ColumnSearch.hpp> - +#include "resource/common_res.hrc" #include <vector> #if OSL_DEBUG_LEVEL > 0 @@ -97,7 +97,7 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows( ::std::vector< ::rtl::OUString > tables; ::std::vector< ::rtl::OUString > types; if ( !m_pDbMetaDataHelper->getTableStrings( m_pConnection, tables, types) ) { - getOwnConnection()->throwGenericSQLException( m_pDbMetaDataHelper->getErrorResourceId() ); + getOwnConnection()->throwGenericSQLException( m_pDbMetaDataHelper->getErrorResourceId(),*this ); } // **************************************************** @@ -961,7 +961,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( // pResultSet->setRows( aRows ); ODatabaseMetaDataResultSet::ORows _rRows; if ( !m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern, types,_rRows ) ) { - getOwnConnection()->throwGenericSQLException( m_pDbMetaDataHelper->getErrorResourceId() ); + getOwnConnection()->throwGenericSQLException( m_pDbMetaDataHelper->getErrorResourceId() ,*this); } pResultSet->setRows( _rRows ); @@ -979,7 +979,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( ::std::vector< ::rtl::OUString > tables; ::std::vector< ::rtl::OUString > types; if ( !m_pDbMetaDataHelper->getTableStrings( m_pConnection, tables, types ) ) - getOwnConnection()->throwGenericSQLException( m_pDbMetaDataHelper->getErrorResourceId() ); + getOwnConnection()->throwGenericSQLException( m_pDbMetaDataHelper->getErrorResourceId() ,*this); ::connectivity::ODatabaseMetaDataResultSet::ORows aRows; ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8); diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx index 95bca677ca..1dca57b50a 100644 --- a/connectivity/source/drivers/mozab/MDriver.cxx +++ b/connectivity/source/drivers/mozab/MDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MDriver.cxx,v $ - * $Revision: 1.20 $ + * $Revision: 1.19.56.3 $ * * This file is part of OpenOffice.org. * @@ -33,6 +33,9 @@ #include "MDriver.hxx" #include "MConnection.hxx" #include "connectivity/dbexception.hxx" +#include "resource/mozab_res.hrc" +#include "resource/common_res.hrc" + #include <tools/solar.h> using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -154,9 +157,13 @@ Reference< XConnection > SAL_CALL MozabDriver::connect( const ::rtl::OUString& u } else { - ::rtl::OUString sMsg = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Could not load the library ")); - sMsg += ::rtl::OUString::createFromAscii(SVLIBRARY( "mozabdrv" )); - ::dbtools::throwGenericSQLException(sMsg,*this); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_COULD_NOT_LOAD_LIB, + "$libname$", ::rtl::OUString::createFromAscii( SVLIBRARY( "mozabdrv" ) ) + ) ); + + ::dbtools::throwGenericSQLException(sError,*this); } return xCon; @@ -199,7 +206,9 @@ Sequence< DriverPropertyInfo > SAL_CALL MozabDriver::getPropertyInfo( const ::rt ); 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); // if you have somthing special to say return it here :-) return Sequence< DriverPropertyInfo >(); } diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx index 91314c0f4f..e3bea72f29 100644 --- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx +++ b/connectivity/source/drivers/mozab/MPreparedStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MPreparedStatement.cxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.56.1 $ * * This file is part of OpenOffice.org. * @@ -78,6 +78,11 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::rtl::O OPreparedStatement::~OPreparedStatement() { } +// ----------------------------------------------------------------------------- +sal_Bool OPreparedStatement::lateInit() +{ + return parseSql( m_sSqlStatement ); +} // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::disposing() { diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.hxx b/connectivity/source/drivers/mozab/MPreparedStatement.hxx index 78505915cb..3a4a591cd5 100644 --- a/connectivity/source/drivers/mozab/MPreparedStatement.hxx +++ b/connectivity/source/drivers/mozab/MPreparedStatement.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MPreparedStatement.hxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.56.1 $ * * This file is part of OpenOffice.org. * @@ -115,6 +115,7 @@ namespace connectivity DECLARE_SERVICE_INFO(); // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql); + sal_Bool lateInit(); //XInterface virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx index a8a7d7444f..f64e143dd7 100644 --- a/connectivity/source/drivers/mozab/MResultSet.cxx +++ b/connectivity/source/drivers/mozab/MResultSet.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MResultSet.cxx,v $ - * $Revision: 1.33 $ + * $Revision: 1.33.22.3 $ * * This file is part of OpenOffice.org. * @@ -44,17 +44,15 @@ #include <connectivity/dbexception.hxx> #include <connectivity/dbtools.hxx> -#ifndef _CONNECTIVITY_TSORTINDEX_HXX_ #include <TSortIndex.hxx> -#endif #include <rtl/string.hxx> #include <vector> #include <algorithm> -#ifndef CONNECTIVITY_SRESULTSET_HXX #include "MResultSet.hxx" -#endif #include "MResultSetMetaData.hxx" #include "FDatabaseMetaDataResultSet.hxx" +#include "resource/mozab_res.hrc" +#include "resource/common_res.hrc" #if OSL_DEBUG_LEVEL > 0 # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) @@ -360,7 +358,7 @@ sal_Bool OResultSet::pushCard(sal_uInt32 cardNumber) throw(SQLException, Runtime // Everything in the addressbook is a string! // if ( !m_aQuery.setRowValue( (*m_aRow)[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR )) { - m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ); + m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId(),*this ); } } } @@ -401,7 +399,7 @@ sal_Bool OResultSet::fetchRow(sal_Int32 cardNumber,sal_Bool bForceReload) throw( // Everything in the addressbook is a string! // if ( !m_aQuery.getRowValue( (*m_aRow)[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR )) { - m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ); + m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId(),*this ); } } } @@ -615,8 +613,7 @@ void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) { OSL_TRACE("In/Out: OResultSet::refreshRow" ); if (fetchRow(getCurrentCardNumber(),sal_True)) //force fetch current row will cause we lose all change to the current row - ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Error refresh row")), NULL ); - + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERROR_REFRESH_ROW,*this); } // ------------------------------------------------------------------------- IPropertyArrayHelper* OResultSet::createArrayHelper( ) const @@ -855,8 +852,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT // odbc date (SQL_ISRULE(parseTree->getChild(2),set_fct_spec) && SQL_ISPUNCTUATION(parseTree->getChild(2)->getChild(0),"{")))) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Statement too complex")),NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this); } OSQLParseNode *pPrec = parseTree->getChild(1); @@ -893,8 +889,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT if ( !(SQL_ISRULE(parseTree->getChild(0), column_ref)) ) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid Statement - Not a Column")),NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_COLUMN,*this); } @@ -914,8 +909,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT { OSL_TRACE("analyseSQL : pAtom->count() = %d\n", pAtom->count() ); - ::dbtools::throwGenericSQLException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid Statement - Not a String")),NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,*this); } const sal_Unicode WILDCARD = '%'; @@ -977,8 +971,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT { // We currently can't handle a 'NOT LIKE' when there are '%' or // '_' dispersed throughout - ::dbtools::throwGenericSQLException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Statement too complex")),NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_NOT_LIKE_TOO_COMPLEX,*this); } else { @@ -1033,7 +1026,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT if (!SQL_ISRULE(parseTree->getChild(0),column_ref)) { - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid Statement - Not a Column")),NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_INVALID_IS_NULL_COLUMN,*this); } if (SQL_ISTOKEN(parseTree->getChild(2),NOT)) @@ -1052,7 +1045,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT { OSL_TRACE( "Unexpected statement!!!" ); - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid Statement - Unexpected")),NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this); } } @@ -1138,8 +1131,7 @@ void OResultSet::fillRowData() sal_Int32 rv = m_aQuery.executeQuery(xConnection); if ( rv == -1 ) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Error querying addressbook")),NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERR_EXECUTING_QUERY,*this); } //determine whether the address book is readonly determineReadOnly(); @@ -1187,7 +1179,7 @@ sal_Int32 OResultSet::getRowForCardNumber(sal_Int32 nCardNum) } } - ::dbtools::throwSQLException( "Invalid bookmark value", "HY111", *this ); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_INVALID_BOOKMARK,*this); return 0; } @@ -1202,10 +1194,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep { const OSQLTables& xTabs = m_pSQLIterator->getTables(); if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is()) - ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The statement is invalid.")), - static_cast<XWeak*>(this), - makeAny( m_pSQLIterator->getErrors() ) - ); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this); m_pTable = static_cast< OTable* > ((xTabs.begin()->second).get()); @@ -1230,7 +1219,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep } else if(isCount()) { - ::dbtools::throwFunctionNotSupportedException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("COUNT() - Driver does not support this function.")), NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_NO_COUNT_SUPPORT,*this); } else { @@ -1296,7 +1285,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep OSL_TRACE("Query is to be sorted"); if( ! m_aQuery.queryComplete() ) if ( !m_aQuery.waitForQueryComplete() ) { - m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ); + m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId(),*this ); } OSL_ENSURE( m_aQuery.queryComplete(), "Query not complete!!"); @@ -1371,7 +1360,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep case SQL_STATEMENT_INSERT: break; default: - ::dbtools::throwFunctionNotSupportedException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("statement type not supported by this database driver.")), NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_STMT_TYPE_NOT_SUPPORTED,*this); break; } } @@ -1484,7 +1473,7 @@ sal_Bool OResultSet::validRow( sal_uInt32 nRow ) #endif m_aQuery.checkRowAvailable( nRow ); if ( m_aQuery.errorOccurred() ) { - m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ); + m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ,*this); } nNumberOfRecords = m_aQuery.getRealRowCount(); } @@ -1526,7 +1515,7 @@ sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset ) { ResultSetEntryGuard aGuard( *this ); if ( !m_pKeySet.isValid() ) - ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal cursor movement" ) ), *this ); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ILLEGAL_MOVEMENT,*this); sal_Int32 nNumberOfRecords = m_aQuery.getRealRowCount(); sal_Int32 nRetrivedRows = currentRowCount(); @@ -1579,7 +1568,7 @@ sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset ) while ( nCurCard > nNumberOfRecords && !m_aQuery.queryComplete() ) { m_aQuery.checkRowAvailable( nCurCard ); if ( m_aQuery.errorOccurred() ) { - m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ); + m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId(),*this ); } nNumberOfRecords = m_aQuery.getRealRowCount(); } @@ -1613,7 +1602,7 @@ void OResultSet::setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMappin OSL_TRACE("getBookmark, m_nRowPos = %u", m_nRowPos ); ResultSetEntryGuard aGuard( *this ); if ( fetchCurrentRow() == sal_False ) - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't get current row")),NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERROR_GET_ROW,*this); OSL_ENSURE((!m_aRow->isDeleted()),"getBookmark called for deleted row"); return makeAny((sal_Int32)(*m_aRow)[0]); @@ -1644,7 +1633,7 @@ sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, c sal_Int32 nResult=0; if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) ) - ::dbtools::throwSQLException( "XRowLocate::compareBookmarks: Invalid bookmark value", "HY111", *this ); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_INVALID_BOOKMARK,*this); if(nFirst < nSecond) nResult = -1; @@ -1684,10 +1673,11 @@ void OResultSet::checkPendingUpdate() throw(SQLException, RuntimeException) if ((m_nNewRow && nCurrentRow != m_nNewRow) || ( m_nUpdatedRow && m_nUpdatedRow != nCurrentRow)) { - const ::rtl::OUString errorMsg=::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" Please commit row ")) - + ::rtl::OUString::valueOf(nCurrentRow) - + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" before update rows or insert new rows. ")) ; - ::dbtools::throwGenericSQLException( errorMsg, *this ); + const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution( + STR_COMMIT_ROW, + "$position$", ::rtl::OUString::valueOf(nCurrentRow) + ) ); + ::dbtools::throwGenericSQLException(sError,*this); } } @@ -1696,7 +1686,7 @@ void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw OSL_TRACE("updateValue, m_nRowPos = %u", m_nRowPos ); ResultSetEntryGuard aGuard( *this ); if ( fetchCurrentRow() == sal_False ) - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't get current row")),NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERROR_GET_ROW,*this); checkPendingUpdate(); @@ -1716,7 +1706,7 @@ void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException OSL_TRACE("updateNull, m_nRowPos = %u", m_nRowPos ); ResultSetEntryGuard aGuard( *this ); if ( fetchCurrentRow() == sal_False ) - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't get current row")),NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERROR_GET_ROW,*this); checkPendingUpdate(); checkIndex(columnIndex ); @@ -1799,7 +1789,7 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer ResultSetEntryGuard aGuard( *this ); if(!x.is()) - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid use of null pointer")),*this); + ::dbtools::throwFunctionSequenceException(*this); Sequence<sal_Int8> aSeq; x->readSomeBytes(aSeq,length); @@ -1813,15 +1803,27 @@ void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Re // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) { - if (!::dbtools::implUpdateObject(this, columnIndex, x)) - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Error updating object")),*this); + if (!::dbtools::implUpdateObject(this, columnIndex, x)) + { + const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution( + STR_COLUMN_NOT_UPDATEABLE, + "$position$", ::rtl::OUString::valueOf(columnIndex) + ) ); + ::dbtools::throwGenericSQLException(sError,*this); + } // if (!::dbtools::implUpdateObject(this, columnIndex, x)) } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException) { if (!::dbtools::implUpdateObject(this, columnIndex, x)) - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Error updating object")),*this); + { + const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution( + STR_COLUMN_NOT_UPDATEABLE, + "$position$", ::rtl::OUString::valueOf(columnIndex) + ) ); + ::dbtools::throwGenericSQLException(sError,*this); + } } // XResultSetUpdate @@ -1845,22 +1847,21 @@ void SAL_CALL OResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLExcepti impl_ensureKeySet(); if (!m_nRowPos || m_pKeySet->size() < m_nRowPos ) - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Call update on invalid row")),NULL); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_INVALID_ROW_UPDATE,*this); const sal_Int32 nCurrentCard = getCurrentCardNumber(); if (!pushCard(nCurrentCard)) { m_RowStates = RowStates_Error; - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't save current row")),NULL); - + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ROW_CAN_NOT_SAVE,*this); } if (!m_aQuery.commitRow(nCurrentCard)) { m_RowStates = RowStates_Error; m_nUpdatedRow = 0; - m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ); + m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ,*this); } m_nUpdatedRow = 0; @@ -1873,16 +1874,16 @@ void SAL_CALL OResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLExcepti OSL_TRACE("deleteRow, m_nRowPos = %u", m_nRowPos ); ResultSetEntryGuard aGuard( *this ); if (rowDeleted()) - ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Row Already deleted")), *this ); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ROW_ALREADY_DELETED,*this); const sal_Int32 nCurrentRow = getCurrentCardNumber(); //fetchRow(nCurrentRow); if (!nCurrentRow) - ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" Can't get Current Row")), *this ); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERROR_GET_ROW,*this); sal_Bool m_bRowDeleted = ( m_aQuery.deleteRow( nCurrentRow ) > 0 ); if (!m_bRowDeleted) - m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ); + m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ,*this); m_aQuery.setRowStates(nCurrentRow,RowStates_Deleted); m_pKeySet->erase(m_pKeySet->begin() + m_nRowPos -1); @@ -1895,7 +1896,7 @@ void SAL_CALL OResultSet::cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQL ResultSetEntryGuard aGuard( *this ); OSL_TRACE("cancelRowUpdates, m_nRowPos = %u", m_nRowPos ); if (fetchRow(getCurrentCardNumber(),sal_True)) //force fetch current row will cause we lose all change to the current row - ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't cancel row updates")), NULL ); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_CAN_NOT_CANCEL_ROW_UPDATE,*this); } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) @@ -1915,7 +1916,8 @@ void SAL_CALL OResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLE } m_nNewRow = m_aQuery.createNewCard(); if (!m_nNewRow) - ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Error creating new rows")), NULL ); + m_pStatement->getOwnConnection()->throwGenericSQLException(STR_CAN_NOT_CREATE_ROW,*this); + m_RowStates = RowStates_Normal; fillKeySet(m_nNewRow); } diff --git a/connectivity/source/drivers/mozab/MStatement.cxx b/connectivity/source/drivers/mozab/MStatement.cxx index 3350d00322..4880d2cfd6 100644 --- a/connectivity/source/drivers/mozab/MStatement.cxx +++ b/connectivity/source/drivers/mozab/MStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MStatement.cxx,v $ - * $Revision: 1.18 $ + * $Revision: 1.18.56.1 $ * * This file is part of OpenOffice.org. * @@ -49,15 +49,14 @@ #include <algorithm> - #include "diagnose_ex.h" #include "MDriver.hxx" #include "MStatement.hxx" #include "MConnection.hxx" -#ifndef CONNECTIVITY_SRESULTSET_HXX #include "MResultSet.hxx" -#endif #include "MDatabaseMetaData.hxx" +#include "resource/mozab_res.hrc" +#include "resource/common_res.hrc" #if OSL_DEBUG_LEVEL > 0 # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) @@ -212,15 +211,18 @@ void OStatement_Base::createTable( ) (*aIter)->getPropertyValue(sProprtyName) >>= sName; if ( !aColumnAlias.hasAlias( sName ) ) { - ::dbtools::throwGenericSQLException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Driver does not support column name: " ) ) + sName, - NULL ); + + const ::rtl::OUString sError( getOwnConnection()->getResources().getResourceStringWithSubstitution( + STR_INVALID_COLUMNNAME, + "$columnname$", sName + ) ); + ::dbtools::throwGenericSQLException(sError,*this); } } MDatabaseMetaDataHelper _aDbHelper; if (!_aDbHelper.NewAddressBook(m_pConnection,ouTableName)) { - getOwnConnection()->throwGenericSQLException( _aDbHelper.getErrorResourceId() ); + getOwnConnection()->throwGenericSQLException( _aDbHelper.getErrorResourceId(),*this ); } m_pSQLIterator.reset( new ::connectivity::OSQLParseTreeIterator( m_pConnection, m_pConnection->createCatalog()->getTables(), m_aParser, NULL ) ); @@ -228,7 +230,7 @@ void OStatement_Base::createTable( ) } else - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Problem parsing SQL!")),NULL); + getOwnConnection()->throwGenericSQLException( STR_QUERY_TOO_COMPLEX ,*this); } // ------------------------------------------------------------------------- sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted) @@ -254,7 +256,8 @@ sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjus m_pSQLIterator->traverseAll(); const OSQLTables& xTabs = m_pSQLIterator->getTables(); if(xTabs.empty()) - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Driver requires a single table to be specified in query")),NULL); + getOwnConnection()->throwGenericSQLException( STR_QUERY_AT_LEAST_ONE_TABLES,*this ); + #if OSL_DEBUG_LEVEL > 0 OSQLTables::const_iterator citer; for( citer = xTabs.begin(); citer != xTabs.end(); ++citer ) { @@ -287,7 +290,7 @@ sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjus createTable(); return sal_False; default: - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Problem parsing SQL!")),NULL); + getOwnConnection()->throwGenericSQLException( STR_QUERY_TOO_COMPLEX ,*this); } } else if(!bAdjusted) //Our sql parser does not support a statement like "create table foo" @@ -296,7 +299,7 @@ sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjus return parseSql(sql + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("(""E-mail"" caracter)")),sal_True); } else - ::dbtools::throwGenericSQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Problem parsing SQL!")),NULL); + getOwnConnection()->throwGenericSQLException( STR_QUERY_TOO_COMPLEX ,*this); return sal_True; } diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx index afbd529430..6df6030e88 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MDatabaseMetaDataHelper.cxx,v $ - * $Revision: 1.16 $ + * $Revision: 1.16.56.1 $ * * This file is part of OpenOffice.org. * @@ -596,7 +596,7 @@ sal_Bool MDatabaseMetaDataHelper::getTableStrings( OConnection* args.arg5 = (void*)&m_aTableTypes; args.arg6 = (void*)&nErrorResourceId; rv = xMProxy.StartProxy(&args,m_ProductType,m_ProfileName); - setError( nErrorResourceId ); + setError( static_cast<sal_uInt16>(nErrorResourceId) ); if (NS_FAILED(rv)) { diff --git a/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx b/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx index 77eed7a9e2..79e40794fa 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: MErrorResource.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.56.1 $ * * This file is part of OpenOffice.org. * @@ -40,15 +40,15 @@ namespace connectivity class ErrorResourceAccess { private: - mutable sal_Int32 m_nErrorResourceId; + mutable sal_uInt16 m_nErrorResourceId; protected: ErrorResourceAccess() : m_nErrorResourceId(0) { } - inline void setError( sal_Int32 _nErrorResourceId ) const { const_cast< ErrorResourceAccess* >( this )->m_nErrorResourceId = _nErrorResourceId; } + inline void setError( sal_uInt16 _nErrorResourceId ) const { const_cast< ErrorResourceAccess* >( this )->m_nErrorResourceId = _nErrorResourceId; } inline void resetError( ) const { const_cast< ErrorResourceAccess* >( this )->m_nErrorResourceId = 0; } public: - inline sal_Int32 getErrorResourceId() const + inline sal_uInt16 getErrorResourceId() const { return m_nErrorResourceId; } }; } diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx index cf8f0ed3f4..45ac900589 100644 --- a/connectivity/source/drivers/mysql/YDriver.cxx +++ b/connectivity/source/drivers/mysql/YDriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: YDriver.cxx,v $ - * $Revision: 1.20 $ + * $Revision: 1.20.30.1 $ * * This file is part of OpenOffice.org. * @@ -38,7 +38,8 @@ #include <connectivity/dbcharset.hxx> #include <com/sun/star/sdbc/XDriverAccess.hpp> #include "TConnection.hxx" - +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" //........................................................................ namespace connectivity @@ -384,7 +385,11 @@ namespace connectivity Reference< XTablesSupplier > SAL_CALL ODriverDelegator::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw (SQLException, RuntimeException) { if ( ! acceptsURL(url) ) - ::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); + } // if ( ! acceptsURL(url) ) return getDataDefinitionByConnection(connect(url,info)); } diff --git a/connectivity/source/drivers/mysql/YUser.cxx b/connectivity/source/drivers/mysql/YUser.cxx index 973f8c2343..a79d486b9e 100644 --- a/connectivity/source/drivers/mysql/YUser.cxx +++ b/connectivity/source/drivers/mysql/YUser.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: YUser.cxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.6.56.2 $ * * This file is part of OpenOffice.org. * @@ -38,6 +38,7 @@ #include <com/sun/star/sdbcx/Privilege.hpp> #include <com/sun/star/sdbcx/PrivilegeObject.hpp> #include "TConnection.hxx" +#include "resource/common_res.hrc" using namespace connectivity; using namespace connectivity::mysql; @@ -227,7 +228,11 @@ sal_Int32 SAL_CALL OMySQLUser::getGrantablePrivileges( const ::rtl::OUString& ob void SAL_CALL OMySQLUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException) { if ( objType != PrivilegeObject::TABLE ) - ::dbtools::throwSQLException( "Privilege not granted: Only table privileges can be granted", "01007", *this ); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_GRANTED)); + ::dbtools::throwGenericSQLException(sError,*this); + } // if ( objType != PrivilegeObject::TABLE ) ::osl::MutexGuard aGuard(m_aMutex); @@ -253,7 +258,11 @@ void SAL_CALL OMySQLUser::grantPrivileges( const ::rtl::OUString& objName, sal_I void SAL_CALL OMySQLUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException) { if ( objType != PrivilegeObject::TABLE ) - ::dbtools::throwSQLException( "Privilege not revoked: Only table privileges can be revoked", "01006", *this ); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_REVOKED)); + ::dbtools::throwGenericSQLException(sError,*this); + } ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx index 71b0041dec..60e185b4a7 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ODatabaseMetaData.cxx,v $ - * $Revision: 1.35 $ + * $Revision: 1.35.56.1 $ * * This file is part of OpenOffice.org. * @@ -1604,6 +1604,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 set SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 ); switch(setType) { + default: case ResultSetType::FORWARD_ONLY: nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2; break; @@ -1613,9 +1614,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 set case ResultSetType::SCROLL_SENSITIVE: nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2; break; - default: - ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid result set type." ) ), *this ); - break; } OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this); @@ -1638,6 +1636,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) t SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 ); switch(setType) { + default: case ResultSetType::FORWARD_ONLY: nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2; break; @@ -1647,9 +1646,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) t case ResultSetType::SCROLL_SENSITIVE: nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2; break; - default: - ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid result set type." ) ), *this ); - break; } OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this); @@ -1662,6 +1658,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) t SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 ); switch(setType) { + default: case ResultSetType::FORWARD_ONLY: nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2; break; @@ -1671,9 +1668,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) t case ResultSetType::SCROLL_SENSITIVE: nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2; break; - default: - ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid result set type." ) ), *this ); - break; } OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this); @@ -1686,6 +1680,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) t SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 ); switch(setType) { + default: case ResultSetType::FORWARD_ONLY: nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2; break; @@ -1695,9 +1690,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) t case ResultSetType::SCROLL_SENSITIVE: nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2; break; - default: - ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid result set type." ) ), *this ); - break; } OTools::GetInfo(m_pConnection,m_aConnectionHandle,nAskFor,nValue,*this); diff --git a/connectivity/source/drivers/odbc/ODriver.cxx b/connectivity/source/drivers/odbc/ODriver.cxx index 0aaaa89d10..4f1f2d4cca 100644 --- a/connectivity/source/drivers/odbc/ODriver.cxx +++ b/connectivity/source/drivers/odbc/ODriver.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ODriver.cxx,v $ - * $Revision: 1.18 $ + * $Revision: 1.18.56.1 $ * * This file is part of OpenOffice.org. * @@ -35,6 +35,8 @@ #include "odbc/OFunctions.hxx" #include "odbc/OTools.hxx" #include "connectivity/dbexception.hxx" +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" using namespace connectivity::odbc; using namespace com::sun::star::uno; @@ -209,7 +211,9 @@ Sequence< DriverPropertyInfo > SAL_CALL ODBCDriver::getPropertyInfo( const ::rtl 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/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx index fa29e5c29a..2093e65532 100644 --- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx +++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: OPreparedStatement.cxx,v $ - * $Revision: 1.49 $ + * $Revision: 1.49.56.2 $ * * This file is part of OpenOffice.org. * @@ -47,6 +47,7 @@ #include "connectivity/dbtools.hxx" #include <comphelper/types.hxx> #include "connectivity/FValue.hxx" +#include "resource/common_res.hrc" #include "connectivity/sqlparse.hxx" using namespace ::comphelper; @@ -263,14 +264,11 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, Run if (!execute()) numRows = getUpdateCount (); - else { - + else + { // No update count was produced (a ResultSet was). Raise // an exception - - throw SQLException(::rtl::OUString::createFromAscii("No row count was produced"), - *this, - ::rtl::OUString(),0,Any()); + m_pConnection->throwGenericSQLException(STR_NO_ROWCOUNT,*this); } return numRows; } @@ -303,14 +301,10 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE if (execute()) rs = getResultSet(sal_False); - - else { - + else + { // No ResultSet was produced. Raise an exception - - throw SQLException(::rtl::OUString::createFromAscii("No ResultSet was produced"), - *this, - ::rtl::OUString(),0,Any()); + m_pConnection->throwGenericSQLException(STR_NO_RESULTSET,*this); } return rs; } @@ -778,9 +772,9 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException) Reference< XInputStream> inputStream = boundParams[index - 1].getInputStream (); if ( !inputStream.is() ) { - throw SQLException (::rtl::OUString::createFromAscii("InputStream was not set."), - *this, - ::rtl::OUString(),0,Any()); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_NO_INPUTSTREAM)); + throw SQLException (sError, *this,::rtl::OUString(),0,Any()); } sal_Int32 inputStreamLen = boundParams[index - 1].getInputStreamLen (); sal_Int32 inputStreamType = boundParams[index - 1].getStreamType (); @@ -806,9 +800,9 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException) if (inputStreamLen != 0) { - throw SQLException (::rtl::OUString::createFromAscii("End of InputStream reached before satisfying length specified when InputStream was set"), - *this, - ::rtl::OUString(),0,Any()); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_INPUTSTREAM_WRONG_LEN)); + throw SQLException (sError, *this,::rtl::OUString(),0,Any()); } endOfStream = sal_True; break; @@ -1008,14 +1002,13 @@ void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex) { if( !_parameterIndex || _parameterIndex > numParams) { - ::rtl::OUString s_sParameterError = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("You tried to set a parameter at position ")); - s_sParameterError += ::rtl::OUString::valueOf(_parameterIndex); - s_sParameterError += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" but there is/are only ")); - s_sParameterError += ::rtl::OUString::valueOf((sal_Int32)numParams); - s_sParameterError += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" parameter(s) allowed.")); - s_sParameterError += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" One reason may be that the property \"ParameterNameSubstitution\" is not set to TRUE in the data source.")); - static ::rtl::OUString sStatus = ::rtl::OUString::createFromAscii("07009"); - SQLException aNext(s_sParameterError,*this,sStatus,0,Any()); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(STR_WRONG_PARAM_INDEX, + "$pos$", ::rtl::OUString::valueOf(_parameterIndex), + "$count$", ::rtl::OUString::valueOf((sal_Int32)numParams) + )); + SQLException aNext(sError,*this, ::rtl::OUString(),0,Any()); + ::dbtools::throwInvalidIndexException(*this,makeAny(aNext)); } } diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx index 8ca41b1d9d..344e855903 100644 --- a/connectivity/source/drivers/odbc/OStatement.cxx +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: OStatement.cxx,v $ - * $Revision: 1.40 $ + * $Revision: 1.40.56.2 $ * * This file is part of OpenOffice.org. * @@ -50,6 +50,8 @@ #include <comphelper/types.hxx> #include "diagnose_ex.h" #include <algorithm> +#include "resource/common_res.hrc" +#include "connectivity/dbexception.hxx" using namespace ::comphelper; @@ -403,8 +405,7 @@ Reference< XResultSet > OStatement_Base::getResultSet (sal_Bool checkCount) thro if (m_xResultSet.get().is()) // if resultset already retrieved, { // throw exception to avoid sequence error - throw SQLException(::rtl::OUString::createFromAscii("Invalid state for getResultSet"),*this, - ::rtl::OUString(),0,Any()); + ::dbtools::throwFunctionSequenceException(*this,Any()); } OResultSet* pRs = NULL; @@ -467,8 +468,7 @@ Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUS else { // No ResultSet was produced. Raise an exception - throw SQLException(::rtl::OUString::createFromAscii("No ResultSet was produced"),*this, - ::rtl::OUString(),0,Any()); + m_pConnection->throwGenericSQLException(STR_NO_RESULTSET,*this); } return xRS; } @@ -550,8 +550,9 @@ sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) // No update count was produced (a ResultSet was). Raise // an exception - throw new SQLException (::rtl::OUString::createFromAscii("No row count was produced"),*this, - ::rtl::OUString(),0,Any()); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceString(STR_NO_ROWCOUNT)); + throw SQLException (sError, *this,::rtl::OUString(),0,Any()); } return numRows; diff --git a/connectivity/source/inc/TConnection.hxx b/connectivity/source/inc/TConnection.hxx index 3f931a1ec7..e9eb79cdb4 100644 --- a/connectivity/source/inc/TConnection.hxx +++ b/connectivity/source/inc/TConnection.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: TConnection.hxx,v $ - * $Revision: 1.13 $ + * $Revision: 1.13.56.1 $ * * This file is part of OpenOffice.org. * @@ -39,7 +39,7 @@ #include <cppuhelper/compbase4.hxx> #include "propertyids.hxx" #include "connectivity/CommonTools.hxx" - +#include "resource/sharedresources.hxx" namespace connectivity { @@ -64,15 +64,18 @@ namespace connectivity rtl_TextEncoding m_nTextEncoding; // the encoding which is used for all text conversions ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + SharedResources m_aResources; public: static ::dbtools::OPropertyMap& getPropMap(); - OMetaConnection() : OMetaConnection_BASE(m_aMutex) ,m_nTextEncoding(RTL_TEXTENCODING_MS_1252){} + OMetaConnection(); inline rtl_TextEncoding getTextEncoding() const { return m_nTextEncoding; } inline ::rtl::OUString getURL() const { return m_sURL; } inline void setURL(const ::rtl::OUString& _rsUrl) { m_sURL = _rsUrl; } + void throwGenericSQLException( sal_uInt16 _nErrorResourceId,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xContext ); + const SharedResources& getResources() const { return m_aResources;} inline void setConnectionInfo(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aInfo) { m_aConnectionInfo = _aInfo; } inline const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& diff --git a/connectivity/source/inc/ado/ADriver.hxx b/connectivity/source/inc/ado/ADriver.hxx index 9464db09ae..3305d65beb 100644 --- a/connectivity/source/inc/ado/ADriver.hxx +++ b/connectivity/source/inc/ado/ADriver.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ADriver.hxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.56.1 $ * * This file is part of OpenOffice.org. * @@ -67,6 +67,10 @@ namespace connectivity // XInterface static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const { return m_xORB; } + + private: + void impl_checkURL_throw(const ::rtl::OUString& _sUrl); // XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); @@ -83,8 +87,6 @@ namespace connectivity // XDataDefinitionSupplier virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const { return m_xORB; } }; } diff --git a/connectivity/source/inc/dbase/DCode.hxx b/connectivity/source/inc/dbase/DCode.hxx index f410875aec..499157db8b 100644 --- a/connectivity/source/inc/dbase/DCode.hxx +++ b/connectivity/source/inc/dbase/DCode.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DCode.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.56.1 $ * * This file is part of OpenOffice.org. * @@ -37,12 +37,16 @@ namespace connectivity { + namespace file + { + class OConnection; + } namespace dbase { class OFILEAnalyzer : public file::OSQLAnalyzer { public: - OFILEAnalyzer() : file::OSQLAnalyzer(){} + OFILEAnalyzer(file::OConnection* _pConnection) : file::OSQLAnalyzer(_pConnection){} virtual file::OOperandAttr* createOperandAttr(sal_Int32 _nPos, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xIndexes=NULL); diff --git a/connectivity/source/inc/dbase/DDatabaseMetaData.hxx b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx index 1d6ca8a9f0..e7a9d25baa 100644 --- a/connectivity/source/inc/dbase/DDatabaseMetaData.hxx +++ b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DDatabaseMetaData.hxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.56.1 $ * * This file is part of OpenOffice.org. * @@ -57,6 +57,9 @@ namespace connectivity virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool impl_storesMixedCaseQuotedIdentifiers_throw( ); + virtual sal_Bool impl_supportsMixedCaseQuotedIdentifiers_throw( ); protected: virtual ~ODbaseDatabaseMetaData(); public: diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx index d7322df1a4..56f799d4ed 100644 --- a/connectivity/source/inc/dbase/DTable.hxx +++ b/connectivity/source/inc/dbase/DTable.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DTable.hxx,v $ - * $Revision: 1.41 $ + * $Revision: 1.41.30.1 $ * * This file is part of OpenOffice.org. * @@ -122,7 +122,7 @@ namespace connectivity void throwInvalidDbaseFormat(); void SAL_CALL renameImpl( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - void throwInvalidColumnType(const ::rtl::OUString& _sError,const ::rtl::OUString& _sColumnName); + void throwInvalidColumnType(const sal_uInt16 _nErrorId,const ::rtl::OUString& _sColumnName); protected: virtual void FileClose(); diff --git a/connectivity/source/inc/file/fanalyzer.hxx b/connectivity/source/inc/file/fanalyzer.hxx index 8f303a1b2a..dbc4e1d99c 100644 --- a/connectivity/source/inc/file/fanalyzer.hxx +++ b/connectivity/source/inc/file/fanalyzer.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: fanalyzer.hxx,v $ - * $Revision: 1.13 $ + * $Revision: 1.13.56.1 $ * * This file is part of OpenOffice.org. * @@ -37,7 +37,7 @@ namespace connectivity { namespace file { - + class OConnection; class OSQLAnalyzer { typedef ::std::list<OEvaluateSet*> OEvaluateSetList; @@ -46,6 +46,7 @@ namespace connectivity ::std::vector< TPredicates > m_aSelectionEvaluations; ::vos::ORef<OPredicateCompiler> m_aCompiler; ::vos::ORef<OPredicateInterpreter> m_aInterpreter; + OConnection* m_pConnection; mutable sal_Bool m_bHasSelectionCode; mutable sal_Bool m_bSelectionFirstTime; @@ -53,7 +54,7 @@ namespace connectivity void bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow,OEvaluateSetList& _rEvaluateSetList); public: - OSQLAnalyzer(); + OSQLAnalyzer(OConnection* _pConnection); virtual ~OSQLAnalyzer(); inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () ) { return ::rtl_allocateMemory( nSize ); } @@ -64,6 +65,7 @@ namespace connectivity inline static void SAL_CALL operator delete( void * /*pMem*/,void* /*_pHint*/ ) SAL_THROW( () ) { } + OConnection* getConnection() const { return m_pConnection; } void describeParam(::vos::ORef<OSQLColumns> rParameterColumns); // genauere Beschreibung der Parameter ::std::vector<sal_Int32>* bindEvaluationRow(OValueRefRow& _pRow); // Anbinden einer Ergebniszeile an die Restrictions /** bind the select columns if they contain a function which needs a row value diff --git a/connectivity/source/inc/propertyids.hxx b/connectivity/source/inc/propertyids.hxx index 9d042e2a4c..75708d14ca 100644 --- a/connectivity/source/inc/propertyids.hxx +++ b/connectivity/source/inc/propertyids.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: propertyids.hxx,v $ - * $Revision: 1.20 $ + * $Revision: 1.20.56.1 $ * * This file is part of OpenOffice.org. * @@ -134,7 +134,6 @@ pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaCon #define PROPERTY_ID_ISBOOKMARKABLE 40 #define PROPERTY_ID_INVALID_INDEX 41 -#define PROPERTY_ID_ERRORMSG_SEQUENCE 42 #define PROPERTY_ID_HY010 43 // FREE #define PROPERTY_ID_DELIMITER 45 diff --git a/connectivity/source/inc/resource/calc_res.hrc b/connectivity/source/inc/resource/calc_res.hrc index 9a4519ec81..9487dd585c 100644 --- a/connectivity/source/inc/resource/calc_res.hrc +++ b/connectivity/source/inc/resource/calc_res.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: calc_res.hrc,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.56.1 $ * * This file is part of OpenOffice.org. * @@ -31,16 +31,14 @@ #ifndef CONNECTIVITY_RESOURCE_CALC_HRC #define CONNECTIVITY_RESOURCE_CALC_HRC -#ifndef CONNECTIVITY_SHARED_RES_HRC #include "resource/conn_shared_res.hrc" -#endif +#include "resource/common_res.hrc" // ============================================================================ // = the calc driver's resource strings // ============================================================================ -#define STR_COULD_NOT_LOAD_FILE ( STR_CALC_BASE + 0 ) -#define STR_LOAD_FILE_ERROR_MESSAGE ( STR_CALC_BASE + 1 ) +#define STR_LOAD_FILE_ERROR_MESSAGE ( STR_CALC_BASE + 0 ) #endif // CONNECTIVITY_RESOURCE_CALC_HRC diff --git a/connectivity/source/inc/resource/common_res.hrc b/connectivity/source/inc/resource/common_res.hrc index 4e0f8acd19..bccdc70ce1 100644 --- a/connectivity/source/inc/resource/common_res.hrc +++ b/connectivity/source/inc/resource/common_res.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: common_res.hrc,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.56.3 $ * * This file is part of OpenOffice.org. * @@ -39,7 +39,43 @@ // = common strings // ============================================================================ -#define STR_STRING_LENGTH_EXCEEDED ( STR_COMMON_BASE + 1 ) -#define STR_CANNOT_CONVERT_STRING ( STR_COMMON_BASE + 2 ) +#define STR_STRING_LENGTH_EXCEEDED ( STR_COMMON_BASE + 1 ) +#define STR_CANNOT_CONVERT_STRING ( STR_COMMON_BASE + 2 ) +#define STR_URI_SYNTAX_ERROR ( STR_COMMON_BASE + 3 ) +#define STR_COULD_NOT_LOAD_FILE ( STR_COMMON_BASE + 4 ) +#define STR_QUERY_TOO_COMPLEX ( STR_COMMON_BASE + 5 ) +#define STR_OPERATOR_TOO_COMPLEX ( STR_COMMON_BASE + 6 ) +#define STR_QUERY_INVALID_LIKE_COLUMN ( STR_COMMON_BASE + 7 ) +#define STR_QUERY_INVALID_LIKE_STRING ( STR_COMMON_BASE + 8 ) +#define STR_QUERY_NOT_LIKE_TOO_COMPLEX ( STR_COMMON_BASE + 9 ) +#define STR_QUERY_LIKE_WILDCARD ( STR_COMMON_BASE + 10 ) +#define STR_QUERY_LIKE_WILDCARD_MANY ( STR_COMMON_BASE + 11 ) +#define STR_INVALID_COLUMNNAME ( STR_COMMON_BASE + 12 ) +#define STR_NO_CLASSNAME ( STR_COMMON_BASE + 13 ) +#define STR_NO_CLASSNAME_PATH ( STR_COMMON_BASE + 14 ) +#define STR_UNKNOWN_PARA_TYPE ( STR_COMMON_BASE + 15 ) +#define STR_INVALID_COLUMN_SELECTION ( STR_COMMON_BASE + 16 ) +#define STR_PARA_ONLY_PREPARED ( STR_COMMON_BASE + 17 ) +#define STR_COLUMN_NOT_UPDATEABLE ( STR_COMMON_BASE + 18 ) +#define STR_ROW_ALREADY_DELETED ( STR_COMMON_BASE + 19 ) +#define STR_UNKNOWN_COLUMN_TYPE ( STR_COMMON_BASE + 20 ) +#define STR_FORMULA_WRONG ( STR_COMMON_BASE + 21 ) +#define STR_NO_JAVA ( STR_COMMON_BASE + 22 ) +#define STR_NO_RESULTSET ( STR_COMMON_BASE + 23 ) +#define STR_NO_ROWCOUNT ( STR_COMMON_BASE + 24 ) +#define STR_ERRORMSG_SEQUENCE ( STR_COMMON_BASE + 25 ) +#define STR_INVALID_INDEX ( STR_COMMON_BASE + 26 ) +#define STR_UNSUPPORTED_FUNCTION ( STR_COMMON_BASE + 27 ) +#define STR_UNSUPPORTED_FEATURE ( STR_COMMON_BASE + 28 ) +#define STR_UNKNOWN_COLUMN_NAME ( STR_COMMON_BASE + 29 ) +#define STR_INVALID_PARA_COUNT ( STR_COMMON_BASE + 30 ) +#define STR_PRIVILEGE_NOT_GRANTED ( STR_COMMON_BASE + 31 ) +#define STR_PRIVILEGE_NOT_REVOKED ( STR_COMMON_BASE + 32 ) +#define STR_INVALID_BOOKMARK ( STR_COMMON_BASE + 33 ) +#define STR_NO_ELEMENT_NAME ( STR_COMMON_BASE + 34 ) +#define STR_NO_INPUTSTREAM ( STR_COMMON_BASE + 35 ) +#define STR_INPUTSTREAM_WRONG_LEN ( STR_COMMON_BASE + 36 ) +#define STR_WRONG_PARAM_INDEX ( STR_COMMON_BASE + 37 ) +#define STR_NO_CONNECTION_GIVEN ( STR_COMMON_BASE + 38 ) #endif // CONNECTIVITY_RESOURCE_COMMON_HRC diff --git a/connectivity/source/inc/resource/conn_shared_res.hrc b/connectivity/source/inc/resource/conn_shared_res.hrc index 02456d5a4d..83f5b7ed8c 100644 --- a/connectivity/source/inc/resource/conn_shared_res.hrc +++ b/connectivity/source/inc/resource/conn_shared_res.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: conn_shared_res.hrc,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.56.1 $ * * This file is part of OpenOffice.org. * @@ -43,6 +43,29 @@ // Spreadsheet driver resource ids #define STR_CALC_BASE 1300 +// DBase driver resource ids +#define STR_DBASE_BASE 1400 + +// ADO driver resource ids +#define STR_ADO_BASE 1450 + +// EVOAB2 driver resource ids +#define STR_EVOAB2_BASE 1500 + +// FILE driver resource ids +#define STR_FILE_BASE 1550 + +// KAB driver resource ids +#define STR_KAB_BASE 1600 + +// MACAB driver resource ids +#define STR_MACAB_BASE 1650 + +// Adabas D driver resource ids +#define STR_ADABAS_BASE 1700 + +// hsqldb driver resource ids +#define STR_HSQLDB_BASE 1750 // ============================================================================ // = resource ids for log messages #define STR_LOG_MESSAGE_BASE 10000 diff --git a/connectivity/source/inc/resource/mozab_res.hrc b/connectivity/source/inc/resource/mozab_res.hrc index e3aaf54c64..7eebfd99c3 100644 --- a/connectivity/source/inc/resource/mozab_res.hrc +++ b/connectivity/source/inc/resource/mozab_res.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: mozab_res.hrc,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.56.3 $ * * This file is part of OpenOffice.org. * @@ -54,10 +54,22 @@ #define STR_FOREIGN_PROCESS_CHANGED_AB ( STR_MOZAB_BASE + 12 ) #define STR_CANT_FIND_ROW ( STR_MOZAB_BASE + 13 ) #define STR_CANT_FIND_CARD_FOR_ROW ( STR_MOZAB_BASE + 14 ) -#define STR_URI_SYNTAX_ERROR ( STR_MOZAB_BASE + 15 ) +#define STR_QUERY_INVALID_IS_NULL_COLUMN ( STR_MOZAB_BASE + 15 ) #define STR_NO_HOSTNAME ( STR_MOZAB_BASE + 16 ) #define STR_NO_BASEDN ( STR_MOZAB_BASE + 17 ) #define STR_COULD_NOT_CONNECT_LDAP ( STR_MOZAB_BASE + 18 ) +#define STR_ERROR_REFRESH_ROW ( STR_MOZAB_BASE + 19 ) +#define STR_ILLEGAL_MOVEMENT ( STR_MOZAB_BASE + 20 ) +#define STR_ERROR_GET_ROW ( STR_MOZAB_BASE + 21 ) +#define STR_COMMIT_ROW ( STR_MOZAB_BASE + 22 ) +#define STR_INVALID_ROW_UPDATE ( STR_MOZAB_BASE + 23 ) +#define STR_ROW_CAN_NOT_SAVE ( STR_MOZAB_BASE + 24 ) +#define STR_CAN_NOT_CANCEL_ROW_UPDATE ( STR_MOZAB_BASE + 25 ) +#define STR_CAN_NOT_CREATE_ROW ( STR_MOZAB_BASE + 26 ) +#define STR_QUERY_AT_LEAST_ONE_TABLES ( STR_MOZAB_BASE + 27 ) +#define STR_NO_COUNT_SUPPORT ( STR_MOZAB_BASE + 28 ) +#define STR_STMT_TYPE_NOT_SUPPORTED ( STR_MOZAB_BASE + 29 ) +#define STR_COULD_NOT_LOAD_LIB ( STR_MOZAB_BASE + 30 ) #endif // CONNECTIVITY_RESOURCE_MOZAB_HRC diff --git a/connectivity/source/inc/resource/sharedresources.hxx b/connectivity/source/inc/resource/sharedresources.hxx index 48beeeae50..0799ffa1da 100644 --- a/connectivity/source/inc/resource/sharedresources.hxx +++ b/connectivity/source/inc/resource/sharedresources.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: sharedresources.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.56.1 $ * * This file is part of OpenOffice.org. * @@ -34,7 +34,6 @@ /** === begin UNO includes === **/ /** === end UNO includes === **/ -#include <tools/solar.h> #include <rtl/ustring.hxx> //........................................................................ @@ -42,7 +41,7 @@ namespace connectivity { //........................................................................ - typedef USHORT ResourceId; + typedef sal_uInt16 ResourceId; //==================================================================== //= SharedResources //==================================================================== @@ -62,9 +61,9 @@ namespace connectivity the string from the resource file */ ::rtl::OUString - getResurceString( + getResourceString( ResourceId _nResId - ); + ) const; /** loads a string from the shared resource file, and replaces a given ASCII pattern with a given string @@ -84,7 +83,7 @@ namespace connectivity ResourceId _nResId, const sal_Char* _pAsciiPatternToReplace, const ::rtl::OUString& _rStringToSubstitute - ); + ) const; /** loads a string from the shared resource file, and replaces a given ASCII pattern with a given string @@ -110,7 +109,7 @@ namespace connectivity const ::rtl::OUString& _rStringToSubstitute1, const sal_Char* _pAsciiPatternToReplace2, const ::rtl::OUString& _rStringToSubstitute2 - ); + ) const; /** loads a string from the shared resource file, and replaces a given ASCII pattern with a given string @@ -142,7 +141,7 @@ namespace connectivity const ::rtl::OUString& _rStringToSubstitute2, const sal_Char* _pAsciiPatternToReplace3, const ::rtl::OUString& _rStringToSubstitute3 - ); + ) const; }; //........................................................................ diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index 0613f4af23..28dcb86a72 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -9,7 +9,7 @@ // // $RCSfile: sqlbison.y,v $ // -// $Revision: 1.67 $ +// $Revision: 1.66.6.5 $ // // This file is part of OpenOffice.org. // @@ -1094,53 +1094,68 @@ boolean_term: } | row_value_constructor_elem /*[^')' ',']*/ { - $$ = SQL_NEW_RULE; - sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$1); - if(nErg == 1) + if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) { - OSQLParseNode* pTemp = $$; - $$ = pTemp->removeAt((sal_uInt32)0); - delete pTemp; + $$ = SQL_NEW_RULE; + sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$1); + if(nErg == 1) + { + OSQLParseNode* pTemp = $$; + $$ = pTemp->removeAt((sal_uInt32)0); + delete pTemp; + } + else + { + delete $$; + if(nErg) + YYERROR; + else + YYABORT; + } } else - { - delete $$; - if(nErg) - YYERROR; - else - YYABORT; - } + YYERROR; } | boolean_term SQL_TOKEN_AND literal { - $$ = SQL_NEW_RULE; - $$->append($1); - $$->append($2); - sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3); - if(nErg < 1) + if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) { - delete $$; - if(nErg) - YYERROR; - else - YYABORT; + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3); + if(nErg < 1) + { + delete $$; + if(nErg) + YYERROR; + else + YYABORT; + } } + else + YYERROR; } | boolean_term SQL_TOKEN_AND SQL_TOKEN_STRING { - $$ = SQL_NEW_RULE; - $$->append($1); - $$->append($2); - sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3); - if(nErg < 1) + if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) { - delete $$; - if(nErg) - YYERROR; - else - YYABORT; + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3); + if(nErg < 1) + { + delete $$; + if(nErg) + YYERROR; + else + YYABORT; + } } + else + YYERROR; } ; @@ -2841,25 +2856,39 @@ trim_fct: } ; trim_operands: - string_value_exp - | trim_spec value_exp SQL_TOKEN_FROM value_exp - { + trim_spec value_exp SQL_TOKEN_FROM value_exp + { $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); $$->append($3); $$->append($4); } - | trim_spec SQL_TOKEN_FROM value_exp - { + | trim_spec SQL_TOKEN_FROM value_exp + { $$ = SQL_NEW_RULE; $$->append($1); $$->append($2); $$->append($3); } + | value_exp SQL_TOKEN_FROM value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | SQL_TOKEN_FROM value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | value_exp ; + trim_spec: - SQL_TOKEN_BOTH + SQL_TOKEN_BOTH | SQL_TOKEN_LEADING | SQL_TOKEN_TRAILING ; diff --git a/connectivity/source/resource/conn_shared_res.src b/connectivity/source/resource/conn_shared_res.src index 68264f3608..de65d9459b 100644 --- a/connectivity/source/resource/conn_shared_res.src +++ b/connectivity/source/resource/conn_shared_res.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: conn_shared_res.src,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.30.2 $ * * This file is part of OpenOffice.org. * @@ -28,9 +28,17 @@ * ************************************************************************/ -#include "resource/common_res.hrc" +// #include "resource/common_res.hrc" #include "resource/mozab_res.hrc" +#include "resource/macab_res.hrc" #include "resource/calc_res.hrc" +#include "resource/ado_res.hrc" +#include "resource/dbase_res.hrc" +#include "resource/file_res.hrc" +#include "resource/evoab2_res.hrc" +#include "resource/kab_res.hrc" +#include "resource/adabas_res.hrc" +#include "resource/hsqldb_res.hrc" // ============================================================================ // = the mozab driver's resource strings @@ -114,7 +122,63 @@ String STR_CANT_FIND_CARD_FOR_ROW // ============================================================================ // = common strings // ============================================================================ +String STR_NO_CONNECTION_GIVEN +{ + Text [ en-US ] = "It doesn't exist a connection to the database."; +}; +String STR_WRONG_PARAM_INDEX +{ + Text [ en-US ] = "You tried to set a parameter at position '$pos$' but there is/are only '$count$' parameter(s) allowed. One reason may be that the property \"ParameterNameSubstitution\" is not set to TRUE in the data source."; +}; +String STR_INPUTSTREAM_WRONG_LEN +{ + Text [ en-US ] = "End of InputStream reached before satisfying length specified when InputStream was set."; +}; +String STR_NO_INPUTSTREAM +{ + Text [ en-US ] = "The input stream was not set."; +}; +String STR_NO_ELEMENT_NAME +{ + Text [ en-US ] = "There is no element named '$name$'."; +}; +String STR_INVALID_BOOKMARK +{ + Text [ en-US ] = "Invalid bookmark value"; +}; +String STR_PRIVILEGE_NOT_GRANTED +{ + Text [ en-US ] = "Privilege not granted: Only table privileges can be granted."; +}; +String STR_PRIVILEGE_NOT_REVOKED +{ + Text [ en-US ] = "Privilege not revoked: Only table privileges can be revoked."; +}; +String STR_UNKNOWN_COLUMN_NAME +{ + Text [ en-US ] = "The column name '$columnname$' is unknown."; +}; +String STR_ERRORMSG_SEQUENCE +{ + Text [ en-US ] = "Function sequence error."; +}; +String STR_INVALID_INDEX +{ + Text [ en-US ] = "Invalid descriptor index."; +}; +String STR_UNSUPPORTED_FUNCTION +{ + Text [ en-US ] = "The driver does not support the function '$functionname$'."; +}; +String STR_UNSUPPORTED_FEATURE +{ + Text [ en-US ] = "The driver does not support the functionality for '$featurename$'. It is not implemented."; +}; +String STR_FORMULA_WRONG +{ + Text [ en-US ] = "The formula for TypeInfoSettings is wrong!"; +}; String STR_STRING_LENGTH_EXCEEDED { Text [ en-US ] = "The string '$string$' exceeds the maximum length of $maxlen$ characters when converted to the target character set '$charset$'."; @@ -130,6 +194,48 @@ String STR_URI_SYNTAX_ERROR Text [ en-US ] = "The connection URL is invalid."; }; +String STR_QUERY_TOO_COMPLEX +{ + Text [ en-US ] = "The query can not be executed. It is too complex."; +}; +String STR_OPERATOR_TOO_COMPLEX +{ + Text [ en-US ] = "The query can not be executed. The operator is too complex."; +}; +String STR_QUERY_INVALID_LIKE_COLUMN +{ + Text [ en-US ] = "The query can not be executed. The 'LIKE' can only be used with a column name."; +}; +String STR_QUERY_INVALID_LIKE_STRING +{ + Text [ en-US ] = "The query can not be executed. The 'LIKE' can only be used with a string argument."; +}; +String STR_QUERY_NOT_LIKE_TOO_COMPLEX +{ + Text [ en-US ] = "The query can not be executed. The 'NOT LIKE' is too complex."; +}; +String STR_QUERY_LIKE_WILDCARD +{ + Text [ en-US ] = "The query can not be executed. The 'LIKE' statement contains wildcard in the middle."; +}; +String STR_QUERY_LIKE_WILDCARD_MANY +{ + Text [ en-US ] = "The query can not be executed. The 'LIKE' statement contains too many wildcards."; +}; +String STR_INVALID_COLUMNNAME +{ + Text [ en-US ] = "The column name '$columnname$' is not valid."; +}; +String STR_INVALID_COLUMN_SELECTION +{ + Text [ en-US ] = "The statement contains an invalid selection of columns."; +}; +String STR_COLUMN_NOT_UPDATEABLE +{ + Text [ en-US ] = "The column at position '$position$' could not be updated."; +}; + +// String STR_NO_HOSTNAME { Text [ en-US ] = "No hostname was provided."; @@ -149,6 +255,11 @@ String STR_COULD_NOT_CONNECT_LDAP // = the mozab driver's resource strings // ============================================================================ +String STR_COULD_NOT_LOAD_LIB +{ + Text [ en-US ] = "The library '$libname$' could not be loaded."; +}; + String STR_COULD_NOT_LOAD_FILE { Text [ en-US ] = "The file $filename$ could not be loaded."; @@ -158,3 +269,359 @@ String STR_LOAD_FILE_ERROR_MESSAGE { Text [ en-US ] = "The attempt to load the file resulted in the following error message ($exception_type$):\n\n$error_message$"; }; + +String STR_ERROR_REFRESH_ROW +{ + Text [ en-US ] = "An error occured while refreshing the current row."; +}; + +String STR_ERROR_GET_ROW +{ + Text [ en-US ] = "An error occured while getting the current row."; +}; +String STR_CAN_NOT_CANCEL_ROW_UPDATE +{ + Text [ en-US ] = "The row update can not be canceled."; +}; + +String STR_CAN_NOT_CREATE_ROW +{ + Text [ en-US ] = "A new row can not be created."; +}; + +String STR_QUERY_INVALID_IS_NULL_COLUMN +{ + Text [ en-US ] = "The query can not be executed. The 'IS NULL' can only be used with a column name."; +}; + +String STR_ILLEGAL_MOVEMENT +{ + Text [ en-US ] = "Illegal cursor movement occured."; +}; + +String STR_COMMIT_ROW +{ + Text [ en-US ] = "Please commit row '$position$' before update rows or insert new rows."; +}; + +String STR_INVALID_ROW_UPDATE +{ + Text [ en-US ] = "The update call can not be executed. The row is invalid."; +}; + +String STR_ROW_CAN_NOT_SAVE +{ + Text [ en-US ] = "The current row can not be saved."; +}; + +String STR_QUERY_AT_LEAST_ONE_TABLES +{ + Text [ en-US ] = "The query can not be executed. It needs at least one table."; +}; + +String STR_NO_COUNT_SUPPORT +{ + Text [ en-US ] = "The driver does not support the 'COUNT' function."; +}; +String STR_STMT_TYPE_NOT_SUPPORTED +{ + Text [ en-US ] = "This statement type not supported by this database driver."; +}; +// ============================================================================ +// = the ado driver's resource strings +// ============================================================================ +String STR_TYPE_NOT_CONVERT +{ + Text [ en-US ] = "The type could not be converted."; +}; +String STR_INVALID_COLUMN_DESCRIPTOR_ERROR +{ + Text [ en-US ] = "Could not append column: invalid column descriptor."; +}; + +String STR_INVALID_GROUP_DESCRIPTOR_ERROR +{ + Text [ en-US ] = "Could not create group: invalid object descriptor."; +}; +String STR_INVALID_INDEX_DESCRIPTOR_ERROR +{ + Text [ en-US ] = "Could not create index: invalid object descriptor."; +}; +String STR_INVALID_KEY_DESCRIPTOR_ERROR +{ + Text [ en-US ] = "Could not create key: invalid object descriptor."; +}; + +String STR_INVALID_TABLE_DESCRIPTOR_ERROR +{ + Text [ en-US ] = "Could not create table: invalid object descriptor."; +}; + +String STR_INVALID_USER_DESCRIPTOR_ERROR +{ + Text [ en-US ] = "Could not create user: invalid object descriptor."; +}; + +String STR_INVALID_VIEW_DESCRIPTOR_ERROR +{ + Text [ en-US ] = "Could not create view: invalid object descriptor."; +}; + +String STR_VIEW_NO_COMMAND_ERROR +{ + Text [ en-US ] = "Could not create view: no command object."; +}; + +// dbase +String STR_COULD_NOT_DELETE_INDEX +{ + Text [ en-US ] = "The index could not be deleted. An unknown error while accessing the file system occured."; +}; +String STR_ONL_ONE_COLUMN_PER_INDEX +{ + Text [ en-US ] = "The index could not be created. Only one column per index is allowed."; +}; +String STR_COULD_NOT_CREATE_INDEX_NOT_UNIQUE +{ + Text [ en-US ] = "The index could not be created. The values are not unique."; +}; + +String STR_COULD_NOT_CREATE_INDEX +{ + Text [ en-US ] = "The index could not be created. An unknown error appeared."; +}; +String STR_COULD_NOT_CREATE_INDEX_NAME +{ + Text [ en-US ] = "The index could not be created. The file '$filename$' is used by an other index."; +}; + +String STR_SQL_NAME_ERROR +{ + Text [ en-US ] = "The name '$name$' doesn't match SQL naming constraints."; +}; +String STR_COULD_NOT_DELETE_FILE +{ + Text [ en-US ] = "The file $filename$ could not be deleted."; +}; + +String STR_INVALID_COLUMN_TYPE +{ + Text [ en-US ] = "Invalid column type for column '$columnname$'."; +}; +String STR_INVALID_COLUMN_PRECISION +{ + Text [ en-US ] = "Invalid precision for column '$columnname$'."; +}; + +String STR_INVALID_PRECISION_SCALE +{ + Text [ en-US ] = "Precision is less than scale for column '$columnname$'."; +}; + +String STR_INVALID_COLUMN_NAME_LENGTH +{ + Text [ en-US ] = "Invalid column name length for column '$columnname$'."; +}; + +String STR_DUPLICATE_VALUE_IN_COLUMN +{ + Text [ en-US ] = "Duplicate value found in column '$columnname$'."; +}; + +String STR_INVALID_COLUMN_DECIMAL_VALUE +{ + Text [ en-US ] = "The '$columnname$' column has been defined as a \"Decimal\" type, the max. length is $precision$ characters (with $scale$ decimal places).\n\nThe specified value is longer than the number of digits allowed."; +}; + +String STR_COLUMN_NOT_ALTERABLE +{ + Text [ en-US ] = "The column '$columnname$' could not be altered. May be the file system is write protected."; +}; +String STR_INVALID_COLUMN_VALUE +{ + Text [ en-US ] = "The column '$columnname$' could not be updated. The value is invalid for that column."; +}; +String STR_COLUMN_NOT_ADDABLE +{ + Text [ en-US ] = "The column '$columnname$' could not be added. May be the file system is write protected."; +}; +String STR_COLUMN_NOT_DROP +{ + Text [ en-US ] = "The column at position '$position$' could not be dropped. May be the file system is write protected."; +}; +String STR_TABLE_NOT_DROP +{ + Text [ en-US ] = "The table '$tablename$' could not be dropped. May be the file system is write protected."; +}; +String STR_COULD_NOT_ALTER_TABLE +{ + Text [ en-US ] = "The table could not be altered."; +}; + +String STR_INVALID_DBASE_FILE +{ + Text [ en-US ] = "The file '$filename$' is an invalid (or unrecognized) dBase file."; +}; + +// Evoab2 + +String STR_USE_WHERE_CRIT +{ + Text [ en-US ] = "Use the SQL query with \"where clause\" or \"criteria\", to get the results."; +}; + +// File +String STR_QUERY_COMPLEX_COUNT +{ + Text [ en-US ] = "The query can not be executed. It is too complex. Only \"COUNT(*)\" is supported."; +}; +String STR_QUERY_INVALID_BETWEEN +{ + Text [ en-US ] = "The query can not be executed. The 'BETWEEN' arguments are not correct."; +}; +String STR_QUERY_FUNCTION_NOT_SUPPORTED +{ + Text [ en-US ] = "The query can not be executed. The function is not supported."; +}; +String STR_TABLE_READONLY +{ + Text [ en-US ] = "The table can not be changed. It is read only."; +}; +String STR_DELETE_ROW +{ + Text [ en-US ] = "The row could not be deleted. The option \"Display inactive records\" is set."; +}; +String STR_ROW_ALREADY_DELETED +{ + Text [ en-US ] = "The row could not be deleted. It is already deleted."; +}; +String STR_QUERY_MORE_TABLES +{ + Text [ en-US ] = "The query can not be executed. It is contains more then one table."; +}; +String STR_QUERY_NO_TABLE +{ + Text [ en-US ] = "The query can not be executed. It contains no valid table."; +}; +String STR_QUERY_NO_COLUMN +{ + Text [ en-US ] = "The query can not be executed. It contains no valid columns."; +}; +String STR_INVALID_PARA_COUNT +{ + Text [ en-US ] = "The count of the given parameter values doesn't match the parameters."; +}; +String STR_NO_VALID_FILE_URL +{ + Text [ en-US ] = "The URL '$URL$' is not valid. A connection can not be created."; +}; + + +String STR_NO_CLASSNAME +{ + Text [ en-US ] = "The driver class '$classname$' could not be loaded."; +}; +String STR_NO_JAVA +{ + Text [ en-US ] = "No Java installation could be found. Please check your installation."; +}; +String STR_NO_RESULTSET +{ + Text [ en-US ] = "The execution of the query doesn't return a valid result set."; +}; +String STR_NO_ROWCOUNT +{ + Text [ en-US ] = "The execution of the update statement doesn't effect any rows."; +}; + +String STR_NO_CLASSNAME_PATH +{ + Text [ en-US ] = "The additional driver class path is '$classpath$'."; +}; +String STR_UNKNOWN_PARA_TYPE +{ + Text [ en-US ] = "The type of parameter at position '$position$' is unknown."; +}; +String STR_UNKNOWN_COLUMN_TYPE +{ + Text [ en-US ] = "The type of column at position '$position$' is unknown."; +}; + +// KAB + +String STR_NO_KDE_INST +{ + Text [ en-US ] = "No suitable KDE installation was found."; +}; + +String STR_KDE_VERSION_TOO_OLD +{ + Text [ en-US ] = "KDE version $major$.$minor$ or higher is required to access the KDE Address Book."; +}; +String STR_KDE_VERSION_TOO_NEW +{ + Text [ en-US ] = "The found KDE version is too new. Only KDE up to version $major$.$minor$ is known to work with this product.\n"; +}; +String STR_KDE_VERSION_TOO_NEW_WORK_AROUND +{ + Text [ en-US ] = "If you are sure that your KDE version works, you might execute the following Basic macro to disable this version check:\n\n"; +}; +String STR_PARA_ONLY_PREPARED +{ + Text [ en-US ] = "Parameters can appear only in prepared statements."; +}; + +// MACAB +String STR_NO_TABLE +{ + Text [ en-US ] = "No such table!"; +}; + +String STR_NO_MAC_OS_FOUND +{ + Text [ en-US ] = "No suitable Mac OS installation was found."; +}; + +// ADABAS D +String STR_NO_DISK_SPACE +{ + Text [ en-US ] = "The database file '$filename$' could not be created. Please check your disk space."; +}; + +String STR_COMMAND_NOT_FOUND +{ + Text [ en-US ] = "The database '$databasename$' could not be started because the command '$progname$' could not be executed."; +}; +String STR_DATABASE_NEEDS_CONVERTING +{ + Text [ en-US ] = "The current database need to be converted. Please insert control user and password."; +}; +String STR_USER_NO_DELETE +{ + Text [ en-US ] = "This user couldn't be deleted. Otherwise the database stays in a inconsistent state."; +}; +// hsqldb +String STR_NO_STROAGE +{ + Text [ en-US ] = "The connection can not be established. No storage or URL was given."; +}; +String STR_INVALID_FILE_URL +{ + Text [ en-US ] = "The given URL contains no valid local file system path. Please check the location of your database file."; +}; +String STR_NO_TABLE_CONTAINER +{ + Text [ en-US ] = "An error occured while obtaining the connection's table container."; +}; +String STR_NO_TABLE_EDITOR_DIALOG +{ + Text [ en-US ] = "An error occured while creating the table editor dialog."; +}; +String STR_NO_TABLENAME +{ + Text [ en-US ] = "There is no table named '$tablename$'."; +}; +String STR_NO_DOCUMENTUI +{ + Text [ en-US ] = "The provided DocumentUI is not allowed to be NULL."; +}; diff --git a/connectivity/source/resource/sharedresources.cxx b/connectivity/source/resource/sharedresources.cxx index b115499b6d..58560ce531 100644 --- a/connectivity/source/resource/sharedresources.cxx +++ b/connectivity/source/resource/sharedresources.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: sharedresources.cxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.56.1 $ * * This file is part of OpenOffice.org. * @@ -189,14 +189,14 @@ namespace connectivity } //-------------------------------------------------------------------- - ::rtl::OUString SharedResources::getResurceString( ResourceId _nResId ) + ::rtl::OUString SharedResources::getResourceString( ResourceId _nResId ) const { return SharedResources_Impl::getInstance().getResourceString( _nResId ); } //-------------------------------------------------------------------- ::rtl::OUString SharedResources::getResourceStringWithSubstitution( ResourceId _nResId, - const sal_Char* _pAsciiPatternToReplace, const ::rtl::OUString& _rStringToSubstitute ) + const sal_Char* _pAsciiPatternToReplace, const ::rtl::OUString& _rStringToSubstitute ) const { ::rtl::OUString sString( SharedResources_Impl::getInstance().getResourceString( _nResId ) ); OSL_VERIFY( lcl_substitute( sString, _pAsciiPatternToReplace, _rStringToSubstitute ) ); @@ -206,7 +206,7 @@ namespace connectivity //-------------------------------------------------------------------- ::rtl::OUString SharedResources::getResourceStringWithSubstitution( ResourceId _nResId, const sal_Char* _pAsciiPatternToReplace1, const ::rtl::OUString& _rStringToSubstitute1, - const sal_Char* _pAsciiPatternToReplace2, const ::rtl::OUString& _rStringToSubstitute2 ) + const sal_Char* _pAsciiPatternToReplace2, const ::rtl::OUString& _rStringToSubstitute2 ) const { ::rtl::OUString sString( SharedResources_Impl::getInstance().getResourceString( _nResId ) ); OSL_VERIFY( lcl_substitute( sString, _pAsciiPatternToReplace1, _rStringToSubstitute1 ) ); @@ -218,7 +218,7 @@ namespace connectivity ::rtl::OUString SharedResources::getResourceStringWithSubstitution( ResourceId _nResId, const sal_Char* _pAsciiPatternToReplace1, const ::rtl::OUString& _rStringToSubstitute1, const sal_Char* _pAsciiPatternToReplace2, const ::rtl::OUString& _rStringToSubstitute2, - const sal_Char* _pAsciiPatternToReplace3, const ::rtl::OUString& _rStringToSubstitute3 ) + const sal_Char* _pAsciiPatternToReplace3, const ::rtl::OUString& _rStringToSubstitute3 ) const { ::rtl::OUString sString( SharedResources_Impl::getInstance().getResourceString( _nResId ) ); OSL_VERIFY( lcl_substitute( sString, _pAsciiPatternToReplace1, _rStringToSubstitute1 ) ); diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx index 69ac2d6ea0..bf10269535 100644 --- a/connectivity/source/sdbcx/VCollection.cxx +++ b/connectivity/source/sdbcx/VCollection.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: VCollection.cxx,v $ - * $Revision: 1.43 $ + * $Revision: 1.43.56.2 $ * * This file is part of OpenOffice.org. * @@ -42,6 +42,8 @@ #include <comphelper/property.hxx> #include "TConnection.hxx" #include <rtl/ustrbuf.hxx> +#include "resource/common_res.hrc" +#include "resource/sharedresources.hxx" using namespace connectivity::sdbcx; using namespace connectivity; @@ -332,12 +334,12 @@ Any SAL_CALL OCollection::getByName( const ::rtl::OUString& aName ) throw(NoSuch if ( !m_pElements->exists(aName) ) { - ::rtl::OUStringBuffer aMessage; - aMessage.appendAscii( "There is no element named '" ); - aMessage.append( aName ); - aMessage.appendAscii( "'." ); - // TODO: resource - throw NoSuchElementException( aMessage.makeStringAndClear(), static_cast< XTypeProvider* >( this ) ); + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_NO_ELEMENT_NAME, + "$name$", aName + ) ); + throw NoSuchElementException( sError, static_cast< XTypeProvider* >( this ) ); } return makeAny(getObject(m_pElements->findColumn(aName))); @@ -454,7 +456,14 @@ void OCollection::notifyElementRemoved(const ::rtl::OUString& _sName) sal_Int32 SAL_CALL OCollection::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) { if ( !m_pElements->exists(columnName) ) - ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii( "Unknown column name." ), static_cast<XTypeProvider*>(this) ); + { + ::connectivity::SharedResources aResources; + const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( + STR_UNKNOWN_COLUMN_NAME, + "$columnname$", columnName + ) ); + ::dbtools::throwGenericSQLException(sError,static_cast< XIndexAccess*>(this)); + } return m_pElements->findColumn(columnName) + 1; // because columns start at one } diff --git a/framework/source/helper/titlehelper.cxx b/framework/source/helper/titlehelper.cxx index 823cad38c1..1f043e3a19 100644 --- a/framework/source/helper/titlehelper.cxx +++ b/framework/source/helper/titlehelper.cxx @@ -8,7 +8,7 @@ * * $RCSfile: titlehelper.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.4.54.1 $ * * This file is part of OpenOffice.org. * @@ -454,6 +454,8 @@ void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css: nLeasedNumber = xNumbers->leaseNumber (xOwner); css::uno::Reference< css::frame::XTitle > xModelTitle(xController->getModel (), css::uno::UNO_QUERY); + if (!xModelTitle.is ()) + xModelTitle.set(xController, css::uno::UNO_QUERY); if (xModelTitle.is ()) { sTitle.append (xModelTitle->getTitle ()); |