diff options
author | Noel Grandin <noel@peralex.com> | 2016-02-25 13:38:38 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-02-25 13:50:26 +0200 |
commit | 414a66587b73dfc69c121118e9a6337de4e843d2 (patch) | |
tree | 425457f56fc3454bcea051b702fb8fa7340eea34 | |
parent | 960d4ebf76d3e7c757d2625a1e52a22556da9d40 (diff) |
convert StandardSQLState to scoped enum
Change-Id: Ia0a1526140cfed35a73a6fea1a173d2fb5005960
20 files changed, 99 insertions, 99 deletions
diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx index c46a0d807a5d..911c212d9f47 100644 --- a/connectivity/source/commontools/dbexception.cxx +++ b/connectivity/source/commontools/dbexception.cxx @@ -349,7 +349,7 @@ void throwFunctionSequenceException(const Reference< XInterface >& _Context, con throw SQLException( aResources.getResourceString(STR_ERRORMSG_SEQUENCE), _Context, - getStandardSQLState( SQL_FUNCTION_SEQUENCE_ERROR ), + getStandardSQLState( StandardSQLState::FUNCTION_SEQUENCE_ERROR ), 0, _Next ); @@ -362,7 +362,7 @@ void throwInvalidIndexException(const ::com::sun::star::uno::Reference< ::com::s throw SQLException( aResources.getResourceString(STR_INVALID_INDEX), _Context, - getStandardSQLState( SQL_INVALID_DESCRIPTOR_INDEX ), + getStandardSQLState( StandardSQLState::INVALID_DESCRIPTOR_INDEX ), 0, _Next ); @@ -380,7 +380,7 @@ void throwFunctionNotSupportedSQLException(const OUString& _rFunctionName, throw SQLException( sError, _rxContext, - getStandardSQLState( SQL_FUNCTION_NOT_SUPPORTED ), + getStandardSQLState( StandardSQLState::FUNCTION_NOT_SUPPORTED ), 0, _rNextException ); @@ -410,7 +410,7 @@ void throwGenericSQLException(const OUString& _rMsg, const ::com::sun::star::uno void throwGenericSQLException(const OUString& _rMsg, const Reference< XInterface >& _rxSource, const Any& _rNextException) throw (SQLException) { - throw SQLException( _rMsg, _rxSource, getStandardSQLState( SQL_GENERAL_ERROR ), 0, _rNextException); + throw SQLException( _rMsg, _rxSource, getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 0, _rNextException); } void throwFeatureNotImplementedSQLException( const OUString& _rFeatureName, const Reference< XInterface >& _rxContext, const Any* _pNextException ) @@ -425,7 +425,7 @@ void throwFeatureNotImplementedSQLException( const OUString& _rFeatureName, cons throw SQLException( sError, _rxContext, - getStandardSQLState( SQL_FEATURE_NOT_IMPLEMENTED ), + getStandardSQLState( StandardSQLState::FEATURE_NOT_IMPLEMENTED ), 0, _pNextException ? *_pNextException : Any() ); @@ -450,7 +450,7 @@ void throwInvalidColumnException( const OUString& _rColumnName, const Reference< OUString sErrorMessage( aResources.getResourceStringWithSubstitution( STR_INVALID_COLUMNNAME, "$columnname$",_rColumnName) ); - throwSQLException( sErrorMessage, SQL_COLUMN_NOT_FOUND, _rxContext ); + throwSQLException( sErrorMessage, StandardSQLState::COLUMN_NOT_FOUND, _rxContext ); } void throwSQLException( const OUString& _rMessage, const OUString& _rSQLState, @@ -478,27 +478,27 @@ OUString getStandardSQLState( StandardSQLState _eState ) { switch ( _eState ) { - case SQL_WRONG_PARAMETER_NUMBER: return OUString("07001"); - case SQL_INVALID_DESCRIPTOR_INDEX: return OUString("07009"); - case SQL_UNABLE_TO_CONNECT: return OUString("08001"); - case SQL_NUMERIC_OUT_OF_RANGE: return OUString("22003"); - case SQL_INVALID_DATE_TIME: return OUString("22007"); - case SQL_INVALID_CURSOR_STATE: return OUString("24000"); - case SQL_TABLE_OR_VIEW_EXISTS: return OUString("42S01"); - case SQL_TABLE_OR_VIEW_NOT_FOUND: return OUString("42S02"); - case SQL_INDEX_ESISTS: return OUString("42S11"); - case SQL_INDEX_NOT_FOUND: return OUString("42S12"); - case SQL_COLUMN_EXISTS: return OUString("42S21"); - case SQL_COLUMN_NOT_FOUND: return OUString("42S22"); - case SQL_GENERAL_ERROR: return OUString("HY000"); - case SQL_INVALID_SQL_DATA_TYPE: return OUString("HY004"); - case SQL_OPERATION_CANCELED: return OUString("HY008"); - case SQL_FUNCTION_SEQUENCE_ERROR: return OUString("HY010"); - case SQL_INVALID_CURSOR_POSITION: return OUString("HY109"); - case SQL_INVALID_BOOKMARK_VALUE: return OUString("HY111"); - case SQL_FEATURE_NOT_IMPLEMENTED: return OUString("HYC00"); - case SQL_FUNCTION_NOT_SUPPORTED: return OUString("IM001"); - case SQL_CONNECTION_DOES_NOT_EXIST: return OUString("08003"); + case StandardSQLState::WRONG_PARAMETER_NUMBER: return OUString("07001"); + case StandardSQLState::INVALID_DESCRIPTOR_INDEX: return OUString("07009"); + case StandardSQLState::UNABLE_TO_CONNECT: return OUString("08001"); + case StandardSQLState::NUMERIC_OUT_OF_RANGE: return OUString("22003"); + case StandardSQLState::INVALID_DATE_TIME: return OUString("22007"); + case StandardSQLState::INVALID_CURSOR_STATE: return OUString("24000"); + case StandardSQLState::TABLE_OR_VIEW_EXISTS: return OUString("42S01"); + case StandardSQLState::TABLE_OR_VIEW_NOT_FOUND: return OUString("42S02"); + case StandardSQLState::INDEX_ESISTS: return OUString("42S11"); + case StandardSQLState::INDEX_NOT_FOUND: return OUString("42S12"); + case StandardSQLState::COLUMN_EXISTS: return OUString("42S21"); + case StandardSQLState::COLUMN_NOT_FOUND: return OUString("42S22"); + case StandardSQLState::GENERAL_ERROR: return OUString("HY000"); + case StandardSQLState::INVALID_SQL_DATA_TYPE: return OUString("HY004"); + case StandardSQLState::OPERATION_CANCELED: return OUString("HY008"); + case StandardSQLState::FUNCTION_SEQUENCE_ERROR: return OUString("HY010"); + case StandardSQLState::INVALID_CURSOR_POSITION: return OUString("HY109"); + case StandardSQLState::INVALID_BOOKMARK_VALUE: return OUString("HY111"); + case StandardSQLState::FEATURE_NOT_IMPLEMENTED: return OUString("HYC00"); + case StandardSQLState::FUNCTION_NOT_SUPPORTED: return OUString("IM001"); + case StandardSQLState::CONNECTION_DOES_NOT_EXIST: return OUString("08003"); default: return OUString("HY001"); // General Error } } diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx index 1498478a711f..26f857fe8948 100644 --- a/connectivity/source/commontools/dbmetadata.cxx +++ b/connectivity/source/commontools/dbmetadata.cxx @@ -113,7 +113,7 @@ namespace dbtools { ::connectivity::SharedResources aResources; const OUString sError( aResources.getResourceString(STR_NO_CONNECTION_GIVEN)); - throwSQLException( sError, SQL_CONNECTION_DOES_NOT_EXIST, nullptr ); + throwSQLException( sError, StandardSQLState::CONNECTION_DOES_NOT_EXIST, nullptr ); } } diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index e7b11fc3fafc..3baab99890d7 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -737,7 +737,7 @@ SQLException prependErrorInfo( const SQLException& _rChainedException, const Ref const OUString& _rAdditionalError, const StandardSQLState _eSQLState, const sal_Int32 _nErrorCode ) { return SQLException( _rAdditionalError, _rxContext, - _eSQLState == SQL_ERROR_UNSPECIFIED ? OUString() : getStandardSQLState( _eSQLState ), + _eSQLState == StandardSQLState::ERROR_UNSPECIFIED ? OUString() : getStandardSQLState( _eSQLState ), _nErrorCode, makeAny( _rChainedException ) ); } diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index 6ebc8ac7303d..ac2778fb91f7 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -226,7 +226,7 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 nParameterIndex, default: ::dbtools::throwSQLException( "Incorrect type for setString", - ::dbtools::SQL_INVALID_SQL_DATA_TYPE, + ::dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE, *this); } } @@ -342,7 +342,7 @@ void OPreparedStatement::setValue(sal_Int32 nIndex, T& nValue, ISC_SHORT nType) { ::dbtools::throwSQLException( "Incorrect type for setString", - ::dbtools::SQL_INVALID_SQL_DATA_TYPE, + ::dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE, *this); } @@ -693,7 +693,7 @@ void OPreparedStatement::checkParameterIndex(sal_Int32 nParameterIndex) { ::dbtools::throwSQLException( "No column " + OUString::number(nParameterIndex), - ::dbtools::SQL_COLUMN_NOT_FOUND, + ::dbtools::StandardSQLState::COLUMN_NOT_FOUND, *this); } } diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx b/connectivity/source/drivers/firebird/ResultSet.cxx index 764f561c245d..edb09269b963 100644 --- a/connectivity/source/drivers/firebird/ResultSet.cxx +++ b/connectivity/source/drivers/firebird/ResultSet.cxx @@ -288,7 +288,7 @@ void SAL_CALL OResultSet::checkColumnIndex(sal_Int32 nIndex) { ::dbtools::throwSQLException( "No column " + OUString::number(nIndex), - ::dbtools::SQL_COLUMN_NOT_FOUND, + ::dbtools::StandardSQLState::COLUMN_NOT_FOUND, *this); } } @@ -303,7 +303,7 @@ void SAL_CALL OResultSet::checkRowIndex() { ::dbtools::throwSQLException( "Invalid Row", - ::dbtools::SQL_INVALID_CURSOR_POSITION, + ::dbtools::StandardSQLState::INVALID_CURSOR_POSITION, *this); } } diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 64942d33c116..4f42b96b4301 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -2088,7 +2088,7 @@ void OSQLParseTreeIterator::impl_appendError( IParseContext::ErrorCode _eError, } impl_appendError( SQLException( - sErrorMessage, nullptr, getStandardSQLState( SQL_GENERAL_ERROR ), 1000, Any() ) ); + sErrorMessage, nullptr, getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 1000, Any() ) ); } diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx index 154af39be47c..faca63120942 100644 --- a/dbaccess/source/core/api/BookmarkSet.cxx +++ b/dbaccess/source/core/api/BookmarkSet.cxx @@ -76,7 +76,7 @@ void SAL_CALL OBookmarkSet::insertRow( const ORowSetRow& _rInsertRow,const conne { Reference<XRowUpdate> xUpdRow(m_xRowLocate,UNO_QUERY); if(!xUpdRow.is()) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XROWUPDATE ), SQL_GENERAL_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XROWUPDATE ), StandardSQLState::GENERAL_ERROR, *this ); Reference<XResultSetUpdate> xUpd(m_xRowLocate,UNO_QUERY); if(xUpd.is()) @@ -93,14 +93,14 @@ void SAL_CALL OBookmarkSet::insertRow( const ORowSetRow& _rInsertRow,const conne (*_rInsertRow->get().begin()) = m_xRowLocate->getBookmark(); } else - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XRESULTSETUPDATE ), SQL_GENERAL_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XRESULTSETUPDATE ), StandardSQLState::GENERAL_ERROR, *this ); } void SAL_CALL OBookmarkSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOriginalRow,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException, std::exception) { Reference<XRowUpdate> xUpdRow(m_xRowLocate,UNO_QUERY); if(!xUpdRow.is()) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XROWUPDATE ), SQL_GENERAL_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XROWUPDATE ), StandardSQLState::GENERAL_ERROR, *this ); sal_Int32 i = 1; connectivity::ORowVector< ORowSetValue > ::Vector::const_iterator aOrgIter = _rOriginalRow->get().begin()+1; @@ -116,7 +116,7 @@ void SAL_CALL OBookmarkSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowS if(xUpd.is()) xUpd->updateRow(); else - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XRESULTSETUPDATE ), SQL_GENERAL_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_XRESULTSETUPDATE ), StandardSQLState::GENERAL_ERROR, *this ); } void SAL_CALL OBookmarkSet::deleteRow(const ORowSetRow& /*_rDeleteRow*/ ,const connectivity::OSQLTable& /*_xTable*/ ) throw(SQLException, RuntimeException) diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index 5618df02005c..5bb75ba892ae 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -296,7 +296,7 @@ void SAL_CALL OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetR } else ::dbtools::throwSQLException( - DBACORE_RESSTRING( RID_STR_NO_UPDATE_MISSING_CONDITION ), SQL_GENERAL_ERROR, *this ); + DBACORE_RESSTRING( RID_STR_NO_UPDATE_MISSING_CONDITION ), StandardSQLState::GENERAL_ERROR, *this ); // now create end execute the prepared statement Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear())); diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 12e74c4dfbf5..b24e44f3efca 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -526,7 +526,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow aSql.setLength(aSql.getLength()-1); } else - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), SQL_GENERAL_ERROR, m_xConnection ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), StandardSQLState::GENERAL_ERROR, m_xConnection ); if(!sKeyCondition.isEmpty() || !sIndexCondition.isEmpty()) { @@ -546,7 +546,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow aSql.setLength(aSql.getLength()-5); // remove the last AND } else - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_CONDITION_FOR_PK ), SQL_GENERAL_ERROR, m_xConnection ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_CONDITION_FOR_PK ), StandardSQLState::GENERAL_ERROR, m_xConnection ); // now create end execute the prepared statement executeUpdate(_rInsertRow ,_rOriginalRow,aSql.makeStringAndClear(),"",aIndexColumnPositions); @@ -650,7 +650,7 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi } } if ( !bModified ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), SQL_GENERAL_ERROR, m_xConnection ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), StandardSQLState::GENERAL_ERROR, m_xConnection ); aSql[aSql.getLength() - 1] = ')'; aValues[aValues.getLength() - 1] = ')'; diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index 67f6850f8684..154ed3d1993b 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -210,10 +210,10 @@ void SAL_CALL OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORow } if( aSql.empty() ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), SQL_GENERAL_ERROR, m_xConnection ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), StandardSQLState::GENERAL_ERROR, m_xConnection ); if( aKeyConditions.empty() ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_CONDITION_FOR_PK ), SQL_GENERAL_ERROR, m_xConnection ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_CONDITION_FOR_PK ), StandardSQLState::GENERAL_ERROR, m_xConnection ); static const char s_sUPDATE[] = "UPDATE "; static const char s_sSET[] = " SET "; @@ -280,7 +280,7 @@ void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const conn } } if ( aParameter.empty() ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), SQL_GENERAL_ERROR, m_xConnection ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), StandardSQLState::GENERAL_ERROR, m_xConnection ); Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData(); static const char s_sINSERT[] = "INSERT INTO "; diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 3762ec59cbf6..74d3e793ecdd 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -973,7 +973,7 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException, std:: } else if ( !m_bAfterLast ) // the update went wrong { - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_UPDATE_FAILED ), SQL_INVALID_CURSOR_POSITION, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_UPDATE_FAILED ), StandardSQLState::INVALID_CURSOR_POSITION, *this ); } } } @@ -986,15 +986,15 @@ void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException, std:: checkCache(); if ( m_bBeforeFirst || m_bAfterLast ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_BEFORE_AFTER ), SQL_INVALID_CURSOR_POSITION, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_BEFORE_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *this ); if ( m_bNew ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_INSERT_ROW ), SQL_INVALID_CURSOR_POSITION, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_INSERT_ROW ), StandardSQLState::INVALID_CURSOR_POSITION, *this ); if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), StandardSQLState::FUNCTION_SEQUENCE_ERROR, *this ); if ( ( m_pCache->m_nPrivileges & Privilege::DELETE ) != Privilege::DELETE ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_PRIVILEGE ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_PRIVILEGE ), StandardSQLState::FUNCTION_SEQUENCE_ERROR, *this ); if ( rowDeleted() ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), StandardSQLState::FUNCTION_SEQUENCE_ERROR, *this ); // this call position the cache indirect Any aBookmarkToDelete( m_aBookmark ); @@ -1160,7 +1160,7 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException, ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); if ( ( m_pCache->m_nPrivileges & Privilege::INSERT ) != Privilege::INSERT ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_INSERT_PRIVILEGE ), SQL_GENERAL_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_INSERT_PRIVILEGE ), StandardSQLState::GENERAL_ERROR, *this ); if ( notifyAllListenersCursorBeforeMove( aGuard ) ) { @@ -1258,7 +1258,7 @@ void SAL_CALL ORowSet::moveToCurrentRow( ) throw(SQLException, RuntimeException // m_bModified should be true. Also, as soon as somebody calls moveToInsertRow, // our current row should not be deleted anymore. So, we should not have survived the above // check "if ( !m_pCache->m_bNew && !m_bModified )" - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), StandardSQLState::FUNCTION_SEQUENCE_ERROR, *this ); if ( notifyAllListenersCursorBeforeMove( aGuard ) ) { @@ -1631,7 +1631,7 @@ void ORowSet::impl_ensureStatement_throw() m_xStatement = m_xActiveConnection->prepareStatement( sCommandToExecute ); if ( !m_xStatement.is() ) { - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INTERNAL_ERROR ), SQL_GENERAL_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INTERNAL_ERROR ), StandardSQLState::GENERAL_ERROR, *this ); } Reference< XPropertySet > xStatementProps( m_xStatement, UNO_QUERY_THROW ); @@ -2408,7 +2408,7 @@ bool ORowSet::impl_buildActiveCommand_throw() m_aActiveCommand = sCommand; if ( m_aActiveCommand.isEmpty() && !bDoEscapeProcessing ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_SQL_COMMAND ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_SQL_COMMAND ), StandardSQLState::FUNCTION_SEQUENCE_ERROR, *this ); return bDoEscapeProcessing; } @@ -2704,16 +2704,16 @@ void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) { checkCache(); if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_GENERAL_ERROR, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), StandardSQLState::GENERAL_ERROR, *this ); if ( rowDeleted() ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_INVALID_CURSOR_POSITION, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), StandardSQLState::INVALID_CURSOR_POSITION, *this ); if ( m_aCurrentRow.isNull() ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_CURSOR_STATE ), SQL_INVALID_CURSOR_STATE, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_CURSOR_STATE ), StandardSQLState::INVALID_CURSOR_STATE, *this ); if ( columnIndex <= 0 || sal_Int32((*m_aCurrentRow)->get().size()) <= columnIndex ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_INDEX ), SQL_INVALID_DESCRIPTOR_INDEX, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_INDEX ), StandardSQLState::INVALID_DESCRIPTOR_INDEX, *this ); } void SAL_CALL ORowSet::refreshRow( ) throw(SQLException, RuntimeException, std::exception) diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 2ad04adb142c..85d9a713f355 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -207,7 +207,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex) if ( m_bBeforeFirst || m_bAfterLast ) { SAL_WARN("dbaccess", "ORowSetBase::getValue: Illegal call here (we're before first or after last)!"); - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_CURSOR_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_CURSOR_BEFORE_OR_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf ); } if ( impl_rowDeleted() ) @@ -333,7 +333,7 @@ Reference< css::io::XInputStream > SAL_CALL ORowSetBase::getBinaryStream( sal_In if ( m_bBeforeFirst || m_bAfterLast ) { SAL_WARN("dbaccess", "ORowSetBase::getBinaryStream: Illegal call here (we're before first or after last)!"); - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_CURSOR_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_CURSOR_BEFORE_OR_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf ); } if ( impl_rowDeleted() ) @@ -403,10 +403,10 @@ Any SAL_CALL ORowSetBase::getBookmark( ) throw(SQLException, RuntimeException, checkCache(); if ( m_bBeforeFirst || m_bAfterLast ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_BOOKMARK_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_BOOKMARK_BEFORE_OR_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf ); if ( impl_rowDeleted() ) - ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_BOOKMARK_DELETED ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_BOOKMARK_DELETED ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf ); OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::getBookmark: bookmark has no value!" ); return m_aBookmark; @@ -1094,7 +1094,7 @@ void SAL_CALL ORowSetBase::refreshRow( ) throw(SQLException, RuntimeException, ::osl::MutexGuard aGuard( *m_pMutex ); checkCache(); if ( impl_rowDeleted() ) - throwSQLException( "The current row is deleted", SQL_INVALID_CURSOR_STATE, Reference< XRowSet >( this ) ); + throwSQLException( "The current row is deleted", StandardSQLState::INVALID_CURSOR_STATE, Reference< XRowSet >( this ) ); if(!(m_bBeforeFirst || m_bAfterLast)) { diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 4da4c7068bc1..f97daac96524 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -107,7 +107,7 @@ namespace const OSQLParseNode* pNewSqlParseNode = _rParser.parseTree( aErrorMsg, _rStatement ); if ( !pNewSqlParseNode ) { - OUString sSQLStateGeneralError( getStandardSQLState( SQL_GENERAL_ERROR ) ); + OUString sSQLStateGeneralError( getStandardSQLState( StandardSQLState::GENERAL_ERROR ) ); SQLException aError2( aErrorMsg, _rxContext, sSQLStateGeneralError, 1000, Any() ); SQLException aError1( _rStatement, _rxContext, sSQLStateGeneralError, 1000, makeAny( aError2 ) ); throw SQLException(_rParser.getContext().getErrorMessage(OParseContext::ErrorCode::General),_rxContext,sSQLStateGeneralError,1000,makeAny(aError1)); @@ -134,9 +134,9 @@ namespace // restore the old node before throwing the exception _rIterator.setParseTree( pOldNode ); // and now really ... - SQLException aError1( _rOriginatingCommand, _rxContext, getStandardSQLState( SQL_GENERAL_ERROR ), 1000, Any() ); + SQLException aError1( _rOriginatingCommand, _rxContext, getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 1000, Any() ); throw SQLException( DBACORE_RESSTRING( RID_STR_ONLY_QUERY ), _rxContext, - getStandardSQLState( SQL_GENERAL_ERROR ), 1000, makeAny( aError1 ) ); + getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 1000, makeAny( aError1 ) ); } delete pOldNode; diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index abe8735ea2fb..dfb7580190ce 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -159,7 +159,7 @@ void OQuery::rebuildColumns() if ( !xResultSetMeta.is() ) { OUString sError( DBA_RES( RID_STR_STATEMENT_WITHOUT_RESULT_SET ) ); - ::dbtools::throwSQLException( sError, SQL_GENERAL_ERROR, *this ); + ::dbtools::throwSQLException( sError, StandardSQLState::GENERAL_ERROR, *this ); } Reference< XDatabaseMetaData > xDBMeta( m_xConnection->getMetaData(), UNO_QUERY_THROW ); diff --git a/dbaccess/source/core/api/resultset.cxx b/dbaccess/source/core/api/resultset.cxx index f32168acba52..e69cf2bd1d05 100644 --- a/dbaccess/source/core/api/resultset.cxx +++ b/dbaccess/source/core/api/resultset.cxx @@ -992,13 +992,13 @@ void OResultSet::checkReadOnly() const if ( ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY ) || !m_xDelegatorResultSetUpdate.is() ) - throwSQLException( "The result set is read-only.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) ); + throwSQLException( "The result set is read-only.", StandardSQLState::GENERAL_ERROR, *const_cast< OResultSet* >( this ) ); } void OResultSet::checkBookmarkable() const { if ( !m_bIsBookmarkable ) - throwSQLException( "The result set does not have bookmark support.", SQL_GENERAL_ERROR, *const_cast< OResultSet* >( this ) ); + throwSQLException( "The result set does not have bookmark support.", StandardSQLState::GENERAL_ERROR, *const_cast< OResultSet* >( this ) ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx index ab8fcda1b419..0fa5f28b9201 100644 --- a/dbaccess/source/ui/querydesign/QueryTableView.cxx +++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx @@ -949,7 +949,7 @@ bool OQueryTableView::ExistsAVisitedConn(const OQueryTableWindow* pFrom) const void OQueryTableView::onNoColumns_throw() { OUString sError( ModuleRes( STR_STATEMENT_WITHOUT_RESULT_SET ) ); - ::dbtools::throwSQLException( sError, ::dbtools::SQL_GENERAL_ERROR, nullptr ); + ::dbtools::throwSQLException( sError, ::dbtools::StandardSQLState::GENERAL_ERROR, nullptr ); } bool OQueryTableView::supressCrossNaturalJoin(const TTableConnectionData::value_type& _pData) const diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 03f8a4c18535..9e6c9c26535d 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1201,7 +1201,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= (sal_Int32)aSourceColTypes.size() ) ) { // ( we have to check here against 1 because the parameters are 1 based) ::dbtools::throwSQLException("Internal error: invalid column type index.", - ::dbtools::SQL_INVALID_DESCRIPTOR_INDEX, *this); + ::dbtools::StandardSQLState::INVALID_DESCRIPTOR_INDEX, *this); } switch ( aSourceColTypes[ nSourceColumn ] ) @@ -1285,7 +1285,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou ::dbtools::throwSQLException( aMessage, - ::dbtools::SQL_INVALID_SQL_DATA_TYPE, + ::dbtools::StandardSQLState::INVALID_SQL_DATA_TYPE, *this ); } diff --git a/include/connectivity/dbtools.hxx b/include/connectivity/dbtools.hxx index 78b61cd5a009..515a4dc400b1 100644 --- a/include/connectivity/dbtools.hxx +++ b/include/connectivity/dbtools.hxx @@ -306,7 +306,7 @@ namespace dbtools const css::sdbc::SQLException& _rChainedException, const css::uno::Reference< css::uno::XInterface >& _rxContext, const OUString& _rAdditionalError, - const StandardSQLState _eSQLState = SQL_ERROR_UNSPECIFIED, + const StandardSQLState _eSQLState = StandardSQLState::ERROR_UNSPECIFIED, const sal_Int32 _nErrorCode = 0); /** search the parent hierarchy for a data source. diff --git a/include/connectivity/standardsqlstate.hxx b/include/connectivity/standardsqlstate.hxx index 0d3971fc5329..9af461ddf400 100644 --- a/include/connectivity/standardsqlstate.hxx +++ b/include/connectivity/standardsqlstate.hxx @@ -31,31 +31,31 @@ namespace dbtools @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_error_codes.asp */ - enum StandardSQLState + enum class StandardSQLState { - SQL_WRONG_PARAMETER_NUMBER, // 07001 - SQL_INVALID_DESCRIPTOR_INDEX, // 07009 - SQL_UNABLE_TO_CONNECT, // 08001 - SQL_NUMERIC_OUT_OF_RANGE, // 22003 - SQL_INVALID_DATE_TIME, // 22007 - SQL_INVALID_CURSOR_STATE, // 24000 - SQL_TABLE_OR_VIEW_EXISTS, // 42S01 - SQL_TABLE_OR_VIEW_NOT_FOUND, // 42S02 - SQL_INDEX_ESISTS, // 42S11 - SQL_INDEX_NOT_FOUND, // 42S12 - SQL_COLUMN_EXISTS, // 42S21 - SQL_COLUMN_NOT_FOUND, // 42S22 - SQL_GENERAL_ERROR, // HY000 - SQL_INVALID_SQL_DATA_TYPE, // HY004 - SQL_OPERATION_CANCELED, // HY008 - SQL_FUNCTION_SEQUENCE_ERROR, // HY010 - SQL_INVALID_CURSOR_POSITION, // HY109 - SQL_INVALID_BOOKMARK_VALUE, // HY111 - SQL_FEATURE_NOT_IMPLEMENTED, // HYC00 - SQL_FUNCTION_NOT_SUPPORTED, // IM001 - SQL_CONNECTION_DOES_NOT_EXIST, // 08003 + WRONG_PARAMETER_NUMBER, // 07001 + INVALID_DESCRIPTOR_INDEX, // 07009 + UNABLE_TO_CONNECT, // 08001 + NUMERIC_OUT_OF_RANGE, // 22003 + INVALID_DATE_TIME, // 22007 + INVALID_CURSOR_STATE, // 24000 + TABLE_OR_VIEW_EXISTS, // 42S01 + TABLE_OR_VIEW_NOT_FOUND, // 42S02 + INDEX_ESISTS, // 42S11 + INDEX_NOT_FOUND, // 42S12 + COLUMN_EXISTS, // 42S21 + COLUMN_NOT_FOUND, // 42S22 + GENERAL_ERROR, // HY000 + INVALID_SQL_DATA_TYPE, // HY004 + OPERATION_CANCELED, // HY008 + FUNCTION_SEQUENCE_ERROR, // HY010 + INVALID_CURSOR_POSITION, // HY109 + INVALID_BOOKMARK_VALUE, // HY111 + FEATURE_NOT_IMPLEMENTED, // HYC00 + FUNCTION_NOT_SUPPORTED, // IM001 + CONNECTION_DOES_NOT_EXIST, // 08003 - SQL_ERROR_UNSPECIFIED = SAL_MAX_ENUM // special value indicating that an SQLState is not to be specified + ERROR_UNSPECIFIED = SAL_MAX_ENUM // special value indicating that an SQLState is not to be specified }; diff --git a/include/dbaccess/dbsubcomponentcontroller.hxx b/include/dbaccess/dbsubcomponentcontroller.hxx index 69b486e6c51d..9e4248ac8ce4 100644 --- a/include/dbaccess/dbsubcomponentcontroller.hxx +++ b/include/dbaccess/dbsubcomponentcontroller.hxx @@ -107,7 +107,7 @@ namespace dbaui */ void appendError( const OUString& _rErrorMessage, - const ::dbtools::StandardSQLState _eSQLState = ::dbtools::SQL_GENERAL_ERROR, + const ::dbtools::StandardSQLState _eSQLState = ::dbtools::StandardSQLState::GENERAL_ERROR, const sal_Int32 _nErrorCode = 1000 ); |