Tag: cws_src680_dba30 User: fs Date: 06/03/21 06:57:41 Modified: /dba/connectivity/source/commontools/ dbexception.cxx
Log: RESYNC: (1.13-1.15); FILE MERGED 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.13.14.1&r2=1.13.14.2 Delta lines: +80 -4 -------------------- --- dbexception.cxx 4 Jan 2006 11:13:24 -0000 1.13.14.1 +++ dbexception.cxx 21 Mar 2006 14:57:34 -0000 1.13.14.2 @@ -387,6 +387,15 @@ throw SQLException(_rMsg,_Context,sStatus,0,_Next); } // ----------------------------------------------------------------------------- +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( ": Driver does not support this function: " ) ); + sMessage += ::rtl::OUString::createFromAscii( _pAsciiFunctionName ); + ::rtl::OUString sState( RTL_CONSTASCII_USTRINGPARAM( "IM001" ) ); + throw SQLException( sMessage, _rxContext, sState, 0, _pNextException ? *_pNextException : Any() ); +} +// ----------------------------------------------------------------------------- void throwGenericSQLException(const ::rtl::OUString& _rMsg, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSource) throw (::com::sun::star::sdbc::SQLException) { @@ -399,6 +408,73 @@ { static ::rtl::OUString sStatus = ::rtl::OUString::createFromAscii("S1000"); throw SQLException(_rMsg, _rxSource, sStatus, 0, _rNextException); +} + +// ----------------------------------------------------------------------------- +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." ) ); + ::rtl::OUString sState( RTL_CONSTASCII_USTRINGPARAM( "HYC00" ) ); + throw SQLException( sMessage, _rxContext, sState, 0, _pNextException ? *_pNextException : Any() ); +} + +// ----------------------------------------------------------------------------- +void throwSQLException( const sal_Char* _pAsciiMessage, const sal_Char* _pAsciiState, + const Reference< XInterface >& _rxContext, const sal_Int32 _nErrorCode, const Any* _pNextException ) throw (SQLException) +{ + throw SQLException( + ::rtl::OUString::createFromAscii( _pAsciiMessage ), + _rxContext, + ::rtl::OUString::createFromAscii( _pAsciiState ), + _nErrorCode, + _pNextException ? *_pNextException : Any() + ); +} + +// ----------------------------------------------------------------------------- +void throwSQLException( const sal_Char* _pAsciiMessage, StandardSQLState _eSQLState, + const Reference< XInterface >& _rxContext, const sal_Int32 _nErrorCode, + const Any* _pNextException ) throw (SQLException) +{ + throwSQLException( _pAsciiMessage, getStandardSQLStateAscii( _eSQLState ), _rxContext, _nErrorCode, _pNextException ); +} + +// ----------------------------------------------------------------------------- +const sal_Char* getStandardSQLStateAscii( StandardSQLState _eState ) +{ + const sal_Char* pAsciiState = NULL; + switch ( _eState ) + { + case SQL_WRONG_PARAMETER_NUMBER: pAsciiState = "07001"; break; + case SQL_INVALID_DESCRIPTOR_INDEX: pAsciiState = "07009"; break; + case SQL_UNABLE_TO_CONNECT: pAsciiState = "08001"; break; + case SQL_NUMERIC_OUT_OF_RANGE: pAsciiState = "22003"; break; + case SQL_INVALID_DATE_TIME: pAsciiState = "22007"; break; + case SQL_INVALID_CURSOR_STATE: pAsciiState = "24000"; break; + case SQL_TABLE_OR_VIEW_EXISTS: pAsciiState = "42S01"; break; + case SQL_TABLE_OR_VIEW_NOT_FOUND: pAsciiState = "42S02"; break; + case SQL_INDEX_ESISTS: pAsciiState = "42S11"; break; + case SQL_INDEX_NOT_FOUND: pAsciiState = "42S12"; break; + case SQL_COLUMN_EXISTS: pAsciiState = "42S21"; break; + case SQL_COLUMN_NOT_FOUND: pAsciiState = "42S22"; break; + case SQL_GENERAL_ERROR: pAsciiState = "HY000"; break; + case SQL_OPERATION_CANCELED: pAsciiState = "HY008"; break; + case SQL_FUNCTION_SEQUENCE_ERROR: pAsciiState = "HY010"; break; + case SQL_INVALID_CURSOR_POSITION: pAsciiState = "HY109"; break; + case SQL_INVALID_BOOKMARK_VALUE: pAsciiState = "HY111"; break; + case SQL_FEATURE_NOT_IMPLEMENTED: pAsciiState = "HYC00"; break; + case SQL_FUNCTION_NOT_SUPPORTED: pAsciiState = "IM001"; break; + } + if ( !pAsciiState ) + throw RuntimeException(); + return pAsciiState; +} + +// ----------------------------------------------------------------------------- +::rtl::OUString getStandardSQLState( StandardSQLState _eState ) +{ + return ::rtl::OUString::createFromAscii( getStandardSQLStateAscii( _eState ) ); } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
