From: Date: June 10 2004 12:26pm Subject: Re: [PATCH] Re: blessing db data as utf8 List-Archive: http://lists.mysql.com/perl/3008 Message-Id: <20040610102604.GL17923@sike.forum2.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Thu, Jun 10, 2004 at 12:07:54PM +0200, Jochen Wiedmann wrote: > > Good patch, in particular because it includes the docs! Thanks. Here's a test script I've been using that may be seriousified and ported into the DBD test suite. I didn't do that last step myself because I was unfamiliar with the idioms. -- Gaal Yahas http://gaal.livejournal.com/ #!/usr/bin/perl -w # make sure utf8 patch is applied to current DBD::mysql use strict; use charnames ':full'; use DBI; my $dbh = DBI->connect("DBI:mysql:database=test", "", "", {mysql_enable_utf8=>1}) or die "dbi: $DBI::errstr"; $dbh->{mysql_enable_utf8} or die "couldn't init mysql_enable_utf8"; # uncomment this for proof this whole feature is necessary #$dbh->{mysql_enable_utf8} = 0; print "Your test WILL fail, you know.\n"; $dbh->do("DROP TABLE IF EXISTS test_u8"); $dbh->do(<prepare("INSERT INTO test_u8 (id, name) values (?, ?)"); $sth->execute(1, $name); my @row = $dbh->selectrow_array("SELECT id, name FROM test_u8;"); die "number didn't stay the same!?!?!!" unless $row[0] == 1; die "sorry, utf8 discipline failed: len != 3" unless length $row[1] == 3; die "sorry, utf8 discipline failed: strcmp" unless $row[1] eq $name; print "yay, you are teh utf king!!!!11\n"; $dbh->do("DROP TABLE test_u8");