Tag: cws_src680_qiq User: fs Date: 06/05/18 02:08:35 Modified: /dba/connectivity/source/commontools/ dbexception.cxx
Log: #i51143# SQLExceptionInfo::append 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.2&r2=1.15.56.3 Delta lines: +50 -2 -------------------- --- dbexception.cxx 18 May 2006 08:36:52 -0000 1.15.56.2 +++ dbexception.cxx 18 May 2006 09:08:32 -0000 1.15.56.3 @@ -4,9 +4,9 @@ * * $RCSfile: dbexception.cxx,v $ * - * $Revision: 1.15.56.2 $ + * $Revision: 1.15.56.3 $ * - * last change: $Author: fs $ $Date: 2006/05/18 08:36:52 $ + * last change: $Author: fs $ $Date: 2006/05/18 09:08:32 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -223,6 +223,54 @@ aException.SQLState = ::rtl::OUString::createFromAscii( _pAsciiSQLState ? _pAsciiSQLState : "S1000" ); aException.NextException = m_aContent; m_aContent <<= aException; + + m_eType = SQL_EXCEPTION; +} + +//------------------------------------------------------------------------------ +void SQLExceptionInfo::append( TYPE _eType, const ::rtl::OUString& _rErrorMessage, const sal_Char* _pAsciiSQLState, const sal_Int32 _nErrorCode ) +{ + // create the to-be-appended exception + Any aAppend; + switch ( _eType ) + { + case SQL_EXCEPTION: aAppend <<= SQLException(); break; + case SQL_WARNING: aAppend <<= SQLWarning(); break; + case SQL_CONTEXT: aAppend <<= SQLContext(); break; + default: + OSL_ENSURE( false, "SQLExceptionInfo::append: invalid exception type: this will crash!" ); + break; + } + + SQLException* pAppendException( static_cast< SQLException* >( const_cast< void* >( aAppend.getValue() ) ) ); + pAppendException->Message = _rErrorMessage; + pAppendException->SQLState = ::rtl::OUString::createFromAscii( _pAsciiSQLState ); + pAppendException->ErrorCode = _nErrorCode; + + // find the end of the current chain + Any* pChainIterator = &m_aContent; + SQLException* pLastException = NULL; + const Type& aSQLExceptionType( ::getCppuType< SQLException >() ); + while ( pChainIterator ) + { + if ( !pChainIterator->hasValue() ) + break; + + if ( !isAssignableFrom( aSQLExceptionType, pChainIterator->getValueType() ) ) + break; + + pLastException = static_cast< SQLException* >( const_cast< void* >( pChainIterator->getValue() ) ); + pChainIterator = &pLastException->NextException; + } + + // append + if ( pLastException ) + pLastException->NextException = aAppend; + else + { + m_aContent = aAppend; + m_eType = _eType; + } } //============================================================================== --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
