Subject | How do you fetch SmallInt data type using sqlda? |
---|---|
Author | Jeff Lynn |
Post date | 2006-04-13T14:36:18Z |
Hi,
will someone help me with my exploration with Firebird?
I had created a Test.fdb with the following table using ISQL:
SQL> create table Staff (id int not null, name char(64), job
varchar(64), dept smallint, managerId integer, years smallint, salary
double precision, primary key (id));
SQL> insert into Staff values(10, 'Amy Ambrose', 'Supervisor', 101,
110, 5, 50000.56);
SQL> insert into Staff values(110, 'Barbara Betty', 'Manager', 101, 0,
15, 150000.57);
SQL> commit;
I can query it using ISQL and displayed with values expected.
But when I shutdown Firebird server, start my embedded applicaiton,
with the following select stmt:
select id, dept from Staff;
what I got is this:
id: 10 dept: -859045787
id: 110 dept: -859045787
My SQLDA declarion is:
pSqlda->sqlvar[1].sqldata = (char *)&dept;
pSqlda->sqlvar[1].sqltype = SQL_SHORT + 1;
pSqlda->sqlvar[1].sqlind = &deptFlag;
I experiment with different datatype such as SQL_LONG did not get me
anywhere. The only thing that works is if I go back to use INTEGER
for column dept, then it works fine.
Any idea?
jml
will someone help me with my exploration with Firebird?
I had created a Test.fdb with the following table using ISQL:
SQL> create table Staff (id int not null, name char(64), job
varchar(64), dept smallint, managerId integer, years smallint, salary
double precision, primary key (id));
SQL> insert into Staff values(10, 'Amy Ambrose', 'Supervisor', 101,
110, 5, 50000.56);
SQL> insert into Staff values(110, 'Barbara Betty', 'Manager', 101, 0,
15, 150000.57);
SQL> commit;
I can query it using ISQL and displayed with values expected.
But when I shutdown Firebird server, start my embedded applicaiton,
with the following select stmt:
select id, dept from Staff;
what I got is this:
id: 10 dept: -859045787
id: 110 dept: -859045787
My SQLDA declarion is:
pSqlda->sqlvar[1].sqldata = (char *)&dept;
pSqlda->sqlvar[1].sqltype = SQL_SHORT + 1;
pSqlda->sqlvar[1].sqlind = &deptFlag;
I experiment with different datatype such as SQL_LONG did not get me
anywhere. The only thing that works is if I go back to use INTEGER
for column dept, then it works fine.
Any idea?
jml