Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-01

Decimal Precision Issue with Firebird

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrew Hall

We are having problems reading decimal/numeric column types with TSQLQuery. It appears if the precision of a decimal/numeric is more than 4 (for instance, DECIMAL(12,8) or DECIMAL(18,10) or DECIMAL(10,6) TSQLQuery raises an exception on reading - EDatabaseError : Unknown field type : COLUMN_NAME. However, using the established (informal) money-types for Firebird - DECIMAL(18,4) or DECIMAL(10,4) are OK, and multiple other variations are OK if precision is 4 or less.

Questions:
1) is this a bug, or a known "feature" or limitation of the FPC Firebird library?
2) is there a workaround? We require a decimal with at least 9 decimal places precision (?perhaps DOUBLE PRECISION)
3) the issue with negative numerics with TSQLQuery being treated as unsigned, described in the bug list as fixed in FPC 231 - has this fix been moved to FPC 224?

Thank you.
Regards,
Andrew Hall.

[Using Firebird 211 with FPC 224 on MacOSX 10.5 with XCode 311]

Michael Van Canneyt
to Andrew Hall
Andrew Hall wrote 11 lines
We are having problems reading decimal/numeric column types with TSQLQuery. It appears if the precision of a decimal/numeric is more than 4 (for instance, DECIMAL(12,8) or DECIMAL(18,10) or DECIMAL(10,6) TSQLQuery raises an exception on reading - EDatabaseError : Unknown field type : COLUMN_NAME. However, using the established (informal) money-types for Firebird - DECIMAL(18,4) or DECIMAL(10,4) are OK, and multiple other variations are OK if precision is 4 or less. Questions: 1) is this a bug, or a known "feature" or limitation of the FPC Firebird library?

It is a limitation.

2) is there a workaround? We require a decimal with at least 9 decimal places precision (?perhaps DOUBLE PRECISION)

I think double precision is your only option at this point.

3) the issue with negative numerics with TSQLQuery being treated as unsigned, described in the bug list as fixed in FPC 231 - has this fix been moved to FPC 224?

I think it has, but Joost should confirm that.

Michael.

Joost van der Sluis
to Michael Van Canneyt

Op maandag 26-01-2009 om 09:13 uur [tijdzone +0100], schreef Michael Van Canneyt:

Show quoted text 16 lines
On Sun, 25 Jan 2009, Andrew Hall wrote: > We are having problems reading decimal/numeric column types with TSQLQuery. > It appears if the precision of a decimal/numeric is more than 4 (for instance, > DECIMAL(12,8) or DECIMAL(18,10) or DECIMAL(10,6) TSQLQuery raises an exception > on reading - EDatabaseError : Unknown field type : COLUMN_NAME. However, using > the established (informal) money-types for Firebird - DECIMAL(18,4) or > DECIMAL(10,4) are OK, and multiple other variations are OK if precision is 4 > or less. > > Questions: > 1) is this a bug, or a known "feature" or limitation of the FPC Firebird > library? It is a limitation.

Not only of the Firebird components, but all db-components. There's no support for real BCD fields. But now the fmtbcd unit has been added to fpc it's a trivial task to add it.

Show quoted text 10 lines
> 2) is there a workaround? We require a decimal with at least 9 decimal places > precision (?perhaps DOUBLE PRECISION) I think double precision is your only option at this point. > 3) the issue with negative numerics with TSQLQuery being treated as unsigned, > described in the bug list as fixed in FPC 231 - has this fix been moved to FPC > 224? I think it has, but Joost should confirm that.

Not yet. We have to release rc1 first.

Joost.