X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=install%2F5.005%2FDBD-Pg-1.22-fixvercmp%2Ft%2F03bind.t;fp=install%2F5.005%2FDBD-Pg-1.22-fixvercmp%2Ft%2F03bind.t;h=df7c8843e9c56753e658364edc40882dd7535ad1;hp=0000000000000000000000000000000000000000;hb=ee146c3eada3bdb419ba471dd6df5e889d7dd7e5;hpb=c29fa7acc16efcc86af06077e739fca8b783c3c1 diff --git a/install/5.005/DBD-Pg-1.22-fixvercmp/t/03bind.t b/install/5.005/DBD-Pg-1.22-fixvercmp/t/03bind.t new file mode 100644 index 000000000..df7c8843e --- /dev/null +++ b/install/5.005/DBD-Pg-1.22-fixvercmp/t/03bind.t @@ -0,0 +1,85 @@ +use strict; +use DBI; +use Test::More; + +if (defined $ENV{DBI_DSN}) { + plan tests => 11; +} else { + plan skip_all => 'cannot test without DB info'; +} + +my $dbh = DBI->connect($ENV{DBI_DSN}, $ENV{DBI_USER}, $ENV{DBI_PASS}, + {RaiseError => 1, AutoCommit => 0} + ); +ok(defined $dbh, + 'connect with transaction' + ); + +my $sql = <prepare($sql); +ok(defined $sth, + "prepare: $sql" + ); + +ok($sth->bind_param(1, 'foo'), + 'bind int column with string' + ); + +ok($sth->bind_param(1, 1), + 'rebind int column with int' + ); + +$sql = <prepare($sql); +ok(defined $sth, + "prepare: $sql" + ); + +ok($sth->bind_param(1, 'foo'), + 'bind int column with string', + ); +ok($sth->bind_param(2, 'bar'), + 'bind string column with text' + ); +ok($sth->bind_param(2, 'baz'), + 'rebind string column with text' + ); + +ok($sth->finish(), + 'finish' + ); + +# Make sure that we get warnings when we try to use SQL_BINARY. +{ + local $SIG{__WARN__} = + sub { ok($_[0] =~ /^Use of SQL type SQL_BINARY/, + 'warning with SQL_BINARY' + ); + }; + + $sql = <prepare($sql); + + $sth->bind_param(1, 'foo', DBI::SQL_BINARY); +} + +ok($dbh->disconnect(), + 'disconnect' + );