[fpc-devel] SQLite and ftFmtBCD
LacaK
lacak at zoznam.sk
Wed May 11 09:25:03 CEST 2011
>> or better:
>> ftFmtBCD: begin
>> if P.AsFMTBCD.Precision > 15 then //we are out of REAL range, so we must bind as BLOB
>> begin
>> s tr1=BCDTOStrP.AsFMTBCD,SQLFormatSettings);
>> checkerror(sqlite3_bind_blob(fstatement,I,pcharstr(str1), length(str1), @freebindstring));
>> end
>> else
>> begin
>> d o1=P.AsFloat
>> checkerror(sqlite3_bind_double(fstatement,I,do1));
>> end;
>> end;
>>
>
> This is wrong. There are some values which can't be written as floats,
> but have precision<15.
>
>
Joost, look at ftBCD, ftCurrency they are also written as floats
So if there is it acceptable, then I would say, that also in this case
is it acceptable, isn't it ?
(I do not say, that it is perfect)
>
> Can you create a patch which does this?
>
Patch is attached.
DECIMAL -> ftBCD (if precision and scale is not supplied, then scale=0)
DECIMAL(p) = DECIMAL(p,0) = DECIMAL(p,<nonnumeric>) -> if p<=18 then
ftLargeInt else ftFmtBCD
DECIMAL(p,s) -> if s>4 or p-s>14 then ftFmtBCD (number does not fit into
currency)
-Laco.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20110511/adb3e539/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sqlite3conn.diff
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20110511/adb3e539/attachment.ksh>
More information about the fpc-devel
mailing list