ryc wrote:
> ... I am having a problem with DBI (or the db) escaping '\n'
> characters so when they are inserted into the database they become '\\n'
> (ie a '\' followed by 'n').

> Does anyone have advice on how this could be done while still using
> placeholders so I dont need to prepare the query more than once?

   $sql .= "'\Q$text\E'"

This is also known as the quotemeta function. 
You might want to investigate the use of the statement handle method "quote".

quote
    $sql = $dbh->quote($value);
    $sql = $dbh->quote($value, $data_type);
  Quote a string literal for use as a literal value in an SQL statement, by
escaping
  any special characters (such as quotation marks) contained within the string
and
  adding the required type of outer quotation marks.
    $sql = sprintf "SELECT foo FROM bar WHERE baz = %s", $dbh->quote("Don't");

Taken straight from the perldocs for "DBI".

mike808/
-- 
perl -le "$_='7284254074:0930970:H4012816';tr[0->][ BOPEN!SMUT];print"

Reply via email to