On Wed, Oct 24, 2001 at 12:38:50PM +0200, Bart Lateur wrote:
> On Wed, 24 Oct 2001 11:01:25 +0200, Wolfgang Weisselberg wrote:
> 
> >    insert into bar (foo,baz) values ('NULL', 'inserted string NULL');
> >    insert into bar (foo,baz) values ( NULL , 'inserted (undefined) NULL');
> >
> >    select * from bar where foo = ?
> 
> >Try binding 
> >    my $bindvar = "NULL";
> >and tell me which of the 2 rows will be selected.  Tell me
> >what would happen if DBI transformed the NULL in $bindvar to
> >"is null".
> 
> Bull.

Be kind.

> "NULL" is a string containing 4 characters. If you want NULL, try
> undef. I really would like
> 
>       my $bindchar = undef;
> 
> to allow the system to select the second record from your example, and
> NOT having to generate a whole different statement for the similar but
> slightly different case where you go searching for NULL's.

We all would, but we have to live with the standards and database
servers we're given and make the most of it. The DBI docs do give
an example, as I quoted earlier in this thread, of how to write a
general expression to let you bind null and not null values. It's
not pretty but it works.

Let's stop this thread now - all sides have had their say we we're
starting to go round in circles.

Tim.

Reply via email to