1use strict;
2use warnings;
3
4use Test::More;
5use DBI;
6use lib 't', '.';
7require 'lib.pl';
8
9use Test::More;
10
11$| = 1;
12
13use vars qw($test_dsn $test_user $test_password);
14
15my $dbh;
16eval {$dbh = DBI->connect($test_dsn, $test_user, $test_password,
17  { RaiseError => 1, AutoCommit => 1})};
18
19if ($@) {
20  plan skip_all => "no database connection";
21}
22
23my $drh    = $dbh->{Driver};
24if (! defined $drh) {
25    plan skip_all => "Can't obtain driver handle. Can't continue test";
26}
27
28plan tests => 10;
29
30pass("Connected to database");
31pass("Obtained driver handle");
32
33my $connection_id1 = connection_id($dbh);
34
35is $drh->{Kids},       1, "1 kid";
36is $drh->{ActiveKids}, 1, "1 active kid";
37
38my $imp_data = $dbh->take_imp_data;
39is $drh->{Kids},       0, "no kids";
40is $drh->{ActiveKids}, 0, "no active kids";
41$dbh = DBI->connect( $test_dsn, $test_user, $test_password,
42      { dbi_imp_data => $imp_data } );
43my $connection_id2 = connection_id($dbh);
44is $connection_id1, $connection_id2, "got same session";
45
46is $drh->{Kids},       1, "1 kid";
47is $drh->{ActiveKids}, 1, "1 active kid";
48
49ok $dbh->disconnect, "Disconnect OK";
50