summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorTamas Bunth <tamas.bunth@collabora.co.uk>2017-12-08 23:38:36 +0100
committerAndras Timar <andras.timar@collabora.com>2018-03-19 14:56:17 +0100
commit90c2bd7b1a79c7c802646217bc5407ce1e1e069f (patch)
tree1a3c1e18841b0d98a57656039ec1a889532cd176 /connectivity
parent5f19a29d3a2bf78ea39d9c759e15c2274235b012 (diff)
clean code at setObjectWithInfo
Change-Id: I8cb4eaebd71d8b06523230954da15d73325ac94b Reviewed-on: https://gerrit.libreoffice.org/46130 Reviewed-by: Tamás Bunth <btomi96@gmail.com> Tested-by: Tamás Bunth <btomi96@gmail.com> (cherry picked from commit 907423a6ec5c2170dbf2ca445c0a1285e9a6adfc)
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx34
1 files changed, 14 insertions, 20 deletions
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 926810783e67..445a2b114b89 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -589,25 +589,25 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
if(sqlType == DataType::DECIMAL || sqlType == DataType::NUMERIC)
{
- double myDouble=0.0;
- OUString myString;
- if( x >>= myDouble )
+ double dbValue =0.0;
+ OUString sValue;
+ if( x >>= dbValue )
{
- myString = OUString::number( myDouble );
+ sValue = OUString::number( dbValue );
}
else
{
- x >>= myString;
+ x >>= sValue;
}
// fill in the number with nulls in fractional part.
// We need this because e.g. 0.450 != 0.045 despite
// their scale is equal
OUStringBuffer sBuffer(15);
- sBuffer.append(myString);
- if(myString.indexOf('.') != -1) // there is a dot
+ sBuffer.append(sValue);
+ if(sValue.indexOf('.') != -1) // there is a dot
{
- for(sal_Int32 i=myString.copy(myString.indexOf('.')+1).getLength(); i<scale;i++)
+ for(sal_Int32 i=sValue.copy(sValue.indexOf('.')+1).getLength(); i<scale;i++)
{
sBuffer.append('0');
}
@@ -619,30 +619,24 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
sBuffer.append('0');
}
}
- myString = sBuffer.makeStringAndClear();
- // set value depending on type
- sal_Int16 n16Value = 0;
- sal_Int32 n32Value = 0;
- sal_Int64 n64Value = 0;
+
+ sValue = sBuffer.makeStringAndClear();
switch(dType)
{
case SQL_SHORT:
- n16Value = (sal_Int16) toNumericWithoutDecimalPlace(myString);
setValue< sal_Int16 >(parameterIndex,
- n16Value,
+ static_cast<sal_Int16>( toNumericWithoutDecimalPlace(sValue) ),
dType);
break;
case SQL_LONG:
- case SQL_DOUBLE: // TODO FIXME 32 bits
- n32Value = (sal_Int32) toNumericWithoutDecimalPlace(myString);
+ case SQL_DOUBLE:
setValue< sal_Int32 >(parameterIndex,
- n32Value,
+ static_cast<sal_Int32>( toNumericWithoutDecimalPlace(sValue) ),
dType);
break;
case SQL_INT64:
- n64Value = toNumericWithoutDecimalPlace(myString);
setValue< sal_Int64 >(parameterIndex,
- n64Value,
+ toNumericWithoutDecimalPlace(sValue),
dType);
break;
default: