1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 09:34:10 +02:00

MongoDB: Fix parsing WHERE condition from SQL query

Thanks to herobank110 (https://github.com/vrana/adminer/pull/491)
This commit is contained in:
Peter Knut
2024-11-10 00:55:46 +01:00
committed by Jakub Vrana
parent 5492b3e055
commit 99434644ef

View File

@@ -480,7 +480,11 @@ if (isset($_GET["mongo"])) {
}
function sql_query_where_parser($queryWhere) {
$queryWhere = preg_replace('~^\sWHERE \(?\(?(.+?)\)?\)?$~', '\1', $queryWhere);
$queryWhere = preg_replace('~^\s*WHERE\s*~', "", $queryWhere);
while ($queryWhere[0] == "(") {
$queryWhere = preg_replace('~^\((.*)\)$~', "$1", $queryWhere);
}
$wheres = explode(' AND ', $queryWhere);
$wheresOr = explode(') OR (', $queryWhere);
$where = array();