Subject | Re: [firebird-support] Help decoding XSQLVARs |
---|---|
Author | Ann W. Harrison |
Post date | 2009-07-28T22:36:51Z |
woodsmailbox wrote:
antique perhaps, but C code.
Integer types are stored as integers, as are decimal and numeric.
To translate decimal and numeric to their intended values, multiply
the value passed by 10 to the power of the inverse of the scale.
Thus a value that's a decimal (9, 2) with a value of 110 as an
integer becomes 110 * (10 ** -2) or 1.10
Floats are stored as floats, larger or smaller.
Good luck,
Ann
> Hi,isql was written originally to test that interface. It's C code,
>
> Does anybody have a piece of C code (or doc) that reads an XSQLVAR?
> Specifically, I need to decode the various number types into some
> generic format (bcd or double or whatever).
>
> The IB6 API Guide advice on this is to consult isql to find out
> how the number is stored :)
antique perhaps, but C code.
Integer types are stored as integers, as are decimal and numeric.
To translate decimal and numeric to their intended values, multiply
the value passed by 10 to the power of the inverse of the scale.
Thus a value that's a decimal (9, 2) with a value of 110 as an
integer becomes 110 * (10 ** -2) or 1.10
Floats are stored as floats, larger or smaller.
Good luck,
Ann