mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 07:30:02 +00:00
DSNParser clobbered sql_mode variable set by user - lp1506748
This commit is contained in:
@@ -332,17 +332,6 @@ sub get_dbh {
|
||||
if ( $cxn_string =~ m/mysql/i ) {
|
||||
my $sql;
|
||||
|
||||
# Set SQL_MODE and options for SHOW CREATE TABLE.
|
||||
# Get current, server SQL mode. Don't clobber this;
|
||||
# append our SQL mode to whatever is already set.
|
||||
# http://code.google.com/p/maatkit/issues/detail?id=801
|
||||
$sql = 'SELECT @@SQL_MODE';
|
||||
PTDEBUG && _d($dbh, $sql);
|
||||
my ($sql_mode) = eval { $dbh->selectrow_array($sql) };
|
||||
if ( $EVAL_ERROR ) {
|
||||
die "Error getting the current SQL_MODE: $EVAL_ERROR";
|
||||
}
|
||||
|
||||
# Set character set and binmode on STDOUT.
|
||||
if ( my ($charset) = $cxn_string =~ m/charset=([\w]+)/ ) {
|
||||
$sql = qq{/*!40101 SET NAMES "$charset"*/};
|
||||
@@ -365,6 +354,17 @@ sub get_dbh {
|
||||
$self->set_vars($dbh, $vars);
|
||||
}
|
||||
|
||||
# Set SQL_MODE and options for SHOW CREATE TABLE.
|
||||
# Get current, server SQL mode. Don't clobber this;
|
||||
# append our SQL mode to whatever is already set.
|
||||
# http://code.google.com/p/maatkit/issues/detail?id=801
|
||||
$sql = 'SELECT @@SQL_MODE';
|
||||
PTDEBUG && _d($dbh, $sql);
|
||||
my ($sql_mode) = eval { $dbh->selectrow_array($sql) };
|
||||
if ( $EVAL_ERROR ) {
|
||||
die "Error getting the current SQL_MODE: $EVAL_ERROR";
|
||||
}
|
||||
|
||||
# Do this after set-vars so a user-set sql_mode doesn't clobber it; See
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1078887
|
||||
$sql = 'SET @@SQL_QUOTE_SHOW_CREATE = 1'
|
||||
|
Reference in New Issue
Block a user