<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=x-mac-ce" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<blockquote cite="mid:1305026325.26119.14.camel@wsjoost.cnoc.lan"
type="cite">
<pre wrap="">I'll look at this solution. I'm a little bit confused about
SQLFormatSettings and why it was implemented as it is now. I'll have to
investigate this.
</pre>
</blockquote>
IMO for locale independent formatting numeric, date, time values
according to sql standard<br>
<br>
<blockquote cite="mid:1305026325.26119.14.camel@wsjoost.cnoc.lan"
type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">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;
</pre>
</blockquote>
<pre wrap=""><!---->
This is wrong. There are some values which can't be written as floats,
but have precision<15.
</pre>
</blockquote>
Yes, then my mystake then we can/must use:<br>
<pre wrap="">ftFmtBCD: begin
str1:=BCDTOStr(P.AsFMTBCD,SQLFormatSettings);
//bind as BLOB, because when bind as TEXT, SQLite always will convert to REAL or INTEGER,
//which can lead to lost of precision
checkerror(sqlite3_bind_blob(fstatement,I,pcharstr(str1), length(str1), @freebindstring));
end;
</pre>
<pre wrap=""><!----></pre>
<br>
<br>
<blockquote cite="mid:1305026325.26119.14.camel@wsjoost.cnoc.lan"
type="cite">
<pre wrap="">
But this particular piece of code is used when an invalid value is
supplied, like 'DECIMAL(10,A)'.</pre>
</blockquote>
yes, in this case we can default to 4 (but A as scale is in all cases
something very strange)<br>
<br>
<blockquote cite="mid:1305026325.26119.14.camel@wsjoost.cnoc.lan"
type="cite">
<pre wrap=""> The case that the value is omitted is
handled elsewhere.
</pre>
</blockquote>
ok, in this case we should use 0<br>
<br>
<blockquote cite="mid:1305026325.26119.14.camel@wsjoost.cnoc.lan"
type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">" Isn't it better to map to a ftInteger/ftLargeInt field when size1=0?"
</pre>
</blockquote>
<pre wrap="">Yes IMHO it is better, at least because ftLargeInt (int64) can hold more
significant digits (left to decimal point) than ftBCD (currency)
But what if user defines NUMERIC(30,0) then we have two options:
1. say "sorry" SQLite does not support this, so we map to ftLargeInt
</pre>
</blockquote>
<pre wrap=""><!---->
Nah...
</pre>
<blockquote type="cite">
<pre wrap="">2. or map to ftFmtBCD if (scale>4) or (precision>18)
if precision>18 then ftFmtBCD
else if scale=0 then ftLargeInt
else if scale<=4 then ftBCD
else ftFmtBCD
</pre>
</blockquote>
<pre wrap=""><!---->
Can you create a patch which does this?
</pre>
</blockquote>
Yes, tomorow I will do it<br>
<br>
Laco.<br>
<br>
</body>
</html>