[DBD::Pg 1/2] Test using lots of placeholders.

dbdpg-commits-gENoVmVU/[email protected] Mon, 20 Aug 2012 14:02:08 -0400
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Committed by Greg Sabino Mullane <greg-O9fzpki4YnJWk0Htik3J/[email protected]>

Subject: [DBD::Pg 1/2] Test using lots of placeholders.

---
 t/04misc.t |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/t/04misc.t b/t/04misc.t
index 9c0cedc..7f6eadc 100644
--- a/t/04misc.t
+++ b/t/04misc.t
@@ -18,7 +18,7 @@ my $dbh = connect_database();
 if (! $dbh) {
 	plan skip_all => 'Connection to database failed, cannot continue testing';
 }
-plan tests => 57;
+plan tests => 70;
 
 isnt ($dbh, undef, 'Connect to database for miscellaneous tests');
 
@@ -375,5 +375,18 @@ else {
 	pass "pg_st_split_statement gave no problems with various lengths";
 }
 
+## Check for problems with insane number of placeholders
+for my $ph (1..13) {
+	my $total = 2**$ph;
+	$t = "prepare/execute works with $total placeholders";
+	my $sql = 'SELECT count(*) FROM pg_class WHERE relpages IN (' . ('?,' x $total);
+	$sql =~ s/.$/\)/;
+	my $sth = $dbh->prepare($sql);
+	my @arr = (1..$total);
+	my $count = $sth->execute(@arr);
+	is $count, 1, $t;
+}
+
+
 cleanup_database($dbh,'test');
 $dbh->disconnect();
-- 
1.7.1