File: 88async-multi-stmts.t

package info (click to toggle)
libdbd-mysql-perl 4.053-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,128 kB
  • sloc: ansic: 4,780; perl: 836; makefile: 29; sh: 22
file content (43 lines) | stat: -rw-r--r-- 931 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use strict;
use warnings;

use Test::More;
use DBI;
use DBI::Const::GetInfoType;

use vars qw($test_dsn $test_user $test_password);
use lib 't', '.';
require 'lib.pl';

my $dbh;
eval {$dbh= DBI->connect($test_dsn, $test_user, $test_password,
                      { RaiseError => 0, PrintError => 0, AutoCommit => 0 });};
if (!$dbh) {
    plan skip_all => "no database connection";
}
plan tests => 8;

$dbh->do(<<SQL);
CREATE TEMPORARY TABLE async_test (
    value INTEGER
);
SQL

my $sth0 = $dbh->prepare('INSERT INTO async_test VALUES(0)', { async => 1 });
my $sth1 = $dbh->prepare('INSERT INTO async_test VALUES(1)', { async => 1 });

$sth0->execute;
ok !defined($sth1->mysql_async_ready);
ok $sth1->errstr;
ok !defined($sth1->mysql_async_result);
ok $sth1->errstr;

ok defined($sth0->mysql_async_ready);
ok !$sth1->errstr;
ok defined($sth0->mysql_async_result);
ok !$sth1->errstr;

undef $sth0;
undef $sth1;

$dbh->disconnect;