Remove warning from DSNParser if using UTF-8 and DBD::mysql < 3.0008 (r508). --version-check can catch this.

This commit is contained in:
Daniel Nichter
2013-02-18 12:44:02 -07:00
parent a07c0c0a6a
commit 97f963c7f7
3 changed files with 37 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
# This program is copyright 2007-2011 Baron Schwartz, 2011 Percona Inc.
# Feedback and improvements are welcome.
# This program is copyright 2007-2011 Baron Schwartz,
# 2011-2013 Percona Ireland Ltd.
#
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
@@ -58,8 +58,7 @@ sub new {
die "I need a $arg argument" unless $args{$arg};
}
my $self = {
opts => {}, # h, P, u, etc. Should come from DSN OPTIONS section in POD.
warn_broken_utf8 => 0,
opts => {} # h, P, u, etc. Should come from DSN OPTIONS section in POD.
};
foreach my $opt ( @{$args{opts}} ) {
if ( !$opt->{key} || !$opt->{desc} ) {
@@ -283,22 +282,6 @@ sub get_dbh {
$defaults->{mysql_local_infile} = 1;
}
# Check for broken DBD::mysql UTF-8.
eval {
require DBD::mysql;
};
if ( !$EVAL_ERROR ) {
if ( $defaults->{mysql_enable_utf8}
&& $DBD::mysql::VERSION lt '3.0008'
&& !$self->{warn_broken_utf8}++ )
{
warn "WARNING: UTF-8 support is enabled but DBD::mysql "
. "v$DBD::mysql::VERSION is installed which does not work "
. "correctly with UTF-8. You should install a newer version "
. "of DBD::mysql, else data will be displayed incorrectly.\n";
}
}
# Only add this if explicitly set because we're not sure if
# mysql_use_result=0 would leave default mysql_store_result
# enabled.