Skip to Content.
Sympa Menu

freetds - dblib problem

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 franklin.metalab.unc.edu
  • Subject: dblib problem
  • Date: Thu, 4 Apr 2002 13:36:37 -0700 (MST)


Ok I went and defined INADDR_NONE (it's not in any of the include
files on solaris, intel or otherwise) and got the latest snapshot
to work, I can connect with sqsh. I'm still having my dblib problem:

dbcmd(dbproc, "select id, aflag, bstate, bcont, bday, bmonth, ");
dbcmd(dbproc, "byear, bordma, bordU, dead, dage, dstate, dcont, ");
dbcmd(dbproc, "dday, dmonth, dyear, mult, multord, polyg, ");
dbcmd(dbproc, "race, related, sex, spanish from Uperson ");
dbsqlexec(dbproc);
if(dbresults(dbproc) == SUCCEED) {
dbbind(dbproc, 1, INTBIND, (DBINT)0, (BYTE*) &id);
...
dbbind(dbproc, 23, INTBIND, (DBINT)0, (BYTE*) &spanish);
while(dbnextrow(dbproc) != NO_MORE_ROWS) {
...
anon.spanish = spanish; /* filling up a struct here, you get the idea */
---

The spanish variable is declared DBINT. I go into gdb and break to
examine spanish and it's:

(gdb) print spanish
$1 = -543424100

The actual value of spanish in the database is NULL, and when I use
the standard dblib that came with sybase, my spanish is set to
zero. Now, you might say "why not just initialize spanish to 0?"
But this problem is more dramatic. Whenever spanish is NULL, the
value is not set. So say spanish was 9, then the next dbnextrow
it's NULL. Since it's not set, spanish stays 9. I could reset it
to zero on every pass, but there's a lot of these variables, and a
few programs. Besides, this seems to be broken so maybe we should
fix it. As usual, TIA and all that.

Steve




Archive powered by MHonArc 2.6.24.

Top of Page