Author: turnstep
Date: Tue Jan 15 18:00:18 2008
New Revision: 10564

Modified:
   DBD-Pg/trunk/dbdimp.c
   DBD-Pg/trunk/t/08async.t

Log:
The highly useful pg_sleep was not in the early 8 series, alas.


Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c       (original)
+++ DBD-Pg/trunk/dbdimp.c       Tue Jan 15 18:00:18 2008
@@ -3986,7 +3986,9 @@
                 imp_dbh_t *imp_dbh;
 {
 
-       if (dbis->debug >= 4) { (void)PerlIO_printf(DBILOGFP, "dbdpg: 
pg_st_ready\n"); }
+       if (dbis->debug >= 4) {
+               (void)PerlIO_printf(DBILOGFP, "dbdpg: pg_st_ready, async_status 
is %d\n",imp_dbh->async_status);
+       }
 
        if (0 == imp_dbh->async_status) {
                pg_error(h, PGRES_FATAL_ERROR, "No asynchronous query is 
running\n");

Modified: DBD-Pg/trunk/t/08async.t
==============================================================================
--- DBD-Pg/trunk/t/08async.t    (original)
+++ DBD-Pg/trunk/t/08async.t    Tue Jan 15 18:00:18 2008
@@ -24,7 +24,7 @@
        plan skip_all => 'Cannot run asynchronous queries with pre-8.0 
libraries.';
 }
 
-plan tests => 66;
+plan tests => 67;
 
 ok( defined $dbh, 'Connect to database for async testing');
 
@@ -185,12 +185,19 @@
 SKIP: {
 
 
-       if ($pgversion < 80000) {
-               skip 'Need pg_sleep() to perform rest of async tests: your 
Postgres is too old', 10;
+       if ($pgversion < 80200) {
+               skip 'Need pg_sleep() to perform rest of async tests: your 
Postgres is too old', 14;
        }
 
+       eval {
+               $dbh->do('SELECT pg_sleep(0)');
+       };
+       is($@, q{}, 'Calling pg_sleep works as expected');
+
        my $time = time();
-       $res = $dbh->do('SELECT pg_sleep(2)', {pg_async => PG_ASYNC});
+       eval {
+               $res = $dbh->do('SELECT pg_sleep(3)', {pg_async => PG_ASYNC});
+       };
        $time = time()-$time;
        $t = q{Database method do() returns right away when in async mode};
        cmp_ok($time, '<=', 1, $t);

Reply via email to