Subject | DSQL statement |
---|---|
Author | Sabotto Massimo |
Post date | 2003-09-29T12:08:34Z |
Hi all of you,
This is my first message to this news-group.
I've some problems on executing INSERT statements into a FB1.5RC5 service.
A little description:
I've defined a table with few columns for a little test application. The
primary key is a field called "ID" of type INTEGER (NOT NULL).
When I setup an XSQLDA structure and fill in the fields with values for
execute an INSERT query, I get all going well. After execution I performed a
SELECT query to see the new row, but something strange appeared: the two
columns with INTEGER and SMALLINT data-type were filled with a 0 on each
one!!!!.
So I searched for a bug on my code, but did not find.
I changed the two columns data-type to DOUBLE PRECISION and it worked! (I
also changed my code too for SQL_DOUBLE).
I also compared my code with examples distributed with FB and IB, but they
seem to be equal.
What I'm doing wrong?
Any suggestion?
Here are few lines of my code:
...
XSQLDA* psqlda = NULL;
ISC_LONG docid = 1;
ISC_SHORT docid2 = 2;
...
// INTEGER column
psqlda->sqlvar[0].sqldata = (char*)&docid;
psqlda->sqlvar[0].sqltype = SQL_LONG;
psqlda->sqlvar[0].sqllen = sizeof(docid);
// SMALLINT column
psqlda->sqlvar[1].sqldata = (char*)&docid2;
psqlda->sqlvar[1].sqltype = SQL_SHORT;
psqlda->sqlvar[1].sqllen = sizeof(docid2);
...
Thank you in advance
Massimo
This is my first message to this news-group.
I've some problems on executing INSERT statements into a FB1.5RC5 service.
A little description:
I've defined a table with few columns for a little test application. The
primary key is a field called "ID" of type INTEGER (NOT NULL).
When I setup an XSQLDA structure and fill in the fields with values for
execute an INSERT query, I get all going well. After execution I performed a
SELECT query to see the new row, but something strange appeared: the two
columns with INTEGER and SMALLINT data-type were filled with a 0 on each
one!!!!.
So I searched for a bug on my code, but did not find.
I changed the two columns data-type to DOUBLE PRECISION and it worked! (I
also changed my code too for SQL_DOUBLE).
I also compared my code with examples distributed with FB and IB, but they
seem to be equal.
What I'm doing wrong?
Any suggestion?
Here are few lines of my code:
...
XSQLDA* psqlda = NULL;
ISC_LONG docid = 1;
ISC_SHORT docid2 = 2;
...
// INTEGER column
psqlda->sqlvar[0].sqldata = (char*)&docid;
psqlda->sqlvar[0].sqltype = SQL_LONG;
psqlda->sqlvar[0].sqllen = sizeof(docid);
// SMALLINT column
psqlda->sqlvar[1].sqldata = (char*)&docid2;
psqlda->sqlvar[1].sqltype = SQL_SHORT;
psqlda->sqlvar[1].sqllen = sizeof(docid2);
...
Thank you in advance
Massimo