use strict;
BEGIN {
$| = 1;
$^W = 1;
}
use Test::More tests => 9;
use t::lib::Test;
my $create1 = 'CREATE TABLE table1 (id INTEGER NOT NULL, name CHAR (64) NOT NULL)';
my $create2 = 'CREATE TABLE table2 (id INTEGER NOT NULL, name CHAR (64) NOT NULL)';
my $drop1 = 'DROP TABLE table1';
my $drop2 = 'DROP TABLE table2';
SCOPE: {
my $dbh = connect_ok( dbfile => 'foo' );
ok( $dbh->do($create1), $create1 );
ok( $dbh->do($create2), $create2 );
ok( $dbh->disconnect, '->disconnect ok' );
}
my $pid;
if ( not defined( $pid = fork() ) ) {
die("fork: $!");
} elsif ( $pid == 0 ) {
sleep(2);
my $dbh = DBI->connect(
'dbi:SQLite:dbname=foo', '', ''
) or die 'connect failed';
$dbh->do($drop2) or die "DROP ok";
$dbh->disconnect or die "disconnect ok";
exit(0);
}
SCOPE: {
my $dbh = connect_ok( dbfile => 'foo' );
ok( waitpid($pid, 0) != -1, "waitpid" );
ok( $dbh->do($drop1), $drop1 ) or diag("Error: '$DBI::errstr'");
ok( $dbh->do($create2), $create2 ) or diag("Error: '$DBI::errstr'");
ok( $dbh->disconnect, '->disconnect ok' );
}