in reply to Escaping SQL correctly
> I'm sure DBI has some way to do this
Yes, they're called placeholders. See the DBI docs for prepare() and execute(). Or withouth placeholders see the quote() method.> but I can't work out how I would go about creating a DBI object without a database to connect to
I'm not really sure what you mean. Don't you want to connect to a database and send the escaped SQL to it? If you just want to run DBI and DBD::Pg without connecting to a specific datbase, you can connect to one of the system databases (see the Pg docs for their names).> or how I would intercept the escaped SQL.
Again, I don't know what you mean by intercept, but my $escaped_value = $dbh->quote($unescaped_value) should do the escaping.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Escaping SQL correctly
by Anonymous Monk on Mar 08, 2006 at 01:46 UTC | |
by jZed (Prior) on Mar 08, 2006 at 01:52 UTC | |
by Anonymous Monk on Mar 08, 2006 at 01:56 UTC |