]> git.joonet.de Git - adminer.git/commitdiff
MongoDB: Fix edit operations in select
authorJakub Vrana <jakub@vrana.cz>
Tue, 9 Feb 2021 19:36:23 +0000 (20:36 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 9 Feb 2021 19:36:23 +0000 (20:36 +0100)
adminer/drivers/mongo.inc.php

index 0508c0c58af2f964f335a43e0fb01225069b9751..d0b4bea34d577f2340a6c9ba87401bc13bd83596 100644 (file)
@@ -177,6 +177,7 @@ if (isset($_GET["mongo"])) {
                                $class = 'MongoDB\Driver\BulkWrite';
                                $bulk = new $class(array());
                                $bulk->delete($where, array('limit' => $limit));
+                               var_dump($where);
                                return $connection->executeBulkWrite("$db.$table", $bulk, 'getDeletedCount');
                        }
 
@@ -277,8 +278,7 @@ if (isset($_GET["mongo"])) {
                }
 
                function sql_query_where_parser($queryWhere) {
-                       $queryWhere = trim(preg_replace('/WHERE[\s]?[(]?\(?/', '', $queryWhere));
-                       $queryWhere = preg_replace('/\)\)\)$/', ')', $queryWhere);
+                       $queryWhere = preg_replace('~^\sWHERE \(?\(?(.+?)\)?\)?$~', '\1', $queryWhere);
                        $wheres = explode(' AND ', $queryWhere);
                        $wheresOr = explode(') OR (', $queryWhere);
                        $where = array();