How can I print the SQL query executed after Perl's DBI fills in the placeholders?

前端 未结 8 654
梦毁少年i
梦毁少年i 2021-02-05 09:36

I\'m using Perl\'s DBI module. I prepare a statement using placeholders, then execute the query.

Is it possible to print out the final query that was executed without ma

8条回答
  •  [愿得一人]
    2021-02-05 09:50

    You can do a debug print of a prepared statement using the Statement attribute. This can be accessed either with a "statement handle" or a "database handle".

    print $sth->{Statement} # with a statement handle
    
    print $dbh->{Statement} # with a database handle
    

提交回复
热议问题