Author: turnstep
Date: Tue Apr 22 15:16:49 2008
New Revision: 11136
Modified:
DBD-Pg/trunk/t/12placeholders.t
Log:
Add test for recent bug with identical named placeholders.
Modified: DBD-Pg/trunk/t/12placeholders.t
==============================================================================
--- DBD-Pg/trunk/t/12placeholders.t (original)
+++ DBD-Pg/trunk/t/12placeholders.t Tue Apr 22 15:16:49 2008
@@ -10,11 +10,12 @@
select(($|=1,select(STDERR),$|=1)[1]);
my $dbh = connect_database();
+my $t;
if (! defined $dbh) {
plan skip_all => 'Connection to database failed, cannot continue
testing';
}
-plan tests => 26;
+plan tests => 27;
isnt( $dbh, undef, 'Connect to database for placeholder testing');
@@ -178,13 +179,14 @@
is( $dbh->{pg_placeholder_dollaronly}, 1, q{Value of placeholder_dollaronly
can be retrieved});
+$t=q{prepare/execute does not allow use of raw ? and :foo forms};
$dbh->{pg_placeholder_dollaronly} = 0;
eval {
$sth = $dbh->prepare(q{SELECT uno ?: dos ? tres :foo bar $1});
$sth->execute();
$sth->finish();
};
-like( $@, qr{mix placeholder}, q{prepare/execute does not allow use of raw ?
and :foo forms});
+like( $@, qr{mix placeholder}, $t);
$dbh->{pg_placeholder_dollaronly} = 1;
eval {
@@ -203,6 +205,13 @@
};
like( $@, qr{unbound placeholder}, q{pg_placeholder_dollaronly can be called
as part of prepare()});
+$t=q{prepare works with identical named placeholders};
+eval {
+ $sth = $dbh->prepare(q{SELECT :row, :row, :row, :yourboat});
+ $sth->finish();
+};
+is($@, q{}, $t);
+
$dbh->rollback();
cleanup_database($dbh,'test');