Hi,

Please make sure that you are indeed trying to put a newline into
the database.  The string, '\n', is a 2-character string.

The string, "\n", is a 1-character string (a newline).
So if your text variable is something like 'hello\nworld',
it's no wonder the DBI interface tries to preserve the "\".
Perl itself preserves the slash.

If you text variable is "hello\nworld", then I would indeed be
surprised if what you describe is really happening.

i.e. this is a Perl quoting problem... not a DBI problem, and not
a mod_perl problem.

Stephen

At 12:49 PM 9/1/2001 -0500, ryc wrote:
>I have a query that executes many many times that I would like to optimize
>using placeholders. One of the fields that it will insert into is a 'text'
>field and 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'). I want it to keep the newlines in tact when
>inserted. I have run into this behavior using both DBD::mysql and DBD::Pg.
>
>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?
>
>Thanks for the help.
>
>ryan
>
>
>

Reply via email to