Fix for 1038276: ChangeHandler doesn't quote varchar columns with hex-looking values

This commit is contained in:
Brian Fraser
2012-08-22 16:19:43 -03:00
parent 1481494ef1
commit e52ca00348
4 changed files with 65 additions and 10 deletions

View File

@@ -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;