should rollback';
ok my $new = $CLASS->new( 'dbi:ExampleP:dummy', '', '' ), 'Instantiate again';
isnt $new, $conn, 'It should be a different object';
ok $dbh = $new->dbh, 'Connect again';
is $ping,
ror => 0,
RaiseError => 1,
AutoCommit => 0,
}), 'Get a dbh via connect() with same args';
isnt $odbh, $dbh, 'It should not be the same dbh';
$odbh->{AutoCommit} = 1; # Clean up after ourselves
ok my $ddbh = $CLASS->connect('dbi:ExampleP:dummy', '', '' ),
'Get dbh with different args';
isnt $ddbh, $dbh, 'It should be a different database handle';
$dbh->{AutoCommit} = 1; # Clean up after
om dbh()';
is $ping, 1, 'ping should not have been called again';
$dbh->{Active} = 0;
isnt $conn->dbh, $dbh, 'Should get different dbh if after disconnect';
}), 'Do something with handle';
$dbha->{Active} = 0;
ok !$dbha->{Active}, 'Disconnect';
die 'WTF?';
}
isnt $dbha, $dbh, 'Should have new dbh';
});
is $calls, 2, 'Sub should have been called twice';
# Ma
';
local $dbh->{Active} = 0;
$conn->run( fixup => sub {
my $dbha = shift;
isnt $dbha, $dbh, 'Nested should get the same when inactive';
is $_, $dbha, 'Should have dbh i
$dbha->{Active} = 0;
ok !$dbha->{Active}, 'Disconnect';
die 'WTF?';
}
isnt $dbha, $dbh, 'Should have new dbh';
});
ok $dbh = $conn->dbh, 'Get the new handle';
ok $dbh->{Au
, 'in_txn() should know it';
local $dbh->{Active} = 0;
$conn->txn( fixup => sub {
isnt shift, $dbh, 'Nested txn_fixup_run should not get inactive dbh';
ok !$dbh->{AutoCommit},
om dbh()';
is $ping, 1, 'ping should not have been called again';
$dbh->{Active} = 0;
isnt $conn->dbh, $dbh, 'Should get different dbh if after disconnect';
}), 'Do something with handle';
side run()';
local $dbh->{Active} = 0;
$conn->run(sub {
my $dbha = shift;
isnt $dbha, $dbh, 'Nested should get the same when inactive';
is $_, $dbha, 'Should have dbh i
om dbh()';
is $ping, 2, 'ping should not have been called again';
$dbh->{Active} = 0;
isnt $conn->dbh, $dbh, 'Should get different dbh if after disconnect';
}), 'Do something with stored h
)';
local $dbh->{Active} = 0;
$conn->run( ping => sub {
my $dbha = shift;
isnt $dbha, $dbh, 'Nested should get the same when inactive';
is $_, $dbha, 'Should have dbh i
_txn, 'in_txn() should know about it';
local $dbh->{Active} = 0;
$conn->txn(sub {
isnt shift, $dbh, 'Nested txn should not get inactive dbh';
ok !$dbh->{AutoCommit}, 'Nested tx
n, 'in_txn() should know it';
local $dbh->{Active} = 0;
$conn->txn( ping => sub {
isnt shift, $dbh, 'Nested txn_ping_run should not get inactive dbh';
ok !$dbh->{AutoCommit}, '
g = "$CLASS\::Pg"->new( 'Pg' ), 'Get a Pg driver';
isa_ok $pg, "$CLASS\::Pg";
isa_ok $pg, $CLASS;
isnt $pg, $dr, 'It should be a different object';
is "$CLASS\::Pg"->new('Pg'), $pg, 'But it should be