im using DBI in Perl to connect to my PostgreSQL Database.
Everything is working fine but in my debugging (printing results etc.) iam not able to see if the query prepared by perls DBI module is really correct.
I have something like this:
$sth->prepare( qq{SELECT * FROM company WHERE companyname LIKE ? AND city = ?});
$sth->execute( $name.'%', $city);
Iam not able to see how the sql query looks after calling execute, as execute is the latest step where parameters are binded to the query.
I would like to have something like $sth->getLastExecutedQuery()
or something to see how the query looked like.
In this case the function getLastExecutedQuery()
would return:
SELECT * FROM company WHERE companyname LIKE 'Company Name%' AND city = 'City name';
Is there any way to get this? Its only for debugging purposes.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…