[freetds] dblib program
Steven J. Backus
backus at math.utah.edu
Mon Aug 4 12:28:34 EDT 2003
I have reduced my dblib problem considerably and even have a
workaround, so if you can't replicate it, or fix it, I'm ok. Still, I
would like to make freetds better, so I'm sending this off with
great hope.
First the table def:
create table table1
(i1 varchar(4) null,
family varchar(1) null)
go
Then the insert statement:
insert into table1(i1, family) values ('I64', 'Y');
Now the program:
main(int argc, char** argv) {
DBPROCESS *dbproc;
LOGINREC *login;
DBCHAR i1[5], family;
...
dbcmd(dbproc, "select i1, family from table1 ");
dbsqlexec(dbproc);
if(dbresults(dbproc) == SUCCEED) {
dbbind(dbproc, 1, STRINGBIND, (DBINT)0, (BYTE*) i1);
dbbind(dbproc, 2, CHARBIND, (DBINT)0, (BYTE*) &family);
dbnextrow(dbproc);
printf("%s\n", i1);
}
}
In its present state, the program prints nothing. However, if I
change family to a string:
DBCHAR i1[5], family[2];
and bind it thus:
dbbind(dbproc, 2, STRINGBIND, (DBINT)0, (BYTE*) family);
The printf works and spits out I64. Thank you one and all for your
time and consideration. Let me know if I can provide further
clues.
Steven
More information about the FreeTDS
mailing list