in reply to Is there a way to display the statement generated by DBD on execute()
$sth->execute (usually) doesn't create any SQL at all. Most DBD modules pass the string as-is to the database engine, which often directly support prepared statements.
That said, DBI supports tracing, which allows you to find out what happens between DBI/DBD and the database. See the section TRACING in the DBI docs.
Finally a possible way to create your SQL is this:
my @exclude_ids = (88, 99); my $sql = 'SELECT * FROM blog WHERE ID NOT IN (' . join(', ', ('?') x +@exclude_ids) . ')'; my $sth = $dbh->prepare($sql); $sth->execute(@exclude_ids);
|
|---|