mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-21 11:30:24 +00:00
Update all modules that use Quoter
This commit is contained in:
@@ -1540,10 +1540,16 @@ sub serialize_list {
|
||||
|
||||
return $args[0] if @args == 1 && !defined $args[0];
|
||||
|
||||
die "Cannot serialize multiple values with undef/NULL"
|
||||
if grep { !defined $_ } @args;
|
||||
|
||||
return join ',', map { quotemeta } @args;
|
||||
return join ',', map {
|
||||
my $c = $_;
|
||||
if ( defined($c) ) {
|
||||
$c =~ s/([^A-Za-z0-9])/\\$1/g;
|
||||
$c
|
||||
}
|
||||
else {
|
||||
'\\N'
|
||||
}
|
||||
} @args;
|
||||
}
|
||||
|
||||
sub deserialize_list {
|
||||
@@ -1565,14 +1571,15 @@ sub deserialize_list {
|
||||
|
||||
my @unescaped_parts = map {
|
||||
my $part = $_;
|
||||
|
||||
my $char_class = utf8::is_utf8($part) # If it's a UTF-8 string,
|
||||
? qr/(?=\p{ASCII})\W/ # We only care about non-word
|
||||
: qr/(?=\p{ASCII})\W|[\x{80}-\x{FF}]/; # Otherwise,
|
||||
$part =~ s/\\($char_class)/$1/g;
|
||||
$part;
|
||||
if ($part eq '\\N') {
|
||||
undef
|
||||
}
|
||||
else {
|
||||
$part =~ s/\\([^A-Za-z0-9])/$1/g;
|
||||
$part;
|
||||
}
|
||||
} @escaped_parts;
|
||||
|
||||
|
||||
return @unescaped_parts;
|
||||
}
|
||||
|
||||
@@ -1727,14 +1734,25 @@ sub parse_event {
|
||||
|
||||
if ( !$found_arg && $pos == $len ) {
|
||||
PTDEBUG && _d("Did not find arg, looking for special cases");
|
||||
local $INPUT_RECORD_SEPARATOR = ";\n";
|
||||
local $INPUT_RECORD_SEPARATOR = ";\n"; # get next line
|
||||
if ( defined(my $l = $next_event->()) ) {
|
||||
chomp $l;
|
||||
$l =~ s/^\s+//;
|
||||
PTDEBUG && _d("Found admin statement", $l);
|
||||
push @properties, 'cmd', 'Admin', 'arg', $l;
|
||||
push @properties, 'bytes', length($properties[-1]);
|
||||
$found_arg++;
|
||||
if ( $l =~ /^\s*[A-Z][a-z_]+: / ) {
|
||||
PTDEBUG && _d("Found NULL query before", $l);
|
||||
local $INPUT_RECORD_SEPARATOR = ";\n#";
|
||||
my $rest_of_event = $next_event->();
|
||||
push @{$self->{pending}}, $l . $rest_of_event;
|
||||
push @properties, 'cmd', 'Query', 'arg', '/* No query */';
|
||||
push @properties, 'bytes', 0;
|
||||
$found_arg++;
|
||||
}
|
||||
else {
|
||||
chomp $l;
|
||||
$l =~ s/^\s+//;
|
||||
PTDEBUG && _d("Found admin statement", $l);
|
||||
push @properties, 'cmd', 'Admin', 'arg', $l;
|
||||
push @properties, 'bytes', length($properties[-1]);
|
||||
$found_arg++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
PTDEBUG && _d("I can't figure out what to do with this line");
|
||||
@@ -1890,7 +1908,8 @@ sub parse_event {
|
||||
$cmd = $arg;
|
||||
}
|
||||
else {
|
||||
my ($user, undef, $db) = $arg =~ /(\S+)/g;
|
||||
my ($user) = $arg =~ m/(\S+)/;
|
||||
my ($db) = $arg =~ m/on (\S+)/;
|
||||
my $host;
|
||||
($user, $host) = split(/@/, $user);
|
||||
PTDEBUG && _d('Connect', $user, '@', $host, 'on', $db);
|
||||
|
Reference in New Issue
Block a user