DBIx::Printf - A printf-style prepared statement
use DBIx::Printf; my $sql = $dbh->printf( 'select * from t where str=%s or int=%d or float=%f', 'string', 1, 1.1e1);
DBIx::Printf is a printf-style prepared statement. It adds a
printf method to DBI::db package.
Builds a SQL statement from given statement with placeholders and values. Following placeholders are supported.
%d - integer %f - floating point %s - string %t - do not quote, pass thru %like(fmt) - formats and quotes a string for like expression
Below is an example of using the %%like placeholder. Since metacharacters of supplied parameters are escaped, the example would always by a prefix search.
$dbh->printf('select * from t where name like %like(%s%%)', $name);
Copyright (c) 2007 Kazuho Oku All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.