mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-19 01:09:21 +08:00
Fix QueryParser and QueryRewriter to handle LOAD DATA and INSERT/REPLACE without INTO.
This commit is contained in:
@@ -98,7 +98,7 @@ sub get_tables {
|
||||
|
||||
# These keywords may appear between UPDATE or SELECT and the table refs.
|
||||
# They need to be removed so that they are not mistaken for tables.
|
||||
$query =~ s/ (?:LOW_PRIORITY|IGNORE|STRAIGHT_JOIN)//ig;
|
||||
$query =~ s/ (?:LOW_PRIORITY|IGNORE|STRAIGHT_JOIN|DELAYED) / /ig;
|
||||
|
||||
# Another special case: LOCK TABLES tbl [[AS] alias] READ|WRITE, etc.
|
||||
# We strip the LOCK TABLES stuff and append "FROM" to fake a SELECT
|
||||
@@ -110,9 +110,16 @@ sub get_tables {
|
||||
$query = "FROM $query";
|
||||
}
|
||||
|
||||
$query =~ s/\\["']//g; # quoted strings
|
||||
$query =~ s/".*?"/?/sg; # quoted strings
|
||||
$query =~ s/'.*?'/?/sg; # quoted strings
|
||||
$query =~ s/\\["']//g; # quoted strings
|
||||
$query =~ s/".*?"/?/sg; # quoted strings
|
||||
$query =~ s/'.*?'/?/sg; # quoted strings
|
||||
|
||||
# INSERT and REPLACE without INTO
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/984053
|
||||
if ( $query =~ m/\A\s*(?:INSERT|REPLACE)\s+(?!INTO)/i ) {
|
||||
# Add INTO so the reset of the code work as usual.
|
||||
$query =~ s/\A\s*((?:INSERT|REPLACE))\s+/$1 INTO /i;
|
||||
}
|
||||
|
||||
my @tables;
|
||||
foreach my $tbls ( $query =~ m/$tbl_regex/gio ) {
|
||||
|
||||
Reference in New Issue
Block a user