List:MySQL and Perl« Previous MessageNext Message »
From:Jochen Wiedmann Date:July 27 2001 5:08pm
Subject:Re: quoting
View as plain text  
Raul Dias wrote:

>>That works, if all arguments are strings. It doesn't
>>for mixed types. (It probably does for MySQL, but not
>>for other databases.)
> Why not? Could you explain?  
> (this is the original question on this thread was about)

It is a typical behaviour, that quoting depends
on the database type. For example, Oracle or Adabas D
will refuse a query like

   SELECT * FROM foo WHERE integer_column = '1'

because the single quotes are reserved for String types.
That is the reason, why DBI allows a second parameter
for $dbh->quote().

For example, in the above example you would need to


   $query = "SELECT * FROM foo WHERE integer_column = "
     . $dbh->quote(1, DBI::SQL_INTEGER);

With placeholders, however, the database cares about
the column type.

quotingRaul Dias24 Jul
  • Re: quotingDodger24 Jul
    • Re: quotingChristopher Hicks25 Jul
      • Re: quotingJochen Wiedmann26 Jul
Re: quotingRaul Dias27 Jul
  • Re: quotingDodger27 Jul
  • Re: quotingJochen Wiedmann27 Jul
Re: quotingRaul Dias27 Jul
  • Re: quotingJochen Wiedmann27 Jul
  • Re: quotingDodger27 Jul