Subject | How to scale in the IB API? |
---|---|
Author | Richard Wesley |
Post date | 2007-04-05T18:47:43Z |
Hi All -
One of my beta testers is seeing a very strange problem reading fixed
point data from a Firebird 2.0 server: the data appears to be being
scaled twice. The field is a DECIMAL(15,4) domain, but when I query
the rdb$field_precision, I get -1. The user did not create the
database (it is built by a third party application) so we have to
rely on querying the metadata tables to find out about the data
structure. We are using identical FB server versions (2.0 final).
A few questions:
- Under what conditions should I ignore the XSQLVAR.sqlscale
member? Is it only correct for integer types (SQL_SHORT, SQL_LONG,
SQL_QUAD and SQL_INT64) or should I be using it with the floating
point types as well?
- What causes a precision of -1 to be entered into rdb$fields.rdb
$field_precision?
- We have tried using the following DDL to recreate the problem at
my end with no luck (the user cannot share the database file):
CREATE DOMAIN T_AMOUNT AS NUMERIC(15,4);
CREATE TABLE B11231 (
ID INTEGER NOT NULL,
TOTAL_PRICE T_AMOUNT default 0
);
COMMIT;
This appears to yield identical show domain/show table results as the
user's machine, but not identical behaviour. What queries can I run
on his machine to get a better idea of how to replicate this domain
on my development machine?
TIA,
________________________________________________________
Richard Wesley Senior Software Developer Tableau
Software
Visit: http://www.trytableau.com/now.html
One of my beta testers is seeing a very strange problem reading fixed
point data from a Firebird 2.0 server: the data appears to be being
scaled twice. The field is a DECIMAL(15,4) domain, but when I query
the rdb$field_precision, I get -1. The user did not create the
database (it is built by a third party application) so we have to
rely on querying the metadata tables to find out about the data
structure. We are using identical FB server versions (2.0 final).
A few questions:
- Under what conditions should I ignore the XSQLVAR.sqlscale
member? Is it only correct for integer types (SQL_SHORT, SQL_LONG,
SQL_QUAD and SQL_INT64) or should I be using it with the floating
point types as well?
- What causes a precision of -1 to be entered into rdb$fields.rdb
$field_precision?
- We have tried using the following DDL to recreate the problem at
my end with no luck (the user cannot share the database file):
CREATE DOMAIN T_AMOUNT AS NUMERIC(15,4);
CREATE TABLE B11231 (
ID INTEGER NOT NULL,
TOTAL_PRICE T_AMOUNT default 0
);
COMMIT;
This appears to yield identical show domain/show table results as the
user's machine, but not identical behaviour. What queries can I run
on his machine to get a better idea of how to replicate this domain
on my development machine?
TIA,
________________________________________________________
Richard Wesley Senior Software Developer Tableau
Software
Visit: http://www.trytableau.com/now.html