Fix QueryParser and QueryRewriter to handle LOAD DATA and INSERT/REPLACE without INTO.

This commit is contained in:
Daniel Nichter
2013-08-03 11:19:40 -07:00
parent cce1420736
commit a742090177
2 changed files with 19 additions and 4 deletions

View File

@@ -246,6 +246,11 @@ sub distill_verbs {
$query =~ m/\A\s*UNLOCK TABLES/i && return "UNLOCK";
$query =~ m/\A\s*xa\s+(\S+)/i && return "XA_$1";
if ( $query =~ m/\A\s*LOAD/i ) {
my ($tbl) = $query =~ m/INTO TABLE\s+(\S+)/i;
return "LOAD DATA $tbl";
}
if ( $query =~ m/\Aadministrator command:/ ) {
$query =~ s/administrator command:/ADMIN/;
$query = uc $query;
@@ -386,6 +391,9 @@ sub distill {
map { $verbs =~ s/$_/$alias_for{$_}/ } keys %alias_for;
$query = $verbs;
}
elsif ( $verbs && $verbs =~ m/^LOAD DATA/ ) {
return $verbs;
}
else {
# For everything else, distill the tables.
my @tables = $self->__distill_tables($query, $table, %args);