Commit 74ed13b8 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic

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

behatnotneeded

Change-Id: I05de5b5d93ab4627a44b0a91d2ebb96ca0d2356e
parent b0c2c1bf
......@@ -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