From ec81ab8513a405494aa320eebd319783371f660e Mon Sep 17 00:00:00 2001 From: Adam Kennedy Date: Fri, 3 Apr 2009 20:28:01 +0000 Subject: [PATCH] Removing the use of DBI_AUTOPROXY --- t/12_unicode.t | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/t/12_unicode.t b/t/12_unicode.t index ba49e65..ddd03eb 100644 --- a/t/12_unicode.t +++ b/t/12_unicode.t @@ -100,8 +100,7 @@ sub database_roundtrip { @row; } -my ($textback, $bytesback) = - database_roundtrip($bytestring, $bytestring); +my ($textback, $bytesback) = database_roundtrip($bytestring, $bytestring); Test(! is_utf8($bytesback), "Reading blob gives binary"); Test(! is_utf8($textback), "Reading text gives binary too (for now)"); @@ -109,35 +108,22 @@ Test($bytesback eq $bytestring, "No blob corruption"); Test($textback eq $bytestring, "Same text, different encoding"); # Start over but now activate Unicode support. +$dbh->{unicode} = 1; -if ( $ENV{DBI_AUTOPROXY} ) { - # for testing DBD::Gofer we have to create a new dbh with unicode enabled - # because we can't change the attribute for an existing dbh - $dbh = DBI->connect('DBI:SQLite:dbname=foo', '', '', { - RaiseError => 1, - unicode => 1, - }) -} -else { - $dbh->{unicode} = 1; -} - -($textback, $bytesback) = - database_roundtrip($utfstring, $bytestring); +($textback, $bytesback) = database_roundtrip($utfstring, $bytestring); Test(! is_utf8($bytesback), "Reading blob still gives binary"); Test(is_utf8($textback), "Reading text returns UTF-8"); Test($bytesback eq $bytestring, "Still no blob corruption"); Test($textback eq $utfstring, "Same text"); -my $lengths = $dbh->selectall_arrayref - ("SELECT length(a), length(b) FROM $table"); +my $lengths = $dbh->selectall_arrayref( + "SELECT length(a), length(b) FROM $table" +); Test($lengths->[0]->[0] == $lengths->[0]->[1], "Database actually understands char set") or warn "($lengths->[0]->[0] != $lengths->[0]->[1])"; -END { - $dbh->do("DROP TABLE $table"); - $dbh->disconnect; -} +$dbh->do("DROP TABLE $table"); +$dbh->disconnect;