--- Bart Lateur <[EMAIL PROTECTED]> wrote: > On Tue, 08 Jan 2002 18:10:18 +0100, Martin Hesse > wrote: > > >A quoted string (that has a lot of special > characters in it) is written > >to a file. Later on it is read from that file and > inserted into the > >database using placeholders and bind_param. > > > >Now my problem is, that none of that quoting and > metasign-substition > >disappears. e.g. don\'t is still don\'t and \n > stays \n. How can I > >unquote, resubstitue, ... ???
Hm. My two cents on this issue are that if you need to manipulate the data before you insert it into the database, do that manipulation before you DBI->quote() the string. In my understanding, the quoting (and related character escaping you're talking about) is intended (only) to make sure the data gets into the database safely. When you get the data back out of the database, the characters that were escaped by DBI->quote() will be unescaped, and the quotes themselves are removed. But you knew that. :) If you just need a quoting mechanism for the temporary file where you hold the data to be inserted, I'd recommend using a something that provides a fast, symmetric un-quoting mechanism. A quick search through CPAN found String::Escape, which looks promising. Exactly what makes sense for your application depends a lot on what your data is like. If you REALLY want to undo the effect of DBI->quote() (like as if there was a DBI->unquote()) without actually using the database, you could look into the DBI source code and try to exactly reverse its logic... but I don't recommend that as it puts you in a position where you have to track changes to quote() as DBI changes versions. Plus I imagine that different DBD backends might even do quote() differently (I did not look at the source code to verify this). I'd also suppose there's a reason why there isn't a DBI->unquote() method in the API. Hope This Helps jrobinson __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/
