diff options
author | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2009-11-27 10:17:16 +0100 |
---|---|---|
committer | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2009-11-27 10:17:16 +0100 |
commit | 05bb4138d25b8adcec7f9b69398163986f258073 (patch) | |
tree | 44c248a4baa0afd242240fe661f4d87de93de1ff /dbaccess | |
parent | 8a3694e8aa6b04a4347b32daac1b22d5200ab1f4 (diff) |
dba33d: #i106772# check if update and refetching works otherwise set iter to end and some resource handling for error messages
Diffstat (limited to 'dbaccess')
20 files changed, 237 insertions, 254 deletions
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 845c392bc146..1e7aa0f51f97 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -618,8 +618,6 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow } m_bUpdated = xPrep->executeUpdate() > 0; - - if(m_bUpdated) { m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32((_rInsertRow->get())[0].getAny())); @@ -1168,8 +1166,9 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) m_xSet = m_xStatement->executeQuery(); OSL_ENSURE(m_xSet.is(),"No resultset form statement!"); - sal_Bool bOK = m_xSet->next(); (void)bOK; - OSL_ENSURE(bOK,"No rows!"); + sal_Bool bOK = m_xSet->next(); + if ( !bOK ) + m_aKeyIter = m_aKeyMap.end(); m_xRow.set(m_xSet,UNO_QUERY); OSL_ENSURE(m_xRow.is(),"No row form statement!"); } diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 813b6556f57e..461929f68141 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1078,19 +1078,26 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException) m_pCache->updateRow(m_aCurrentRow.operator ->()); m_aBookmark = m_pCache->getBookmark(); m_aCurrentRow = m_pCache->m_aMatrixIter; - m_aOldRow->setRow(new ORowSetValueVector(m_aCurrentRow->getBody())); + if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() ) + { + m_aOldRow->setRow(new ORowSetValueVector(m_aCurrentRow->getBody())); - // notification order - // - column values - ORowSetBase::firePropertyChange(aOldValues); + // notification order + // - column values + ORowSetBase::firePropertyChange(aOldValues); - // - rowChanged - notifyAllListenersRowChanged(aGuard,aEvt); + // - rowChanged + notifyAllListenersRowChanged(aGuard,aEvt); - // - IsModified - if(!m_bModified) - fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True); - OSL_ENSURE( !m_bModified, "ORowSet::updateRow: just updated, but _still_ modified?" ); + // - IsModified + if(!m_bModified) + fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True); + OSL_ENSURE( !m_bModified, "ORowSet::updateRow: just updated, but _still_ modified?" ); + } + else // the update went rong + { + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_UPDATE_FAILED ), SQL_INVALID_CURSOR_POSITION, *this ); + } } } // ------------------------------------------------------------------------- @@ -1102,20 +1109,15 @@ void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException) checkCache(); if ( m_bBeforeFirst || m_bAfterLast ) - throwSQLException( "Cannot delete the before-first or after-last row.", SQL_INVALID_CURSOR_POSITION, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_BEFORE_AFTER ), SQL_INVALID_CURSOR_POSITION, *this ); if ( m_bNew ) - throwSQLException( "Cannot delete the insert-row.", SQL_INVALID_CURSOR_POSITION, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_INSERT_ROW ), SQL_INVALID_CURSOR_POSITION, *this ); if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY ) - throwSQLException( "Result set is read only.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); if ( ( m_pCache->m_nPrivileges & Privilege::DELETE ) != Privilege::DELETE ) - throwSQLException( "DELETE privilege not available.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_PRIVILEGE ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); if ( rowDeleted() ) - throwSQLException( "Current row already deleted.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); // this call position the cache indirect Any aBookmarkToDelete( m_aBookmark ); @@ -1279,8 +1281,7 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException) ::osl::ResettableMutexGuard aGuard( *m_pMutex ); checkPositioningAllowed(); if ( ( m_pCache->m_nPrivileges & Privilege::INSERT ) != Privilege::INSERT ) - throwSQLException( "No insert privileges", SQL_GENERAL_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_INSERT_PRIVILEGE ), SQL_GENERAL_ERROR, *this ); if ( notifyAllListenersCursorBeforeMove( aGuard ) ) { @@ -1346,8 +1347,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 )" - throwSQLException( "The current row is deleted.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); if ( notifyAllListenersCursorBeforeMove( aGuard ) ) { @@ -1711,12 +1711,7 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() m_xStatement = m_xActiveConnection->prepareStatement( sCommandToExecute ); if ( !m_xStatement.is() ) { - SQLException aError; - aError.Context = *this; - aError.SQLState = getStandardSQLState( SQL_GENERAL_ERROR ); - aError.Message = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Internal error: no statement object provided by the database driver." ) ); - // TODO: resource - throw aError; + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INTERNAL_ERROR ), SQL_GENERAL_ERROR, *this ); } Reference< XPropertySet > xStatementProps( m_xStatement, UNO_QUERY_THROW ); @@ -2042,8 +2037,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi if(xColumn.is()) xColumn->getPropertyValue(PROPERTY_NAME) >>= sColumnLabel; else - sColumnLabel = ::rtl::OUString::createFromAscii("Expression1"); - // TODO: resource + sColumnLabel = DBACORE_RESSTRING( RID_STR_EXPRESSION1 ); } pColumn->setName(sColumnLabel); aNames.push_back(sColumnLabel); @@ -2457,8 +2451,7 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw() m_aActiveCommand = sCommand; if ( !m_aActiveCommand.getLength() ) - throwSQLException( "No SQL command was provided.", SQL_FUNCTION_SEQUENCE_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_SQL_COMMAND ), SQL_FUNCTION_SEQUENCE_ERROR, *this ); return bDoEscapeProcessing; } @@ -2760,21 +2753,17 @@ void ORowSet::checkUpdateIterator() void ORowSet::checkUpdateConditions(sal_Int32 columnIndex) { checkCache(); - if ( columnIndex <= 0 ) - throwSQLException( "Invalid column index", SQL_INVALID_DESCRIPTOR_INDEX, *this ); - // TODO: resource + if ( columnIndex <= 0 || sal_Int32((*m_aCurrentRow)->get().size()) <= columnIndex ) + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_INDEX ), SQL_INVALID_DESCRIPTOR_INDEX, *this ); + if ( rowDeleted() ) - throwSQLException( "Current row is deleted", SQL_INVALID_CURSOR_POSITION, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_INVALID_CURSOR_POSITION, *this ); + if ( m_aCurrentRow.isNull() ) - throwSQLException( "Invalid cursor state", SQL_INVALID_CURSOR_STATE, *this ); + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_CURSOR_STATE ), SQL_INVALID_CURSOR_STATE, *this ); - if ( sal_Int32((*m_aCurrentRow)->get().size()) <= columnIndex ) - throwSQLException( "Invalid column index", SQL_INVALID_DESCRIPTOR_INDEX, *this ); - // TODO: resource if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY) - throwSQLException( "Result set is not writeable", SQL_GENERAL_ERROR, *this ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_GENERAL_ERROR, *this ); } // ----------------------------------------------------------------------------- void SAL_CALL ORowSet::refreshRow( ) throw(SQLException, RuntimeException) diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index d8449094fa85..c5811705570d 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -30,57 +30,25 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBACCESS_CORE_API_ROWSETBASE_HXX + #include "RowSetBase.hxx" -#endif -#ifndef DBACCESS_CORE_API_CROWSETDATACOLUMN_HXX #include "CRowSetDataColumn.hxx" -#endif -#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ #include <connectivity/sdbcx/VCollection.hxx> -#endif -#ifndef DBACCESS_CORE_API_ROWSETCACHE_HXX #include "RowSetCache.hxx" -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include "core_resource.hrc" #include <com/sun/star/lang/DisposedException.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_ #include <com/sun/star/sdbcx/CompareBookmark.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_ #include <com/sun/star/lang/Locale.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_ #include <com/sun/star/util/NumberFormat.hpp> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef _COMPHELPER_SEQSTREAM_HXX #include <comphelper/seqstream.hxx> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> -#endif -#ifndef _OSL_THREAD_H_ #include <osl/thread.h> -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif #include <rtl/logfile.hxx> using namespace dbaccess; @@ -278,8 +246,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex) if ( m_bBeforeFirst || m_bAfterLast ) { OSL_ENSURE(0,"ORowSetBase::getValue: Illegal call here (we're before first or after last)!"); - throwSQLException( "The cursor points to before the first or after the last row.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_CURSOR_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); } if ( impl_rowDeleted() ) @@ -421,8 +388,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS if ( m_bBeforeFirst || m_bAfterLast ) { OSL_ENSURE(0,"ORowSetBase::getBinaryStream: Illegal call here (we're before first or after last)!"); - throwSQLException( "The cursor points to before the first or after the last row.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_CURSOR_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); } if ( impl_rowDeleted() ) @@ -498,12 +464,10 @@ Any SAL_CALL ORowSetBase::getBookmark( ) throw(SQLException, RuntimeException) checkCache(); if ( m_bBeforeFirst || m_bAfterLast ) - throwSQLException( "The rows before the first and after the last row don't have a bookmark.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_BOOKMARK_BEFORE_OR_AFTER ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); if ( impl_rowDeleted() ) - throwSQLException( "The current row is deleted, and thus doesn't have a bookmark.", SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); - // TODO: resource + ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_BOOKMARK_DELETED ), SQL_INVALID_CURSOR_POSITION, *m_pMySelf ); OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::getBookmark: bookmark has no value!" ); return m_aBookmark; diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 4156c32635a2..3dd4dad67441 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -912,7 +912,7 @@ sal_Bool ORowSetCache::moveWindow() { *m_aMatrixIter = new ORowSetValueVector(m_xMetaData->getColumnCount()); m_pCacheSet->fillValueRow(*m_aMatrixIter,m_nPosition); - // we have to read one row forward to enshure that we know when we are on last row + // we have to read one row forward to ensure that we know when we are on last row // but only when we don't know it already if ( !m_bRowCountFinal ) { @@ -1283,7 +1283,9 @@ void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow ) // *(*m_aMatrixIter) = *(*_rUpdateRow); // refetch the whole row (*m_aMatrixIter) = NULL; - moveToBookmark(aBookmark); + + if ( !moveToBookmark(aBookmark) ) + m_aMatrixIter = m_pMatrix->end(); // moveToBookmark((*(*m_aInsertRow))[0].makeAny()); // if(m_pCacheSet->rowUpdated()) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index f04e39906503..6708dbfa56bb 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -1615,8 +1615,7 @@ void SAL_CALL ODatabaseDocument::loadFromStorage( const Reference< XStorage >& / DocumentGuard aGuard( *this ); throw Exception( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Embedding of database documents is not supported." ) ), - // TODO: resource + DBACORE_RESSTRING( RID_STR_NO_EMBEDDING ), *this ); } diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 3f33bc226aa2..f7fc11a5d80a 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -68,9 +68,9 @@ #include <comphelper/property.hxx> #include <comphelper/seqstream.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/string.hxx> #include <connectivity/dbexception.hxx> #include <cppuhelper/typeprovider.hxx> -#include <rtl/digest.h> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> @@ -78,6 +78,7 @@ #include <unotools/confignode.hxx> #include <unotools/sharedunocomponent.hxx> #include <rtl/logfile.hxx> +#include <rtl/digest.h> #include <algorithm> using namespace ::com::sun::star::sdbc; @@ -832,9 +833,8 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const ::rtl::O ::rtl::OUString sMessage = DBACORE_RESSTRING( nExceptionMessageId ); SQLContext aContext; - aContext.Message = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "A connection for the following URL was requested: " ) ); - // TODO: resource - aContext.Message += m_pImpl->m_sConnectURL; + aContext.Message = DBACORE_RESSTRING( RID_STR_CONNECTION_REQUEST ); + ::comphelper::string::searchAndReplaceAsciiI( aContext.Message, "$name$", m_pImpl->m_sConnectURL ); throwGenericSQLException( sMessage, static_cast< XDataSource* >( this ), makeAny( aContext ) ); } diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 89dd49184519..3229aa80a45e 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -545,7 +545,6 @@ Reference< XComponent > SAL_CALL ODocumentContainer::loadComponentFromURL( const if ( !lcl_queryContent(_sURL,xNameContainer,aContent,sName) ) { ::rtl::OUString sMessage( DBA_RES( RID_STR_NAME_NOT_FOUND ) ); - // TODO: resource ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$name$", _sURL ); throw IllegalArgumentException( sMessage, *this, 1 ); } diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 992fc156d386..563344f19789 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1694,8 +1694,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x if ( !xEnumDrivers.is() || !xEnumDrivers->hasMoreElements() ) { com::sun::star::io::WrongFormatException aWFE; - aWFE.Message = ::rtl::OUString::createFromAscii("Extension not present."); - // TODO: resource + aWFE.Message = DBACORE_RESSTRING( RID_STR_MISSING_EXTENSION ); throw aWFE; } } diff --git a/dbaccess/source/core/inc/core_resource.hrc b/dbaccess/source/core/inc/core_resource.hrc index 3463ef2c960f..309a17124c42 100644 --- a/dbaccess/source/core/inc/core_resource.hrc +++ b/dbaccess/source/core/inc/core_resource.hrc @@ -91,5 +91,26 @@ #define RID_STR_ERROR_WHILE_SAVING ( RID_CORE_STRINGS_START + 47 ) #define RID_STR_NO_SUB_FOLDER ( RID_CORE_STRINGS_START + 48 ) +#define RID_STR_NO_DELETE_BEFORE_AFTER ( RID_CORE_STRINGS_START + 49 ) +#define RID_STR_NO_DELETE_INSERT_ROW ( RID_CORE_STRINGS_START + 50 ) +#define RID_STR_RESULT_IS_READONLY ( RID_CORE_STRINGS_START + 51 ) +#define RID_STR_NO_DELETE_PRIVILEGE ( RID_CORE_STRINGS_START + 52 ) +#define RID_STR_ROW_ALREADY_DELETED ( RID_CORE_STRINGS_START + 53 ) +#define RID_STR_UPDATE_FAILED ( RID_CORE_STRINGS_START + 54 ) + +#define RID_STR_INVALID_INDEX ( RID_CORE_STRINGS_START + 55 ) +#define RID_STR_NO_INSERT_PRIVILEGE ( RID_CORE_STRINGS_START + 56 ) +#define RID_STR_INTERNAL_ERROR ( RID_CORE_STRINGS_START + 57 ) +#define RID_STR_EXPRESSION1 ( RID_CORE_STRINGS_START + 58 ) +#define RID_STR_NO_SQL_COMMAND ( RID_CORE_STRINGS_START + 59 ) +#define RID_STR_INVALID_CURSOR_STATE ( RID_CORE_STRINGS_START + 60 ) +#define RID_STR_CURSOR_BEFORE_OR_AFTER ( RID_CORE_STRINGS_START + 61 ) +#define RID_STR_NO_BOOKMARK_BEFORE_OR_AFTER ( RID_CORE_STRINGS_START + 62 ) +#define RID_STR_NO_BOOKMARK_DELETED ( RID_CORE_STRINGS_START + 63 ) +#define RID_STR_NO_EMBEDDING ( RID_CORE_STRINGS_START + 64 ) +#define RID_STR_CONNECTION_REQUEST ( RID_CORE_STRINGS_START + 65 ) +#define RID_STR_MISSING_EXTENSION ( RID_CORE_STRINGS_START + 66 ) + + #endif // _DBA_CORE_RESOURCE_HRC_ diff --git a/dbaccess/source/core/resource/strings.src b/dbaccess/source/core/resource/strings.src index 1480f0c95310..5b3c64e5316b 100644 --- a/dbaccess/source/core/resource/strings.src +++ b/dbaccess/source/core/resource/strings.src @@ -249,4 +249,76 @@ String RID_STR_NO_SUB_FOLDER { Text [ en-US ] = "There exists no folder named \"$folder$\"."; }; +String RID_STR_NO_DELETE_BEFORE_AFTER +{ + Text [ en-US ] = "Cannot delete the before-first or after-last row."; +}; +String RID_STR_NO_DELETE_INSERT_ROW +{ + Text [ en-US ] = "Cannot delete the insert-row."; +}; +String RID_STR_RESULT_IS_READONLY +{ + Text [ en-US ] = "Result set is read only."; +}; +String RID_STR_NO_DELETE_PRIVILEGE +{ + Text [ en-US ] = "DELETE privilege not available."; +}; +String RID_STR_ROW_ALREADY_DELETED +{ + Text [ en-US ] = "Current row is already deleted."; +}; +String RID_STR_UPDATE_FAILED +{ + Text [ en-US ] = "Current row could be updated."; +}; //------------------------------------------------------------------------- +String RID_STR_NO_INSERT_PRIVILEGE +{ + Text [ en-US ] = "INSERT privilege not available."; +}; +String RID_STR_INTERNAL_ERROR +{ + Text [ en-US ] = "Internal error: no statement object provided by the database driver."; +}; +String RID_STR_EXPRESSION1 +{ + Text [ en-US ] = "Expression1"; +}; +String RID_STR_NO_SQL_COMMAND +{ + Text [ en-US ] = "No SQL command was provided."; +}; +String RID_STR_INVALID_INDEX +{ + Text [ en-US ] = "Invalid column index."; +}; +String RID_STR_INVALID_CURSOR_STATE +{ + Text [ en-US ] = "Invalid cursor state."; +}; +String RID_STR_CURSOR_BEFORE_OR_AFTER +{ + Text [ en-US ] = "The cursor points to before the first or after the last row."; +}; +String RID_STR_NO_BOOKMARK_BEFORE_OR_AFTER +{ + Text [ en-US ] = "The rows before the first and after the last row don't have a bookmark."; +}; +String RID_STR_NO_BOOKMARK_DELETED +{ + Text [ en-US ] = "The current row is deleted, and thus doesn't have a bookmark."; +}; +String RID_STR_NO_EMBEDDING +{ + Text [ en-US ] = "Embedding of database documents is not supported."; +}; +String RID_STR_CONNECTION_REQUEST +{ + Text [ en-US ] = "A connection for the following URL was requested \"$name$\"."; +}; +String RID_STR_MISSING_EXTENSION +{ + Text [ en-US ] = "The extension is not installed."; +}; diff --git a/dbaccess/source/ext/macromigration/dbmm_global.hrc b/dbaccess/source/ext/macromigration/dbmm_global.hrc index 3ce7577426c7..53899d7bf33c 100644 --- a/dbaccess/source/ext/macromigration/dbmm_global.hrc +++ b/dbaccess/source/ext/macromigration/dbmm_global.hrc @@ -82,5 +82,8 @@ #define STR_WARNINGS ( RID_DBMM_STRING_START + 14 ) #define STR_EXCEPTION ( RID_DBMM_STRING_START + 15 ) #define STR_LIBRARY_TYPE_AND_NAME ( RID_DBMM_STRING_START + 16 ) +#define STR_INVALID_NUMBER_ARGS ( RID_DBMM_STRING_START + 17 ) +#define STR_NO_DATABASE ( RID_DBMM_STRING_START + 18 ) +#define STR_NOT_READONLY ( RID_DBMM_STRING_START + 19 ) #endif // DBACCESS_DBMM_GLOBAL_HRC diff --git a/dbaccess/source/ext/macromigration/macromigration.src b/dbaccess/source/ext/macromigration/macromigration.src index bb49ac7ad287..fa973be93d00 100644 --- a/dbaccess/source/ext/macromigration/macromigration.src +++ b/dbaccess/source/ext/macromigration/macromigration.src @@ -441,3 +441,16 @@ ErrorBox ERR_INVALID_BACKUP_LOCATION Buttons = WB_OK; Message [ en-US ] = "You need to choose a backup location other than the document location itself."; }; + +String STR_INVALID_NUMBER_ARGS +{ + Text [ en-US ] = "Invalid number of initialization arguments. Expected 1."; +}; +String STR_NO_DATABASE +{ + Text [ en-US ] = "No database document found in the initializatin arguments."; +}; +String STR_NOT_READONLY +{ + Text [ en-US ] = "Not applicable to read-only documents."; +}; diff --git a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx index 732fa9906119..72eef7e1583b 100644 --- a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx @@ -32,6 +32,7 @@ #include "precompiled_dbaccess.hxx" #include "dbmm_module.hxx" +#include "dbmm_global.hrc" #include "macromigrationdialog.hxx" /** === begin UNO includes === **/ @@ -210,8 +211,7 @@ namespace dbmm if ( _rArguments.getLength() != 1 ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid number of initialization arguments. Expected 1." ) ), - // TODO: resource + String(MacroMigrationResId(STR_INVALID_NUMBER_ARGS)), *this, 1 ); @@ -219,8 +219,7 @@ namespace dbmm m_xDocument.set( _rArguments[0], UNO_QUERY ); if ( !m_xDocument.is() ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No database document found in the initializatin arguments." ) ), - // TODO: resource + String(MacroMigrationResId(STR_NO_DATABASE)), *this, 1 ); @@ -228,8 +227,7 @@ namespace dbmm Reference< XStorable > xDocStor( m_xDocument, UNO_QUERY_THROW ); if ( xDocStor->isReadonly() ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Not applicable to read-only documents." ) ), - // TODO: resource + String(MacroMigrationResId(STR_NOT_READONLY)), *this, 1 ); diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index b87b7706d87f..2664436ade4c 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -79,160 +79,68 @@ #include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp> #include <com/sun/star/document/XDocumentEventBroadcaster.hpp> /** === end UNO includes === **/ - -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> -#endif -#ifndef SVTOOLS_URIHELPER_HXX +#include <tools/string.hxx> + #include <svtools/urihelper.hxx> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ +#include <svtools/pathoptions.hxx> +#include <svtools/internaloptions.hxx> +#include <svtools/moduleoptions.hxx> +#include <svtools/svtreebx.hxx> +#include <svtools/transfer.hxx> +#include <svtools/cliplistener.hxx> +#include <svtools/svlbitm.hxx> +#include <svtools/historyoptions.hxx> +#include <svtools/filenotation.hxx> +#include <svtools/insdlg.hxx> + +#include <unotools/tempfile.hxx> + +#include <comphelper/sequence.hxx> +#include <comphelper/uno3.hxx> +#include <comphelper/string.hxx> #include <comphelper/types.hxx> -#endif -#ifndef _COMPHELPER_INTERACTION_HXX_ #include <comphelper/interaction.hxx> -#endif -#ifndef COMPHELPER_COMPONENTCONTEXT_HXX #include <comphelper/componentcontext.hxx> -#endif -#ifndef _SV_MSGBOX_HXX + #include <vcl/msgbox.hxx> -#endif -#ifndef _VCL_STDTEXT_HXX #include <vcl/stdtext.hxx> -#endif -#ifndef _FILEDLGHELPER_HXX +#include <vcl/svapp.hxx> +#include <vcl/menu.hxx> +#include <vcl/lstbox.hxx> + +#include <sfx2/mailmodelapi.hxx> #include <sfx2/filedlghelper.hxx> -#endif -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <sfx2/docfilt.hxx> +#include <sfx2/QuerySaveDocument.hxx> + #include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _CPPUHELPER_EXC_HLP_HXX_ #include <cppuhelper/exc_hlp.hxx> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ + #include <connectivity/dbtools.hxx> -#endif -#ifndef DBAUI_APPVIEW_HXX +#include <connectivity/dbexception.hxx> + +#include <svx/dbaexchange.hxx> +#include <svx/dbaobjectex.hxx> +#include <svx/svxdlg.hxx> + #include "AppView.hxx" -#endif -#ifndef DBACCESS_UI_BROWSER_ID_HXX #include "browserids.hxx" -#endif -#ifndef _DBAU_REGHELPER_HXX_ #include "dbu_reghelper.hxx" -#endif -#ifndef _DBU_APP_HRC_ #include "dbu_app.hrc" -#endif -#ifndef DBACCESS_SOURCE_UI_MISC_DEFAULTOBJECTNAMECHECK_HXX #include "defaultobjectnamecheck.hxx" -#endif -#ifndef _SV_MENU_HXX -#include <vcl/menu.hxx> -#endif -#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX -#include <svtools/pathoptions.hxx> -#endif -#ifndef INCLUDED_SVTOOLS_INTERNALOPTIONS_HXX -#include <svtools/internaloptions.hxx> -#endif -#ifndef _COMPHELPER_UNO3_HXX_ -#include <comphelper/uno3.hxx> -#endif -#ifndef DBACCESS_DATABASE_OBJECT_VIEW_HXX #include "databaseobjectview.hxx" -#endif -#ifndef _SV_SVAPP_HXX //autogen -#include <vcl/svapp.hxx> -#endif -#ifndef _SVLBOXITM_HXX -#include <svtools/svlbitm.hxx> -#endif -#ifndef _DBAUI_LISTVIEWITEMS_HXX_ #include "listviewitems.hxx" -#endif - -#ifndef DBAUI_APPDETAILVIEW_HXX #include "AppDetailView.hxx" -#endif -#ifndef _DBAUI_LINKEDDOCUMENTS_HXX_ #include "linkeddocuments.hxx" -#endif -#ifndef _SV_LSTBOX_HXX -#include <vcl/lstbox.hxx> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ -#include <connectivity/dbexception.hxx> -#endif -#ifndef _DBAUI_SQLMESSAGE_HXX_ #include "sqlmessage.hxx" -#endif -#ifndef _STRING_HXX -#include <tools/string.hxx> -#endif -#ifndef INCLUDED_SFX_MAILMODELAPI_HXX -#include <sfx2/mailmodelapi.hxx> -#endif -#ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX -#include <svtools/moduleoptions.hxx> -#endif -#ifndef _SVTREEBOX_HXX -#include <svtools/svtreebx.hxx> -#endif -#ifndef _TRANSFER_HXX -#include <svtools/transfer.hxx> -#endif -#ifndef _CLIPLISTENER_HXX -#include <svtools/cliplistener.hxx> -#endif -#ifndef _SVX_DBAEXCHANGE_HXX_ -#include <svx/dbaexchange.hxx> -#endif -#ifndef SVX_DBAOBJECTEX_HXX -#include <svx/dbaobjectex.hxx> -#endif -#ifndef DBAUI_TOOLS_HXX #include "UITools.hxx" -#endif -#ifndef _DBAUI_DSNTYPES_HXX_ #include "dsntypes.hxx" -#endif -#include <svx/svxdlg.hxx> -#include <svtools/insdlg.hxx> -#ifndef _UNOTOOLS_TEMPFILE_HXX -#include <unotools/tempfile.hxx> -#endif -#ifndef _DBA_DBACCESS_HELPID_HRC_ #include "dbaccess_helpid.hrc" -#endif -#ifndef DBAUI_DLGSAVE_HXX #include "dlgsave.hxx" -#endif -#ifndef _SFX_DOCFILT_HACK_HXX -#include <sfx2/docfilt.hxx> -#endif -#ifndef SFX_QUERYSAVEDOCUMENT_HXX -#include <sfx2/QuerySaveDocument.hxx> -#endif -#ifndef INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX -#include <svtools/historyoptions.hxx> -#endif -#ifndef SVTOOLS_FILENOTATION_HXX_ -#include <svtools/filenotation.hxx> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ -#include <comphelper/sequence.hxx> -#endif -#ifndef _VOS_MUTEX_HXX_ #include <vos/mutex.hxx> -#endif -#ifndef _DBACCESS_SLOTID_HRC_ #include "dbaccess_slotid.hrc" -#endif #include <algorithm> #include <functional> @@ -2955,8 +2863,7 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer case DatabaseObjectContainer::REPORTS: if ( eSelectedCategory != E_NONE ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "You cannot select different categories." ) ), - // TODO: resource + String(ModuleRes(RID_STR_NO_DIFF_CAT)), *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ) ); eSelectedCategory = ( pObject->Type == DatabaseObjectContainer::TABLES ) ? E_TABLE @@ -2969,13 +2876,9 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer default: case DatabaseObjectContainer::DATA_SOURCE: { - ::rtl::OUStringBuffer aMessage; - aMessage.appendAscii( "Unsupported object type found (" ); - aMessage.append ( sal_Int32( pObject->Type ) ); - aMessage.appendAscii( ")." ); - // TODO: resource - throw IllegalArgumentException( - aMessage.makeStringAndClear(), *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ) ); + ::rtl::OUString sMessage = String(ModuleRes( RID_STR_UNSUPPORTED_OBJECT_TYPE )); + ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$type$", ::rtl::OUString::valueOf(sal_Int32( pObject->Type )) ); + throw IllegalArgumentException(sMessage, *this, sal_Int16( pObject - aSelectedObjects.getConstArray() )); } } } diff --git a/dbaccess/source/ui/app/app.src b/dbaccess/source/ui/app/app.src index c913d16ebd2d..9aff7f73d992 100644 --- a/dbaccess/source/ui/app/app.src +++ b/dbaccess/source/ui/app/app.src @@ -469,3 +469,11 @@ String RID_STR_EMBEDDED_DATABASE { Text [ en-US ] = "Embedded database"; }; +String RID_STR_NO_DIFF_CAT +{ + Text [ en-US ] = "You cannot select different categories."; +}; +String RID_STR_UNSUPPORTED_OBJECT_TYPE +{ + Text [ en-US ] = "Unsupported object type found ($type$)."; +}; diff --git a/dbaccess/source/ui/app/dbu_app.hrc b/dbaccess/source/ui/app/dbu_app.hrc index 63aa923ce30f..5b4aee52304e 100644 --- a/dbaccess/source/ui/app/dbu_app.hrc +++ b/dbaccess/source/ui/app/dbu_app.hrc @@ -68,11 +68,12 @@ #define RID_STR_FORMS_HELP_TEXT_WIZARD RID_STR_APP_START + 29 #define RID_STR_REPORT_HELP_TEXT RID_STR_APP_START + 30 #define RID_STR_EMBEDDED_DATABASE RID_STR_APP_START + 31 - +#define RID_STR_NO_DIFF_CAT RID_STR_APP_START + 32 +#define RID_STR_UNSUPPORTED_OBJECT_TYPE RID_STR_APP_START + 33 // please adjust checking before insert new strings -#if RID_STR_EMBEDDED_DATABASE > RID_STR_APP_END +#if RID_STR_UNSUPPORTED_OBJECT_TYPE > RID_STR_APP_END #error Resource-Id Ueberlauf in #file, #line #endif diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx index 16859283c9b7..51121b022e88 100644 --- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx +++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx @@ -166,7 +166,7 @@ void SbaTableQueryBrowser::SelectionChanged() InvalidateFeature(ID_BROWSER_INSERTCONTENT); InvalidateFeature(ID_BROWSER_FORMLETTER); } // if ( !m_bShowMenu ) - InvalidateFeature(ID_BROWSER_COPY);
+ InvalidateFeature(ID_BROWSER_COPY); InvalidateFeature(ID_BROWSER_CUT); } //------------------------------------------------------------------------------ diff --git a/dbaccess/source/ui/inc/dbu_uno.hrc b/dbaccess/source/ui/inc/dbu_uno.hrc index acd15c94c7ef..6aec13955ac0 100644 --- a/dbaccess/source/ui/inc/dbu_uno.hrc +++ b/dbaccess/source/ui/inc/dbu_uno.hrc @@ -43,9 +43,12 @@ #define STR_CTW_UNSUPPORTED_COLUMN_TYPE ( RID_STR_UNO_START + 6 ) #define STR_CTW_ILLEGAL_PARAMETER_COUNT ( RID_STR_UNO_START + 7 ) #define STR_CTW_ERROR_DURING_INITIALIZATION ( RID_STR_UNO_START + 8 ) +#define STR_CTW_ERROR_UNSUPPORTED_SETTING ( RID_STR_UNO_START + 9 ) +#define STR_CTW_ERROR_NO_QUERY ( RID_STR_UNO_START + 10 ) +#define STR_CTW_ERROR_INVALID_INTERACTIONHANDLER ( RID_STR_UNO_START + 11 ) // please adjust when inserting new strings: -#define RID_STR_UNO_LAST_USED STR_CTW_ERROR_DURING_INITIALIZATION +#define RID_STR_UNO_LAST_USED STR_CTW_ERROR_INVALID_INTERACTIONHANDLER #if RID_STR_UNO_LAST_USED >= RID_STR_UNO_END #error too many resources in uno .... diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 159d447ae554..aa2b87fca329 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -70,6 +70,7 @@ #include <comphelper/interaction.hxx> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/proparrhlp.hxx> +#include <comphelper/string.hxx> #include <connectivity/dbexception.hxx> #include <connectivity/dbtools.hxx> #include <cppuhelper/exc_hlp.hxx> @@ -775,9 +776,8 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X if ( sUnsupportedSetting.getLength() != 0 ) { - ::rtl::OUString sMessage( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported setting in the copy source descriptor: $name$." ) ) ); - // TODO: resource - sMessage = sMessage.replaceAt( sMessage.indexOfAsciiL( "$name$", 6 ), 6, sUnsupportedSetting ); + ::rtl::OUString sMessage( String(ModuleRes( STR_CTW_ERROR_UNSUPPORTED_SETTING )) ); + ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$name$", sUnsupportedSetting ); throw IllegalArgumentException( sMessage, *const_cast< CopyTableWizard* >( this ), @@ -849,8 +849,7 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X if ( _out_rCommandType == CommandType::QUERY ) // we cannot copy a query if the connection cannot provide it ... throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "To copy a query, your connection must be able to provide queries." ) ), - // TODO: resource + String(ModuleRes( STR_CTW_ERROR_NO_QUERY )), *const_cast< CopyTableWizard* >( this ), 1 ); @@ -1516,8 +1515,7 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments ) { // ->createWithInteractionHandler if ( !( _rArguments[2] >>= m_xInteractionHandler ) ) throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The given interaction handler is invalid." ) ), - // TODO: resource + String(ModuleRes( STR_CTW_ERROR_INVALID_INTERACTIONHANDLER )), *this, 3 ); diff --git a/dbaccess/source/ui/uno/copytablewizard.src b/dbaccess/source/ui/uno/copytablewizard.src index 07db51196ce2..4bb6efc839cc 100644 --- a/dbaccess/source/ui/uno/copytablewizard.src +++ b/dbaccess/source/ui/uno/copytablewizard.src @@ -69,3 +69,15 @@ String STR_CTW_ERROR_DURING_INITIALIZATION { Text [ en-US ] = "An error occurred during initialization."; }; +String STR_CTW_ERROR_UNSUPPORTED_SETTING +{ + Text [ en-US ] = "Unsupported setting in the copy source descriptor: $name$."; +}; +String STR_CTW_ERROR_NO_QUERY +{ + Text [ en-US ] = "To copy a query, your connection must be able to provide queries."; +}; +String STR_CTW_ERROR_INVALID_INTERACTIONHANDLER +{ + Text [ en-US ] = "The given interaction handler is invalid."; +}; |