Hi,

The DBI docs state the following:

       Binding an `undef' (NULL) to the placeholder will not
       select rows which have a NULL `product_code'! Refer to the
       SQL manual for your database engine or any SQL book for
       the reasons for this.  To explicitly select NULLs you have
       to say "`WHERE product_code IS NULL'" and to make that
       general you have to say:

         ... WHERE (product_code = ? OR (? IS NULL AND product_code IS NULL))

       and bind the same value to both placeholders.

I understand the reasoning for this, and why it's the only way for
database servers that don't understand "= null".

However this syntax does NOT work with DBD::Sybase because of the way
OpenClient handles the prepare. The issue is the "? is null" part:
neither the Sybase client libs, nor the server can determine what
datatype the placeholder is supposed to be, and I see no way to add a
directive to tell the server that this item is of the same type as
"product_code".

Sybase, on the other hand, understands "= null".

I'll document this in the DBD::Sybase docs, but I just wanted to flag
the fact that the method documented in the DBI docs is unfortunately
not portable to Sybase (and *probably* not to ODBC when using a
Sybase). I don't know if ODBC w/MS-SQL handles this correctly or not.

Michael
-- 
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
[EMAIL PROTECTED] - [EMAIL PROTECTED]
International Sybase User Group - http://www.isug.com

Reply via email to