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