in reply to getting the sql of a parameterised query
In the general case, it's irrelevant, for several reasons:
Since you can track the SQL you give to prepare and have access to the arguments you pass the execute function, I'd suggest just logging that in the event of an error. You could even replace the values yourself. Something like the naive:
$ST=$DB->prepare($SQL); if (! $ST->execute(@args)) { $SQL=~s/\?/$_/ for @args; print "STATEMENT: $SQL\nERROR: $DBI::errstr\n\n"; }
could be enough to do the trick. (Yes, it's buggy: for the same reasons that you don't just composite the SQL command and data values and execute it that way. But for debugging purposes, it should do just fine.)
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: getting the sql of a parameterised query
by Anonymous Monk on Dec 07, 2010 at 13:08 UTC |