Author: turnstep
Date: Sun Mar 27 09:10:22 2011
New Revision: 14782

Modified:
   DBD-Pg/trunk/t/03smethod.t
   DBD-Pg/trunk/t/12placeholders.t

Log:
More tweaks for 7.4 testing


Modified: DBD-Pg/trunk/t/03smethod.t
==============================================================================
--- DBD-Pg/trunk/t/03smethod.t  (original)
+++ DBD-Pg/trunk/t/03smethod.t  Sun Mar 27 09:10:22 2011
@@ -657,33 +657,40 @@
 # Test of the statement handle method "cancel"
 #
 
-$dbh->do('INSERT INTO dbd_pg_test (id) VALUES (?)',undef,1);
-$dbh->commit;
-$dbh->do('SELECT * FROM dbd_pg_test WHERE id = ? FOR UPDATE',undef,1);
-
-my $dbh2 = $dbh->clone;
-$dbh2->do('SET search_path TO ' . $dbh->selectrow_array('SHOW search_path'));
-
-my $oldaction;
-eval {
-       # This statement will block indefinitely because of the 'FOR UPDATE' 
clause,
-       # so we set up an alarm to cancel it after 2 seconds.
-       my $sthl = $dbh2->prepare('SELECT * FROM dbd_pg_test WHERE id = ? FOR 
UPDATE');
-       $sthl->{RaiseError} = 1;
-
-       my $action = POSIX::SigAction->new(
-               sub {$sthl->cancel},POSIX::SigSet->new(SIGALRM));
-       $oldaction = POSIX::SigAction->new;
-       POSIX::sigaction(SIGALRM,$action,$oldaction);
-
-       alarm(2); # seconds before alarm
-       $sthl->execute(1);
-       alarm(0); # cancel alarm (if execute didn't block)
-};
-# restore original signal handler
-POSIX::sigaction(SIGALRM,$oldaction);
-like ($@,qr/canceling \w+ due to user request/,'cancel');
-$dbh2->disconnect();
+SKIP: {
+       ## 7.4 does not have cancel
+       if ($pglibversion < 80000) {
+               skip ('Not testing cancel 7.4-compiled servers', 1);
+       }
+
+       $dbh->do('INSERT INTO dbd_pg_test (id) VALUES (?)',undef,1);
+       $dbh->commit;
+       $dbh->do('SELECT * FROM dbd_pg_test WHERE id = ? FOR UPDATE',undef,1);
+
+       my $dbh2 = $dbh->clone;
+       $dbh2->do('SET search_path TO ' . $dbh->selectrow_array('SHOW 
search_path'));
+
+       my $oldaction;
+       eval {
+               # This statement will block indefinitely because of the 'FOR 
UPDATE' clause,
+               # so we set up an alarm to cancel it after 2 seconds.
+               my $sthl = $dbh2->prepare('SELECT * FROM dbd_pg_test WHERE id = 
? FOR UPDATE');
+               $sthl->{RaiseError} = 1;
+
+               my $action = POSIX::SigAction->new(
+                       sub {$sthl->cancel},POSIX::SigSet->new(SIGALRM));
+               $oldaction = POSIX::SigAction->new;
+               POSIX::sigaction(SIGALRM,$action,$oldaction);
+
+               alarm(2); # seconds before alarm
+               $sthl->execute(1);
+               alarm(0); # cancel alarm (if execute didn't block)
+       };
+       # restore original signal handler
+       POSIX::sigaction(SIGALRM,$oldaction);
+       like ($@,qr/canceling \w+ due to user request/,'cancel');
+       $dbh2->disconnect();
+}
 
 cleanup_database($dbh,'test');
 $dbh->rollback();

Modified: DBD-Pg/trunk/t/12placeholders.t
==============================================================================
--- DBD-Pg/trunk/t/12placeholders.t     (original)
+++ DBD-Pg/trunk/t/12placeholders.t     Sun Mar 27 09:10:22 2011
@@ -426,12 +426,18 @@
 };
 is ($@, q{}, $t);
 
-$t='Calling do() with invalid crowded placeholders fails cleanly';
-$dbh->commit();
-eval {
-  $dbh->do(q{SELECT ??}, undef, 'public', 'error');
-};
-is($dbh->state, '42601', $t);
+SKIP: {
+       if ($pglibversion < 80000) {
+               skip ('Skipping specific placeholder test on 7.4-compiled 
servers', 1);
+
+               $t='Calling do() with invalid crowded placeholders fails 
cleanly';
+               $dbh->commit();
+               eval {
+                       $dbh->do(q{SELECT ??}, undef, 'public', 'error');
+               };
+               is($dbh->state, '42601', $t);
+       }
+}
 
 $t='Prepare/execute with non-DML placeholder works';
 $dbh->commit();

Reply via email to