Date: Wed, 8 Jan 2003 01:56:39 +0100
From: [EMAIL PROTECTED]
To: Paul DuBois <[EMAIL PROTECTED]>
Subject: Re:  Re: Using Perl DBI quote() method with NULL values?

At 17:16 -0500 1/7/03, walt wrote:
Jeff,
I'm not sure if this will help or not, but we ended up adding our
own version of
quote to
perl cgis. Someone told me when I ask a similar question to check the value
before calling
quote, but it seemed like more of a headache... You may have to use
perl's ord &
chr to look for
\n

walt

sub nea_quote
{
  my ($input) = @_;
  if (length($input) == 0)
  {
   $return_string = "NULL";
   return $return_string;
  }
  else
  {
   $return_string = $dbh->quote($input);
   return $return_string;
  }
}
This seems unnecessary, and (unless I'm missing something), it seems
to treat empty strings as NULL, which isn't necessarily correct.

Just use DBI's quote() method, and pass it undef when you want to produce
a NULL.


sql, query

---------------------------------------------------------------------
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