Tag: cws_src680_qiq User: fs Date: 2006/06/30 06:18:03 Modified: dba/connectivity/source/commontools/dbexception.cxx dba/connectivity/source/drivers/dbase/DIndexes.cxx dba/connectivity/source/drivers/dbase/DTable.cxx dba/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx dba/connectivity/source/drivers/mozab/MResultSet.cxx dba/connectivity/source/drivers/mysql/makefile.mk dba/connectivity/source/sdbcx/VCollection.cxx
Log: during #i51143#: PROPERTY_ID_HY0000 superseded by StandardSQLState.SQL_GENERAL_ERROR File Changes: Directory: /dba/connectivity/source/commontools/ ================================================ File [changed]: dbexception.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/dbexception.cxx?r1=1.15.56.6&r2=1.15.56.7 Delta lines: +27 -5 -------------------- --- dbexception.cxx 28 Jun 2006 08:40:40 -0000 1.15.56.6 +++ dbexception.cxx 30 Jun 2006 13:17:58 -0000 1.15.56.7 @@ -4,9 +4,9 @@ * * $RCSfile: dbexception.cxx,v $ * - * $Revision: 1.15.56.6 $ + * $Revision: 1.15.56.7 $ * - * last change: $Author: fs $ $Date: 2006/06/28 08:40:40 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:17:58 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -398,7 +398,13 @@ //------------------------------------------------------------ void throwFunctionSequenceException(const Reference< XInterface >& _Context, const Any& _Next) throw ( ::com::sun::star::sdbc::SQLException ) { - throw SQLException(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ERRORMSG_SEQUENCE), _Context, OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000), 0, _Next); + throw SQLException( + OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_ERRORMSG_SEQUENCE ), + _Context, + getStandardSQLState( SQL_FUNCTION_SEQUENCE_ERROR ), + 0, + _Next + ); } // ----------------------------------------------------------------------------- void throwInvalidIndexException(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context, @@ -450,8 +456,7 @@ void throwGenericSQLException(const ::rtl::OUString& _rMsg, const Reference< XInterface >& _rxSource, const Any& _rNextException) throw (SQLException) { - static ::rtl::OUString sStatus = ::rtl::OUString::createFromAscii("S1000"); - throw SQLException(_rMsg, _rxSource, sStatus, 0, _rNextException); + throw SQLException( _rMsg, _rxSource, getStandardSQLState( SQL_GENERAL_ERROR ), 0, _rNextException); } // ----------------------------------------------------------------------------- @@ -490,6 +495,20 @@ } // ----------------------------------------------------------------------------- +void throwSQLException( const ::rtl::OUString& _rMessage, StandardSQLState _eSQLState, + const Reference< XInterface >& _rxContext, const sal_Int32 _nErrorCode, + const Any* _pNextException ) throw (SQLException) +{ + throw SQLException( + _rMessage, + _rxContext, + getStandardSQLState( _eSQLState ), + _nErrorCode, + _pNextException ? *_pNextException : Any() + ); +} + +// ----------------------------------------------------------------------------- const sal_Char* getStandardSQLStateAscii( StandardSQLState _eState ) { const sal_Char* pAsciiState = NULL; @@ -515,6 +534,9 @@ case SQL_FEATURE_NOT_IMPLEMENTED: pAsciiState = "HYC00"; break; case SQL_FUNCTION_NOT_SUPPORTED: pAsciiState = "IM001"; break; case SQL_CONNECTION_DOES_NOT_EXIST: pAsciiState = "08003"; break; + + // OOoBase-specific SQLStates + case SQL_CYCLIC_SUB_QUERIES: pAsciiState = "OB001"; break; default: break; } Directory: /dba/connectivity/source/drivers/dbase/ ================================================== File [changed]: DIndexes.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/dbase/DIndexes.cxx?r1=1.14.104.2&r2=1.14.104.3 Delta lines: +17 -7 -------------------- --- DIndexes.cxx 27 Jun 2006 14:15:36 -0000 1.14.104.2 +++ DIndexes.cxx 30 Jun 2006 13:17:58 -0000 1.14.104.3 @@ -4,9 +4,9 @@ * * $RCSfile: DIndexes.cxx,v $ * - * $Revision: 1.14.104.2 $ + * $Revision: 1.14.104.3 $ * - * last change: $Author: fs $ $Date: 2006/06/27 14:15:36 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:17:58 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -38,6 +38,9 @@ #ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ #include "dbase/DIndex.hxx" #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include <connectivity/dbexception.hxx> +#endif #ifndef _UNOTOOLS_UCBHELPER_HXX #include <unotools/ucbhelper.hxx> #endif @@ -51,8 +54,9 @@ using namespace ::comphelper; using namespace utl; -using namespace connectivity; -using namespace connectivity::dbase; +using namespace ::connectivity; +using namespace ::dbtools; +using namespace ::connectivity::dbase; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbcx; @@ -72,7 +76,10 @@ sFile += _rName; sFile += ::rtl::OUString::createFromAscii(".ndx"); if(!UCBContentHelper::Exists(sFile)) - throw SQLException(::rtl::OUString::createFromAscii("Index file doesn't exists!"),*m_pTable,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); + ::dbtools::throwGenericSQLException( + ::rtl::OUString::createFromAscii( "Index file doesn't exists." ), + // TODO: resource + *m_pTable ); sdbcx::ObjectType xRet; SvStream* pFileStream = ::connectivity::file::OFileTable::createStream_simpleError(sFile,STREAM_READ | STREAM_NOCREATE| STREAM_SHARE_DENYWRITE); @@ -91,7 +98,10 @@ pIndex->openIndexFile(); } else - throw SQLException(::rtl::OUString::createFromAscii("Could not open index file"),*m_pTable,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); + ::dbtools::throwGenericSQLException( + ::rtl::OUString::createFromAscii( "Could not open index file."), + // TODO: resource + *m_pTable ); return xRet; } // ------------------------------------------------------------------------- File [changed]: DTable.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/dbase/DTable.cxx?r1=1.94&r2=1.94.2.1 Delta lines: +14 -12 --------------------- --- DTable.cxx 20 Jun 2006 01:21:12 -0000 1.94 +++ DTable.cxx 30 Jun 2006 13:17:58 -0000 1.94.2.1 @@ -4,9 +4,9 @@ * * $RCSfile: DTable.cxx,v $ * - * $Revision: 1.94 $ + * $Revision: 1.94.2.1 $ * - * last change: $Author: hr $ $Date: 2006/06/20 01:21:12 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:17:58 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -937,7 +937,7 @@ sMsg += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")); sMsg += _sColumnName; sMsg += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" !")); - throw SQLException(sMsg,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); + ::dbtools::throwGenericSQLException( sMsg, *this ); } //------------------------------------------------------------------ // erzeugt grundsaetzlich dBase IV Datei Format @@ -990,7 +990,7 @@ ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Invalid column name length for column: "); sMsg += aName; sMsg += ::rtl::OUString::createFromAscii("!"); - throw SQLException(sMsg,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); + ::dbtools::throwGenericSQLException( sMsg, *this ); } (*m_pFileStream) << aCol.getStr(); @@ -1105,16 +1105,16 @@ (*m_pFileStream) << (BYTE) dBaseIIIMemo; } // if (bCreateMemo) } - catch(const Exception& e) + catch ( const Exception& e ) { + (void)e; + try { // we have to drop the file because it is corrupted now DropImpl(); } - catch(const Exception&) - { - } + catch(const Exception&) { } throw; } return TRUE; @@ -1461,7 +1461,7 @@ } sMessage += aColName; sMessage += ::rtl::OUString::createFromAscii( "\"!"); - throw SQLException(sMessage,*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); + ::dbtools::throwGenericSQLException( sMessage, *this ); } } } @@ -1674,7 +1674,7 @@ throw SQLException( sMsg, *this, - bCharacterConversionError ? ::rtl::OUString::createFromAscii( "22018" ) : OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_HY0000 ), + bCharacterConversionError ? ::rtl::OUString::createFromAscii( "22018" ) : ::dbtools::getStandardSQLState( SQL_GENERAL_ERROR ), bCharacterConversionError ? 22018 : 1000, aSQLError ); @@ -2166,7 +2166,9 @@ String sName(m_Name); TempFile aTempFile(sName,&sExt,&sTempName); if(!aTempFile.IsValid()) - throw SQLException(::rtl::OUString::createFromAscii("Error while alter table!"),NULL,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); + ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii( "Error while alter table." ), + // TODO: resource + *this ); INetURLObject aURL; aURL.SetSmartProtocol(INET_PROT_FILE); Directory: /dba/connectivity/source/drivers/jdbc/ ================================================= File [changed]: DatabaseMetaData.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx?r1=1.22&r2=1.22.2.1 Delta lines: +4 -4 ------------------- --- DatabaseMetaData.cxx 20 Jun 2006 01:34:02 -0000 1.22 +++ DatabaseMetaData.cxx 30 Jun 2006 13:17:58 -0000 1.22.2.1 @@ -4,9 +4,9 @@ * * $RCSfile: DatabaseMetaData.cxx,v $ * - * $Revision: 1.22 $ + * $Revision: 1.22.2.1 $ * - * last change: $Author: hr $ $Date: 2006/06/20 01:34:02 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:17:58 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -1733,7 +1733,7 @@ ThrowSQLException(t.pEnv,*this); } //mID } //t.pEnv - return out; + return sal_True; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) Directory: /dba/connectivity/source/drivers/mozab/ ================================================== File [changed]: MResultSet.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MResultSet.cxx?r1=1.25.26.3&r2=1.25.26.4 Delta lines: +7 -12 -------------------- --- MResultSet.cxx 28 Jun 2006 08:45:21 -0000 1.25.26.3 +++ MResultSet.cxx 30 Jun 2006 13:17:59 -0000 1.25.26.4 @@ -4,9 +4,9 @@ * * $RCSfile: MResultSet.cxx,v $ * - * $Revision: 1.25.26.3 $ + * $Revision: 1.25.26.4 $ * - * last change: $Author: fs $ $Date: 2006/06/28 08:45:21 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:17:59 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -1728,9 +1728,7 @@ 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. ")) ; - throw SQLException(errorMsg,*this - ,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000) - ,1000,Any()); + ::dbtools::throwGenericSQLException( errorMsg, *this ); } } @@ -1915,16 +1913,13 @@ OSL_TRACE("deleteRow, m_nRowPos = %u", m_nRowPos ); ResultSetEntryGuard aGuard( *this ); if (rowDeleted()) - throw SQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Row Already deleted")) ,*this - ,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000) - ,1000,Any()); + ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Row Already deleted")), *this ); const sal_Int32 nCurrentRow = getCurrentCardNumber(); //fetchRow(nCurrentRow); if (!nCurrentRow) - throw SQLException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" Can't get Current Row")) ,*this - ,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000) - ,1000,Any()); + ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" Can't get Current Row")), *this ); + sal_Bool m_bRowDeleted = ( m_aQuery.deleteRow( nCurrentRow ) > 0 ); if (!m_bRowDeleted) m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ); Directory: /dba/connectivity/source/drivers/mysql/ ================================================== File [changed]: makefile.mk Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mysql/makefile.mk?r1=1.5&r2=1.5.104.1 Delta lines: +5 -4 ------------------- --- makefile.mk 8 Sep 2005 06:33:11 -0000 1.5 +++ makefile.mk 30 Jun 2006 13:17:59 -0000 1.5.104.1 @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.5.104.1 $ # -# last change: $Author: rt $ $Date: 2005/09/08 06:33:11 $ +# last change: $Author: fs $ $Date: 2006/06/30 13:17:59 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -80,7 +80,8 @@ $(OSLLIB) \ $(SALLIB) \ $(DBTOOLSLIB) \ - $(COMPHELPERLIB) + $(COMPHELPERLIB) \ + $(UNOTOOLSLIB) SHL1DEPN= Directory: /dba/connectivity/source/sdbcx/ ========================================== File [changed]: VCollection.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/sdbcx/VCollection.cxx?r1=1.38.20.2&r2=1.38.20.3 Delta lines: +18 -5 -------------------- --- VCollection.cxx 27 Jun 2006 15:11:49 -0000 1.38.20.2 +++ VCollection.cxx 30 Jun 2006 13:18:00 -0000 1.38.20.3 @@ -4,9 +4,9 @@ * * $RCSfile: VCollection.cxx,v $ * - * $Revision: 1.38.20.2 $ + * $Revision: 1.38.20.3 $ * - * last change: $Author: fs $ $Date: 2006/06/27 15:11:49 $ + * last change: $Author: fs $ $Date: 2006/06/30 13:18:00 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -40,6 +40,9 @@ #ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ #include "connectivity/sdbcx/VDescriptor.hxx" #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include "connectivity/dbexception.hxx" +#endif #ifndef _COMPHELPER_ENUMHELPER_HXX_ #include <comphelper/enumhelper.hxx> #endif @@ -55,6 +58,9 @@ #ifndef CONNECTIVITY_CONNECTION_HXX #include "TConnection.hxx" #endif +#ifndef _RTL_USTRBUF_HXX_ +#include <rtl/ustrbuf.hxx> +#endif using namespace connectivity::sdbcx; using namespace connectivity; @@ -344,7 +350,14 @@ ::osl::MutexGuard aGuard(m_rMutex); if ( !m_pElements->exists(aName) ) - throw NoSuchElementException(aName,static_cast<XTypeProvider*>(this)); + { + ::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 ) ); + } return makeAny(getObject(m_pElements->findColumn(aName))); } @@ -460,7 +473,7 @@ sal_Int32 SAL_CALL OCollection::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) { if ( !m_pElements->exists(columnName) ) - throw SQLException(::rtl::OUString::createFromAscii("Unknown column name!"),static_cast<XTypeProvider*>(this),OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,makeAny(NoSuchElementException(columnName,static_cast<XTypeProvider*>(this))) ); + ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii( "Unknown column name." ), static_cast<XTypeProvider*>(this) ); return m_pElements->findColumn(columnName) + 1; // because columns start at one } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
