Skip to Content.
Sympa Menu

freetds - [freetds] dblib program

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Steven J. Backus" <backus AT math.utah.edu>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] dblib program
  • Date: Mon, 4 Aug 2003 11:28:34 -0600 (MDT)

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




Archive powered by MHonArc 2.6.24.

Top of Page