use strict;
use warnings;
use DBI;
unlink 'foo.db';
my $dbh = DBI->connect('dbi:SQLite:dbname=foo.db');
$dbh->do('CREATE TABLE foo(foo, bar INTEGER, baz TEXT, qux NULL)');
$dbh->do('INSERT INTO foo VALUES(1,1,1,1)');
$dbh->do("INSERT INTO foo VALUES('2','2','2','2')");
$dbh->do("INSERT INTO foo VALUES('a','a','a','a')");
foreach my $col('foo','bar','baz','qux')
{
foreach my $val("1","'1'","2","'2'","'a'")
{
my $sth = $dbh->prepare("SELECT * FROM foo WHERE $col=$val");
$sth->execute;
$sth->fetch or warn "$col=$val";
$sth = $dbh->prepare("SELECT * FROM foo WHERE $col=?");
$sth->execute(eval $val);
$sth->fetch or warn "$col=? $val";
}
}