svnno****@sourc*****
svnno****@sourc*****
2008年 11月 26日 (水) 19:45:14 JST
Revision: 848 http://svn.sourceforge.jp/view?root=slashdotjp&view=rev&rev=848 Author: tach Date: 2008-11-26 19:45:14 +0900 (Wed, 26 Nov 2008) Log Message: ----------- modify utf8 flag for sql request/responce Modified Paths: -------------- slashjp/trunk/Slash/DB/Utility/Utility.pm -------------- next part -------------- Modified: slashjp/trunk/Slash/DB/Utility/Utility.pm =================================================================== --- slashjp/trunk/Slash/DB/Utility/Utility.pm 2008-11-26 10:03:02 UTC (rev 847) +++ slashjp/trunk/Slash/DB/Utility/Utility.pm 2008-11-26 10:45:14 UTC (rev 848) @@ -9,6 +9,7 @@ use Slash::Utility; use DBIx::Password; use Time::HiRes; +use Encode; our $VERSION = $Slash::Constants::VERSION; @@ -296,6 +297,7 @@ } } $self->{_dbh}{PrintError} = 0; #"off" this kills the issue of bad SQL sending errors to the client + $self->{_dbh}->{mysql_enable_utf8} = 1; return 1; # We return true that the sqlConnect was ok. } @@ -1088,6 +1090,7 @@ my($self, $sql) = @_; $self->_refCheck($sql); $self->sqlConnect() or return undef; + Encode::is_utf8($sql) or $sql = decode_utf8($sql); my $rows = $self->{_dbh}->do($sql); unless ($rows) { unless ($sql =~ /^INSERT\s+IGNORE\b/i) {