diff options
author | Tamás Bunth <btomi96@gmail.com> | 2017-01-29 14:26:16 +0100 |
---|---|---|
committer | Tamás Bunth <btomi96@gmail.com> | 2017-01-30 14:57:40 +0000 |
commit | 4a193d39fb785c75668c977cf6b40d11b0ef4afe (patch) | |
tree | 626c25dc18f925d948b67c2e9eedf392837cd057 /connectivity/source/drivers/firebird/Util.cxx | |
parent | tdf#105548 fix incorrect DATEDIF result. (diff) | |
download | core-4a193d39fb785c75668c977cf6b40d11b0ef4afe.tar.gz core-4a193d39fb785c75668c977cf6b40d11b0ef4afe.zip |
tdf#105101 check scale to determine subtype
For computed decimal/numeric values firebird's subtype remains 0. In
this case we check for the scale of column. If it is not 0 (negative),
than imply numeric.
Change-Id: Ie5a023d165852fe402b3b4cac817b0bbef58e7cd
Reviewed-on: https://gerrit.libreoffice.org/33660
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Tested-by: Tamás Bunth <btomi96@gmail.com>
Diffstat (limited to 'connectivity/source/drivers/firebird/Util.cxx')
-rw-r--r-- | connectivity/source/drivers/firebird/Util.cxx | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx index bd84bba0c9a9..e30a7a9b41f8 100644 --- a/connectivity/source/drivers/firebird/Util.cxx +++ b/connectivity/source/drivers/firebird/Util.cxx @@ -64,10 +64,15 @@ void firebird::evaluateStatusVector(const ISC_STATUS_ARRAY& rStatusVector, } } -sal_Int32 firebird::getColumnTypeFromFBType(short aType, short aSubType) +sal_Int32 firebird::getColumnTypeFromFBType(short aType, short aSubType, short aScale) { aType &= ~1; // Remove last bit -- it is used to denote whether column // can store Null, not needed for type determination + + // if scale is set without subtype then imply numeric + if(aSubType == 0 && aScale < 0) + aSubType = 1; + switch (aType) { case SQL_TEXT: @@ -134,11 +139,16 @@ sal_Int32 firebird::getColumnTypeFromFBType(short aType, short aSubType) } } -OUString firebird::getColumnTypeNameFromFBType(short aType, short aSubType) +OUString firebird::getColumnTypeNameFromFBType(short aType, short aSubType, short aScale) { aType &= ~1; // Remove last bit -- it is used to denote whether column // can store Null, not needed for type determination - switch (aType) + + // if scale is set without subtype than imply numeric + if(aSubType == 0 && aScale < 0) + aSubType = 1; + + switch (aType) { case SQL_TEXT: return OUString("SQL_TEXT"); |