"how can i print the sql query executed after perl's dbi fills in the placeholders?" Code Answer

5

see tracing in dbi. the following works using dbd::sqlite but produces a lot of output:

$dbh->trace($dbh->parse_trace_flags('sql|1|test'));

output:

<- prepare('select ... from ... where ... = ?')= dbi::st=hash(0x21ee924) at booklet-excel.pl line 213

<- execute('inhaler')= '0e0' at booklet-excel.pl line 215

etc etc.

you could plug your own filter in to the trace stream to only keep prepares.

By MetaMagnate on August 11 2022

Answers related to “how can i print the sql query executed after perl's dbi fills in the placeholders?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.