On Sat, Sep 01, 2001 at 02:38:05PM -0500, Mike808 wrote:
> 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'"

Ack, no!  This is for escaping characters for use in a regular
expression, not in a database query.

Besides, the question was about how to use placeholders, not how to
embed a data string directly into an SQL query.  It's far better to
use placeholders, especially if you're using a database like Oracle
that supports them natively, providing a huge performance boost.

 -Ken

Reply via email to