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
Thanks!
--
Walter Anthony
System Administrator
National Electronic Attachment
Atlanta, Georgia
"If it's not broke....tweak it"
---------------------------------------------------------------------
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