summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorOcke Janssen [oj] <Ocke.Janssen@sun.com>2010-01-20 14:49:00 +0100
committerOcke Janssen [oj] <Ocke.Janssen@sun.com>2010-01-20 14:49:00 +0100
commita4bcd82d3aebaa856b11ba92571e79ea6aab5775 (patch)
treea500155712c2eb3eb8a49e225324b43f5148d81e /dbaccess
parent23aabe20a1766634414e90713d6e18243bd39e83 (diff)
dba33d: #i106772# cut decimal and numeric when greater than scale allows to be
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/KeySet.cxx43
-rw-r--r--dbaccess/source/core/api/KeySet.hxx2
2 files changed, 27 insertions, 18 deletions
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 474ad8a38b65..4f6c15d22798 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -594,6 +594,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);
}
@@ -676,6 +677,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);
}
@@ -802,24 +804,7 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow)
SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
for(;aPosIter != aPosEnd;++aPosIter,++aIter)
{
- ORowSetValue aValue((_rInsertRow->get())[aPosIter->second.nPosition]);
- switch(aPosIter->second.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 + (aPosIter->second.nScale > 0 ? aPosIter->second.nScale + 1 : 0));
- }
- }
- break;
- default:
- break;
- }
- *aIter = aValue;
+ *aIter = (_rInsertRow->get())[aPosIter->second.nPosition];
aIter->setTypeKind(aPosIter->second.nType);
}
}
@@ -1477,3 +1462,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: