https://bugs.documentfoundation.org/show_bug.cgi?id=156530
--- Comment #13 from Lionel Elie Mamane <[email protected]> --- (In reply to Julien Nabet from comment #11) > "sInput" is "123.45" > "str" is well converted to "123.45" > "dtype" is SQL_LONG (it'll be important next) Well, the code seems to (mistakenly?) believe the value should be set into a (long) integer field. > str.getLength() is equal to 6 => OK > but > pVar->sqllen = 4 so the str is truncated to "123." Well, it smells like this comes from the (wrong?) value of dtype. > not right but whatever, since "dtype" is SQL_LONG, we go there: > 242 case SQL_LONG: > 243 { > 244 sal_Int32 int32Value = sInput.toInt32(); > 245 setInt(nParameterIndex, int32Value); > 246 break; > so we don't use str but "sInput", sInput which contains "123.45" is > converted to Int32 so 123. Well, yes, since according to dtype, we need an integer, so we get an integer out of the data. > In //, I read some info about DECIMAL and NUMERIC here: > https://firebirdsql.org/file/documentation/chunk/en/refdocs/fblangref30/ > fblangref30-datatypes-fixedtypes.html > > a lot of info here but the point to have in mind is this one: > "The form of declaration for fixed-point data, for instance, NUMERIC(p, s), > is common to both types. It is important to realise that the s argument in > this template is scale, rather than "a count of digits after the decimal > point". Understanding the mechanism for storing and retrieving fixed-point > data should help to visualise why: for storage, the number is multiplied by > 10s (10 to the power of s), converting it to an integer; when read, the > integer is converted back." > If I don't misunderstand, it means that in Firebird a DECIMAL or NUMERIC > with display value "123.45" stores physically "12345" plus some info to > indicate it must be divided by 100. Well, OK, but that is an internal Firebird implementation decision and detail. No code outside of connectivity/source/drivers/firebird should need to know that or be aware of that. -- You are receiving this mail because: You are the assignee for the bug.
