Commit 47aebfed authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1850210: sql error: importing leap2A when using elasticsearch index"

parents 3d1ce239 74ed13b8
......@@ -1086,6 +1086,13 @@ function get_table_from_query($sql) {
$idsql = null; // no existing rows being updated
$type = 'insert';
}
else if (preg_match('/^UPDATE\s(.*?)\sSET\s(.*?)WHERE\s(.*)/i', $sql, $matches)) {
$table = trim($matches[1], '"');
$binds = $matches[2];
$bindoffset = preg_match_all('/(?<!\\\)\?/', $binds);
$idsql = 'SELECT * FROM ' . $matches[1] . ' WHERE ' . $matches[3];
$type = 'update';
}
else if (preg_match('/^UPDATE\s(.*?)\s.*?IN\s*\(\s*(SELECT.*)\s*\)/i', $sql, $matches)) {
$table = trim($matches[1], '"');
$idsql = $matches[2];
......@@ -1096,13 +1103,6 @@ function get_table_from_query($sql) {
$idsql = 'SELECT * FROM ' . $matches[2];
$type = 'update';
}
else if (preg_match('/^UPDATE\s(.*?)\sSET\s(.*?)WHERE\s(.*)/i', $sql, $matches)) {
$table = trim($matches[1], '"');
$binds = $matches[2];
$bindoffset = preg_match_all('/(?<!\\\)\?/', $binds);
$idsql = 'SELECT * FROM ' . $matches[1] . ' WHERE ' . $matches[3];
$type = 'update';
}
return array($type, $table, $idsql, $bindoffset);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment