Walt,

Use Perl's 'undef' for NULL values.

$quoted_some_variable = undef;

now the $quoted_some_variable will be a null value.


>>On Thu, 27 Jun 2002 12:50:55 -0400, walt <[EMAIL PROTECTED]>   wrote:

>>I'm in the process of re-writing 100+ perl CGIs written for oracle to mysql.
>>
>>Does anyone know how to get the dbh->quote(some_value) function in perl to 
>>return the string "NULL" if some_value is empty. Currently its returning
>>'' (2 ticks) and when you update a numeric column, it sets the value to 0 
>>"zero". 
>>
>>For example:
>>update kids set age = '' where bla bla...
>>sets the value of age to 0 which is not NULL
>>
>>That works fine for oracle, but not mysql. I would perfer not to litter the 
>>code with a bunch of 
>>if (length($some_variable) == 0)
>> { $quoted_some_variable = "NULL"; }
>>else
>>{ $quoted_some_variable = $dbh->quote($some_variable); }
>>
>>
>>sql, query

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Tel: 1(985)902-8484
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to