summaryrefslogtreecommitdiff
path: root/dbaccess/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/core')
-rw-r--r--dbaccess/source/core/api/KeySet.cxx31
-rw-r--r--dbaccess/source/core/api/KeySet.hxx2
-rw-r--r--dbaccess/source/core/api/RowSet.cxx97
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx48
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx6
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx27
-rw-r--r--dbaccess/source/core/dataaccess/connection.cxx13
-rw-r--r--dbaccess/source/core/dataaccess/connection.hxx4
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx3
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx8
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.cxx29
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx3
-rw-r--r--dbaccess/source/core/inc/core_resource.hrc24
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx1
-rw-r--r--dbaccess/source/core/resource/strings.src77
16 files changed, 240 insertions, 135 deletions
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index f028dba66ae0..c4fa68b12505 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -597,6 +597,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
sal_Int32 nPos = aIter->second.nPosition;
if((_rInsertRow->get())[nPos].isModified())
{
+ impl_convertValue_throw(_rInsertRow,aIter->second);
(_rInsertRow->get())[nPos].setSigned((_rOrginalRow->get())[nPos].isSigned());
setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
}
@@ -621,8 +622,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()));
@@ -681,6 +680,7 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
xParameter->setNull(i++,(_rInsertRow->get())[nPos].getTypeKind());
else
{
+ impl_convertValue_throw(_rInsertRow,aIter->second);
(_rInsertRow->get())[nPos].setSigned(m_aSignedFlags[nPos-1]);
setParameter(i++,xParameter,(_rInsertRow->get())[nPos],aIter->second.nType,aIter->second.nScale);
}
@@ -1171,8 +1171,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!");
}
@@ -1464,3 +1465,25 @@ namespace dbaccess
}
}
}
+// -----------------------------------------------------------------------------
+void OKeySet::impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData)
+{
+ ORowSetValue& aValue((_rInsertRow->get())[i_aMetaData.nPosition]);
+ switch(i_aMetaData.nType)
+ {
+ case DataType::DECIMAL:
+ case DataType::NUMERIC:
+ {
+ ::rtl::OUString sValue = aValue.getString();
+ sal_Int32 nIndex = sValue.indexOf('.');
+ if ( nIndex != -1 )
+ {
+ aValue = sValue.copy(0,nIndex + (i_aMetaData.nScale > 0 ? i_aMetaData.nScale + 1 : 0));
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index 7a213d05b466..3a73487c2c3d 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -134,6 +134,8 @@ namespace dbaccess
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getKeyColumns() const;
void fillAllRows();
sal_Bool fetchRow();
+
+ void impl_convertValue_throw(const ORowSetRow& _rInsertRow,const SelectColumnDescription& i_aMetaData);
protected:
virtual ~OKeySet();
public:
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 18d8398c8233..0de2b0511946 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -977,19 +977,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 );
+ }
}
}
// -------------------------------------------------------------------------
@@ -1001,20 +1008,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 );
@@ -1178,8 +1180,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 ) )
{
@@ -1245,8 +1246,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 ) )
{
@@ -1610,12 +1610,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 );
@@ -1885,15 +1880,17 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
for(sal_Int32 i=1; i <= nCount ;++i)
{
::rtl::OUString sName = xMeta->getColumnName(i);
+ ::rtl::OUString sColumnLabel = xMeta->getColumnLabel(i);
// retrieve the column number |i|
Reference<XPropertySet> xColumn;
{
sal_Bool bReFetchName = sal_False;
- if (m_xColumns->hasByName(sName))
+ if (m_xColumns->hasByName(sColumnLabel))
+ m_xColumns->getByName(sColumnLabel) >>= xColumn;
+ if (!xColumn.is() && m_xColumns->hasByName(sName))
m_xColumns->getByName(sName) >>= xColumn;
- if (!xColumn.is() && m_xColumns->hasByName(xMeta->getColumnLabel(i)))
- m_xColumns->getByName(xMeta->getColumnLabel(i)) >>= xColumn;
+
// check if column already in the list we need another
if ( aAllColumns.find( xColumn ) != aAllColumns.end() )
{
@@ -1934,16 +1931,15 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
aDescription,
m_aCurrentRow);
aColumns->get().push_back(pColumn);
- if(!sName.getLength())
+ if(!sColumnLabel.getLength())
{
if(xColumn.is())
- xColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
+ xColumn->getPropertyValue(PROPERTY_NAME) >>= sColumnLabel;
else
- sName = ::rtl::OUString::createFromAscii("Expression1");
- // TODO: resource
+ sColumnLabel = DBACORE_RESSTRING( RID_STR_EXPRESSION1 );
}
- pColumn->setName(sName);
- aNames.push_back(sName);
+ pColumn->setName(sColumnLabel);
+ aNames.push_back(sColumnLabel);
m_aDataColumns.push_back(pColumn);
if ( xColumn.is() )
@@ -2354,8 +2350,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;
}
@@ -2657,21 +2652,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 ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY)
+ ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_GENERAL_ERROR, *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
+ if ( columnIndex <= 0 || sal_Int32((*m_aCurrentRow)->get().size()) <= columnIndex )
+ ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_INDEX ), SQL_INVALID_DESCRIPTOR_INDEX, *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/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 9b8bae551cf1..38c4536671e6 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -750,9 +750,10 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
OSL_ENSURE( (size_t) nCount == aSelectColumns->get().size(), "OSingleSelectQueryComposer::getColumns: inconsistent column counts, this might result in wrong columns!" );
for(sal_Int32 i=1;i<=nCount;++i)
{
- ::rtl::OUString sName = xResultSetMeta->getColumnName(i);
+ ::rtl::OUString sColumnName = xResultSetMeta->getColumnName(i);
+ ::rtl::OUString sColumnLabel = xResultSetMeta->getColumnLabel(i);
sal_Bool bFound = sal_False;
- OSQLColumns::Vector::const_iterator aFind = ::connectivity::find(aSelectColumns->get().begin(),aSelectColumns->get().end(),sName,aCaseCompare);
+ OSQLColumns::Vector::const_iterator aFind = ::connectivity::find(aSelectColumns->get().begin(),aSelectColumns->get().end(),sColumnLabel,aCaseCompare);
size_t nFoundSelectColumnPos = aFind - aSelectColumns->get().begin();
if ( aFind != aSelectColumns->get().end() )
{
@@ -761,7 +762,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
// so we start after the first found
do
{
- aFind = ::connectivity::findRealName(++aFind,aSelectColumns->get().end(),sName,aCaseCompare);
+ aFind = ::connectivity::findRealName(++aFind,aSelectColumns->get().end(),sColumnName,aCaseCompare);
nFoundSelectColumnPos = aFind - aSelectColumns->get().begin();
}
while ( ( aUsedSelectColumns.find( nFoundSelectColumnPos ) != aUsedSelectColumns.end() )
@@ -770,9 +771,9 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
}
if ( aFind != aSelectColumns->get().end() )
{
- (*aFind)->getPropertyValue(PROPERTY_NAME) >>= sName;
+ (*aFind)->getPropertyValue(PROPERTY_NAME) >>= sColumnName;
aUsedSelectColumns.insert( nFoundSelectColumnPos );
- aNames.push_back(sName);
+ aNames.push_back(sColumnName);
bFound = sal_True;
}
}
@@ -781,7 +782,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
continue;
OSQLColumns::Vector::const_iterator aRealFind = ::connectivity::findRealName(
- aSelectColumns->get().begin(), aSelectColumns->get().end(), sName, aCaseCompare );
+ aSelectColumns->get().begin(), aSelectColumns->get().end(), sColumnName, aCaseCompare );
if ( i > static_cast< sal_Int32>( aSelectColumns->get().size() ) )
{
@@ -806,19 +807,19 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
::rtl::OUString sRealName;
xProp->getPropertyValue(PROPERTY_REALNAME) >>= sRealName;
::std::vector< ::rtl::OUString>::iterator aFindName;
- if ( !sName.getLength() )
- xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
+ if ( !sColumnName.getLength() )
+ xProp->getPropertyValue(PROPERTY_NAME) >>= sColumnName;
- aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sName));
+ aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sColumnName));
sal_Int32 j = 0;
while ( aFindName != aNames.end() )
{
- sName += ::rtl::OUString::valueOf(++j);
- aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sName));
+ sColumnName += ::rtl::OUString::valueOf(++j);
+ aFindName = ::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(aCaseCompareFunctor,sColumnName));
}
- pColumn->setName(sName);
+ pColumn->setName(sColumnName);
pColumn->setRealName(sRealName);
pColumn->setTableName(::comphelper::getString(xProp->getPropertyValue(PROPERTY_TABLENAME)));
@@ -828,7 +829,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
continue;
aUsedSelectColumns.insert( (size_t)(i - 1) );
- aNames.push_back( sName );
+ aNames.push_back( sColumnName );
}
}
catch(const Exception&)
diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx
index 8fb40fc63b1f..043198388976 100644
--- a/dbaccess/source/core/dataaccess/connection.cxx
+++ b/dbaccess/source/core/dataaccess/connection.cxx
@@ -601,6 +601,17 @@ Reference< XSQLQueryComposer > OConnection::createQueryComposer(void) throw( Ru
return xComposer;
}
// -----------------------------------------------------------------------------
+void OConnection::impl_fillTableFilter()
+{
+ Reference<XPropertySet> xProp(getParent(),UNO_QUERY);
+ if ( xProp.is() )
+ {
+ xProp->getPropertyValue(PROPERTY_TABLEFILTER) >>= m_aTableFilter;
+ xProp->getPropertyValue(PROPERTY_TABLETYPEFILTER) >>= m_aTableTypeFilter;
+ }
+}
+
+// -----------------------------------------------------------------------------
void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::refresh" );
@@ -608,6 +619,7 @@ void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed)
{
if (!m_pTables->isInitialized())
{
+ impl_fillTableFilter();
// check if our "master connection" can supply tables
getMasterTables();
@@ -625,6 +637,7 @@ void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed)
{
if (!m_pViews->isInitialized())
{
+ impl_fillTableFilter();
// check if our "master connection" can supply tables
Reference< XViewsSupplier > xMaster(getMasterTables(),UNO_QUERY);
diff --git a/dbaccess/source/core/dataaccess/connection.hxx b/dbaccess/source/core/dataaccess/connection.hxx
index e8a8a2ca9135..88e59f007a25 100644
--- a/dbaccess/source/core/dataaccess/connection.hxx
+++ b/dbaccess/source/core/dataaccess/connection.hxx
@@ -276,6 +276,10 @@ private:
m_xConnectionTools is nol <NULL/>
*/
void impl_loadConnectionTools_throw();
+
+ /** reads the table filter and table type filter from the datasourfce
+ */
+ void impl_fillTableFilter();
};
//........................................................................
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 8a7ff1b1595c..141c8cdc2448 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -553,8 +553,6 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio
if ( m_aDatabaseObjects.find( _rName ) != m_aDatabaseObjects.end() )
{
- OSL_ENSURE( false, "ODatabaseContext::revokeObject: a database document register by name? This shouldn't happen anymore!" );
- // all the code should have been changed so that registration is by URL only
m_aDatasourceProperties[ sURL ] = m_aDatasourceProperties[ _rName ];
}
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 37a68f058e3a..fd258bb0255b 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1613,8 +1613,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 e0d3f10aed8d..4fe5101863db 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;
@@ -815,9 +816,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 7334e72a1ffc..c8fe0c49ec4a 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -380,9 +380,12 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
::rtl::OUString sServiceName;
if ( Reference< XNameAccess >( xObjectToCopy, UNO_QUERY ).is() )
+ {
if ( m_bFormsContainer )
sServiceName = SERVICE_NAME_FORM_COLLECTION;
- else sServiceName = SERVICE_NAME_REPORT_COLLECTION;
+ else
+ sServiceName = SERVICE_NAME_REPORT_COLLECTION;
+ }
else
sServiceName = SERVICE_SDB_DOCUMENTDEFINITION;
@@ -503,7 +506,7 @@ namespace
if ( bRet )
{
_rRet = _xNameContainer->getByName(_sSimpleName = sName);
- while ( nIndex != -1 )
+ while ( nIndex != -1 && bRet )
{
sName = _sName.getToken(0,'/',nIndex);
_xNameContainer.set(_rRet,UNO_QUERY);
@@ -517,8 +520,10 @@ namespace
}
}
}
- else if ( nIndex == -1 )
- _sSimpleName = sName; // a content on the root content
+ if ( nIndex == -1 )
+ _sSimpleName = sName; // a content
+ else
+ _xNameContainer.clear(); // a sub folder doesn't exist
return bRet;
}
}
@@ -540,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 );
}
@@ -610,15 +614,24 @@ sal_Bool SAL_CALL ODocumentContainer::hasByHierarchicalName( const ::rtl::OUStri
// XHierarchicalNameContainer
void SAL_CALL ODocumentContainer::insertByHierarchicalName( const ::rtl::OUString& _sName, const Any& _aElement ) throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
+ Reference< XContent > xContent(_aElement,UNO_QUERY);
+ if ( !xContent.is() )
+ throw IllegalArgumentException();
+
ClearableMutexGuard aGuard(m_aMutex);
Any aContent;
Reference< XNameContainer > xNameContainer(this);
::rtl::OUString sName;
if ( lcl_queryContent(_sName,xNameContainer,aContent,sName) )
throw ElementExistException(_sName,*this);
- Reference< XContent > xContent(_aElement,UNO_QUERY);
- if ( !xContent.is() )
- throw IllegalArgumentException();
+
+ if ( !xNameContainer.is() )
+ {
+ ::rtl::OUString sMessage( DBA_RES( RID_STR_NO_SUB_FOLDER ) );
+ sal_Int32 index = sName.getLength();
+ ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$folder$", _sName.getToken(0,'/',index) );
+ throw IllegalArgumentException( sMessage, *this, 1 );
+ }
xNameContainer->insertByName(sName,_aElement);
}
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index e1c12034b49a..20d1ce157b45 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 20e0eb280233..8bfa73bbde48 100644
--- a/dbaccess/source/core/inc/core_resource.hrc
+++ b/dbaccess/source/core/inc/core_resource.hrc
@@ -88,7 +88,29 @@
#define RID_STR_NAME_NOT_FOUND ( RID_CORE_STRINGS_START + 45 )
#define RID_STR_QUERY_DOES_NOT_EXIST ( RID_CORE_STRINGS_START + 46 )
#define RID_STR_ERROR_WHILE_SAVING ( RID_CORE_STRINGS_START + 47 )
-#define RID_NO_SUCH_DATA_SOURCE ( RID_CORE_STRINGS_START + 48 )
+#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 )
+
+#define RID_NO_SUCH_DATA_SOURCE ( RID_CORE_STRINGS_START + 67 )
#endif // _DBA_CORE_RESOURCE_HRC_
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 90294dd59869..23eda6049d24 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -444,7 +444,6 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const String& _rDsn) const
return aKnowPrefixes[i].eType;
}
- DBG_ERROR("ODsnTypeCollection::implDetermineType : unrecognized data source type !");
return DST_UNKNOWN;
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/core/resource/strings.src b/dbaccess/source/core/resource/strings.src
index 3fc3806963a5..33243e199330 100644
--- a/dbaccess/source/core/resource/strings.src
+++ b/dbaccess/source/core/resource/strings.src
@@ -250,5 +250,80 @@ String RID_NO_SUCH_DATA_SOURCE
{
Text [ en-US ] = "Error accessing data source '$name$':\n$error$";
};
-
+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.";
+};