Lazarus
Programming => Databases => Topic started by: Cigydd on September 30, 2009, 06:23:13 pm
-
Hi everybody,
I experience troubles using SQLite query. :'(
Accessing fields defined as real in SQLite, the stored values get truncated to whole numbers (integers).
Lazarus 0.9.27/fpc 2.2.2, Laz. 0.9.26.2.
Is there someone who would know how do I need to define the field in SQLite to get real floating point values? Is this a bug or not? Please help me.
-
One way is to use the numeric field, define the numbers by numeric(6,2) for example for currency operations or change either of those values to suit your needs or use float instead of real.
-
Thank you :)
I think that float also gets truncated. But I'll test it.
Fields defined as numeric(x,y) get divided by 10,000. I can only work it around by multiplying the values. Again, is it a bug or not?
-
I have already tested it. Changed all real fields to floats but still everything gets truncated. :(
-
I think it's the regional setting. We have a decimal comma instead of point. I send the numbers with the comma to the SQL command and so it becomes truncated. So it has a merely prosaic reason.
Excuse me for annoying.
-
Strangely enough, it still persists, even when I use the decimal point.
Edit:
And even strangelier, it's gone. Sorry for the noise.
-
I have a similar problem.
In what control do you see the number truncated ?
With a SQL Select to Firebird Database, the float field in TDBEdit show only 2 digits(60), but in TDBGrid show fine the number.(606)
For me is TDBEdit issue,
Under Lazarus 0.9.29 svn 21445. fpc 2.3.1 svn 13383.
I will do more check with the last lazarus svn for report in bugtracker.
Regards
-
For me, the truncated numbers were only got from TQuerys and saved into a log file. No specific control. In my case it was my mistake - now I'm aware that the most probable cause was that I didn't convert the numbers from decimal comma to decimal point.
-
In my case the problem is not decimal comma or decimal point.
DBEdit show only 2 digits after
-
SQLTransaction.Commit
SQLTransaction.StartTransaction.
--
DBGrid in the same transaction that DBEdit show fine the float number.
I don't know if is a SQLdb issue(fpc) or TDBEdit issue(LCL).
I will do more test.