1use strict; 2use warnings; 3use Test::Requires qw(DBD::Pg Test::PostgreSQL); 4use Test::More; 5use Test::PostgreSQL; 6use t::Util; 7use DBIx::QueryLog (); 8use DBI; 9 10my $pg = t::Util->setup_postgresql 11 or plan skip_all => $Test::PostgreSQL::errstr || 'failed setup_postgresql'; 12 13my $dbh = DBI->connect( 14 $pg->dsn(dbname => 'test'), '', '', 15 { 16 AutoCommit => 1, 17 RaiseError => 1, 18 }, 19) or die $DBI::errstr; 20 21DBIx::QueryLog->begin; 22 23my $res = capture { 24 my $sth = $dbh->prepare('SELECT * FROM user WHERE User = ? OR User = ?'); 25 $sth->bind_param(1, 'root'); 26 $sth->bind_param(2, 'xaicron'); 27 $sth->execute; 28}; 29 30like $res, qr/SELECT \* FROM user WHERE User = 'root' OR User = 'xaicron'/; 31 32done_testing; 33