dblib problem

Mark J. Lilback mark at lilback.com
Thu Apr 4 16:28:36 EST 2002


Most APIs I've worked with function this way (I know I've seen ODBC 
drivers that don't clear them, and I think Oracle doesn't either). 
You're suppose to bind an indicator variable that you check for a 
NULL in before looking at the real value (or you can set the 
variables to zero/null).

A NULL value is not zero, but distinct from it. So setting it to zero 
really isn't the correct thing to do. It might be convenient, but it 
could easily lead to incorrect code because you aren't checking the 
indicator variables.

Since this is incompatible with the Sybase implementation, it might 
need fixing to maintain compatibility. But if NULL values are 
allowed, you reall should be checking the indicator variables.

Just my opinion, FWIW


At 1:36 PM -0700 4/4/02, Steven J. Backus wrote:
>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.


-- 
__________________________________________________________________________
                                   "They that can give up essential liberty
Mark J. Lilback                    to obtain a little temporary safety
<mark at lilback.com>                 deserve neither liberty or safety."
http://www.lilback.com/                               -- Benjamin Franklin



More information about the FreeTDS mailing list