summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx16
-rw-r--r--connectivity/source/inc/dbase/DTable.hxx2
2 files changed, 9 insertions, 9 deletions
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 18d531e168f5..3add20444d97 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -1513,7 +1513,7 @@ sal_Bool ODbaseTable::InsertRow(OValueRefVector& rRow, sal_Bool bFlush,const Ref
sal_uInt32 nTempPos = m_nFilePos;
m_nFilePos = (sal_uIntPtr)m_aHeader.db_anz + 1;
- sal_Bool bInsertRow = UpdateBuffer( rRow, NULL, _xCols );
+ sal_Bool bInsertRow = UpdateBuffer( rRow, NULL, _xCols, true );
if ( bInsertRow )
{
sal_uInt32 nFileSize = 0, nMemoFileSize = 0;
@@ -1575,7 +1575,7 @@ sal_Bool ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,con
m_pMemoStream->Seek(STREAM_SEEK_TO_END);
nMemoFileSize = m_pMemoStream->Tell();
}
- if (!UpdateBuffer(rRow, pOrgRow,_xCols) || !WriteBuffer())
+ if (!UpdateBuffer(rRow, pOrgRow, _xCols, false) || !WriteBuffer())
{
if (HasMemoFields() && m_pMemoStream)
m_pMemoStream->SetStreamSize(nMemoFileSize); // restore old size
@@ -1676,7 +1676,7 @@ static double toDouble(const rtl::OString& rString)
}
//------------------------------------------------------------------
-sal_Bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const Reference<XIndexAccess>& _xCols)
+sal_Bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow, const Reference<XIndexAccess>& _xCols, const bool bForceAllFields)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::UpdateBuffer" );
OSL_ENSURE(m_pBuffer,"Buffer is NULL!");
@@ -1822,10 +1822,10 @@ sal_Bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,c
++nPos; // the row values start at 1
- // If the variable is bound at all?
- if ( !rRow.get()[nPos]->isBound() )
+ // don't overwrite non-bound columns
+ if ( ! (bForceAllFields || rRow.get()[nPos]->isBound()) )
{
- // No - the next field.
+ // No - don't overwrite this field, it has not changed.
nByteOffset += nLen;
continue;
}
@@ -1836,14 +1836,14 @@ sal_Bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,c
ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
OSL_ENSURE(pIndex,"ODbaseTable::UpdateBuffer: No Index returned!");
// Update !!
- if (pOrgRow.is() && !rRow.get()[nPos]->getValue().isNull() )
+ if (pOrgRow.is() && rRow.get()[nPos]->isBound() && !rRow.get()[nPos]->getValue().isNull() )
pIndex->Update(m_nFilePos,*(pOrgRow->get())[nPos],*rRow.get()[nPos]);
else
pIndex->Insert(m_nFilePos,*rRow.get()[nPos]);
}
char* pData = (char *)(m_pBuffer + nByteOffset);
- if (rRow.get()[nPos]->getValue().isNull())
+ if (rRow.get()[nPos]->getValue().isNull() || !rRow.get()[nPos]->isBound())
{
if ( bSetZero )
memset(pData,0,nLen); // Clear to NULL
diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx
index 6ee83643074c..ec31dbc15c3a 100644
--- a/connectivity/source/inc/dbase/DTable.hxx
+++ b/connectivity/source/inc/dbase/DTable.hxx
@@ -116,7 +116,7 @@ namespace connectivity
sal_Bool WriteMemo(ORowSetValue& aVariable, sal_uIntPtr& rBlockNr);
sal_Bool WriteBuffer();
- sal_Bool UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols);
+ sal_Bool UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols, bool bForceAllFields);
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> isUniqueByColumnName(sal_Int32 _nColumnPos);
void AllocBuffer();