Skip to Content.
Sympa Menu

freetds - Re: dblib problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT ais.org>
  • To: TDS Development Group <freetds AT franklin.metalab.unc.edu>
  • Subject: Re: dblib problem
  • Date: Thu, 4 Apr 2002 17:58:24 -0500 (EST)


There was discussion about this about 3 weeks ago. The appropriate dblib
call to reference is dbsetnull(). It defines what value should be copied
into the variable on a null. Unfortunately, it's unimplemented.

Brian

On Thu, 4 Apr 2002, Steven J. Backus wrote:

> 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
>
> ---
> You are currently subscribed to freetds as: [camber AT ais.org]
> To unsubscribe, forward this message to $subst('Email.Unsub')
>






Archive powered by MHonArc 2.6.24.

Top of Page