mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-11 02:04:38 +08:00
Fix for 1038276: ChangeHandler doesn't quote varchar columns with hex-looking values
This commit is contained in:
@@ -65,11 +65,12 @@ sub quote {
|
||||
# Returns:
|
||||
# Quoted value
|
||||
sub quote_val {
|
||||
my ( $self, $val ) = @_;
|
||||
my ( $self, $val, %args ) = @_;
|
||||
|
||||
return 'NULL' unless defined $val; # undef = NULL
|
||||
return "''" if $val eq ''; # blank string = ''
|
||||
return $val if $val =~ m/^0x[0-9a-fA-F]+$/; # hex data
|
||||
return $val if $val =~ m/^0x[0-9a-fA-F]+$/ # quote hex data
|
||||
&& !$args{is_char}; # unless is_char is true
|
||||
|
||||
# Quote and return non-numeric vals.
|
||||
$val =~ s/(['\\])/\\$1/g;
|
||||
|
||||
Reference in New Issue
Block a user