X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=install%2F5.005%2FDBD-Pg-1.22-fixvercmp%2Ft%2F05fetch.t;fp=install%2F5.005%2FDBD-Pg-1.22-fixvercmp%2Ft%2F05fetch.t;h=0000000000000000000000000000000000000000;hp=b6f8f66d00e153b25595f84a00a51b592c7b464d;hb=3a9c534d55e1736545ef8037e1391101c7a11f2b;hpb=7a67b0df697c1aa35e148bd5b2f1f765bf1969f6 diff --git a/install/5.005/DBD-Pg-1.22-fixvercmp/t/05fetch.t b/install/5.005/DBD-Pg-1.22-fixvercmp/t/05fetch.t deleted file mode 100644 index b6f8f66d0..000000000 --- a/install/5.005/DBD-Pg-1.22-fixvercmp/t/05fetch.t +++ /dev/null @@ -1,131 +0,0 @@ -use strict; -use DBI; -use Test::More; - -if (defined $ENV{DBI_DSN}) { - plan tests => 10; -} 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' - ); - -$dbh->do(q{INSERT INTO test (id, name, val) VALUES (1, 'foo', 'horse')}); -$dbh->do(q{INSERT INTO test (id, name, val) VALUES (2, 'bar', 'chicken')}); -$dbh->do(q{INSERT INTO test (id, name, val) VALUES (3, 'baz', 'pig')}); -ok($dbh->commit(), - 'commit' - ); - -my $sql = <prepare($sql); -$sth->execute(); - -my $rows = 0; -while (my ($id, $name) = $sth->fetchrow_array()) { - if (defined($id) && defined($name)) { - $rows++; - } -} -$sth->finish(); -ok($rows == 3, - 'fetch three rows' - ); - -$sql = <prepare($sql); -$sth->execute(); - -$rows = 0; -while (my ($id, $name) = $sth->fetchrow_array()) { - $rows++; -} -$sth->finish(); - -ok($rows == 0, - 'fetch zero rows' - ); - -$sql = <prepare($sql); -$sth->execute(1); - -$rows = 0; -while (my ($id, $name) = $sth->fetchrow_array()) { - if (defined($id) && defined($name)) { - $rows++; - } -} -$sth->finish(); - -ok($rows == 1, - 'fetch one row on id' - ); - -# Attempt to test whether or not we can get unicode out of the database -# correctly. Reuse the previous sth. -SKIP: { - eval "use Encode"; - skip "need Encode module for unicode tests", 3 if $@; - local $dbh->{pg_enable_utf8} = 1; - $dbh->do("INSERT INTO test (id, name, val) VALUES (4, '\001\000dam', 'cow')"); - $sth->execute(4); - my ($id, $name) = $sth->fetchrow_array(); - ok(Encode::is_utf8($name), - 'returned data has utf8 bit set' - ); - is(length($name), 4, - 'returned utf8 data is not corrupted' - ); - $sth->finish(); - $sth->execute(1); - my ($id2, $name2) = $sth->fetchrow_array(); - ok(! Encode::is_utf8($name2), - 'returned ASCII data has not got utf8 bit set' - ); - $sth->finish(); -} - -$sql = <prepare($sql); -$sth->execute('foo'); - -$rows = 0; -while (my ($id, $name) = $sth->fetchrow_array()) { - if (defined($id) && defined($name)) { - $rows++; - } -} -$sth->finish(); - -ok($rows == 1, - 'fetch one row on name' - ); - -ok($dbh->disconnect(), - 'disconnect' - );