8db819ee9a3cd7576178822c47374f8a62bc0029
[freeside.git] / install / 5.005 / DBD-Pg-1.22-fixvercmp / t / 13pgtype.t
1 use strict;
2 use DBI;
3 use Test::More;
4
5 if (defined $ENV{DBI_DSN}) {
6   plan tests => 3;
7 } else {
8   plan skip_all => 'cannot test without DB info';
9 }
10
11 my $dbh = DBI->connect($ENV{DBI_DSN}, $ENV{DBI_USER}, $ENV{DBI_PASS},
12                        {RaiseError => 1, AutoCommit => 0}
13                       );
14 ok(defined $dbh,
15    'connect with transaction'
16   );
17
18 eval {
19   local $dbh->{PrintError} = 0;
20   $dbh->do(q{DROP TABLE tt});
21   $dbh->commit();
22 };
23 $dbh->rollback();
24
25 $dbh->do(q{CREATE TABLE tt (blah numeric(5,2), foo text)});
26 my $sth = $dbh->prepare(qq{
27                            SELECT * FROM tt WHERE FALSE
28                           });
29 $sth->execute();
30
31 my @types = @{$sth->{pg_type}};
32
33 ok($types[0] eq 'numeric',
34    'type numeric'
35   );
36
37 ok($types[1] eq 'text',
38    'type text'
39   );
40
41 $sth->finish();
42 $dbh->rollback();
43 $dbh->disconnect();