File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -305,7 +305,12 @@ public static function get(
305305
306306 $ query = 'SELECT * FROM ' . Util::backquote ($ bookmarkFeature ->database )
307307 . '. ' . Util::backquote ($ bookmarkFeature ->bookmark )
308- . " WHERE dbase = ' " . $ dbi ->escapeString ($ db ) . "' " ;
308+ . ' WHERE ' . Util::backquote ($ id_field )
309+ . " = ' " . $ dbi ->escapeString ((string ) $ id ) . "' " ;
310+ if ($ db !== '' ) {
311+ $ query .= " AND dbase = ' " . $ dbi ->escapeString ($ db ) . "' " ;
312+ }
313+
309314 if (! $ action_bookmark_all ) {
310315 $ query .= " AND (user = ' "
311316 . $ dbi ->escapeString ($ user ) . "' " ;
@@ -316,8 +321,7 @@ public static function get(
316321 $ query .= ') ' ;
317322 }
318323
319- $ query .= ' AND ' . Util::backquote ($ id_field )
320- . " = ' " . $ dbi ->escapeString ((string ) $ id ) . "' LIMIT 1 " ;
324+ $ query .= ' LIMIT 1 ' ;
321325
322326 $ result = $ dbi ->fetchSingleRow ($ query , DatabaseInterface::FETCH_ASSOC , DatabaseInterface::CONNECT_CONTROL );
323327 if (! empty ($ result )) {
Original file line number Diff line number Diff line change @@ -2495,8 +2495,8 @@ private function init(): void
24952495 'result ' => [],
24962496 ],
24972497 [
2498- 'query ' => 'SELECT * FROM `information_schema`.`bookmark` WHERE dbase = \'my_db \''
2499- . ' AND (user = \'user \' ) AND `label` = \'test_tbl \' LIMIT 1 ' ,
2498+ 'query ' => 'SELECT * FROM `information_schema`.`bookmark` WHERE `label` = \'test_tbl \''
2499+ . ' AND dbase = \'my_db \' AND (user = \'user \' ) LIMIT 1 ' ,
25002500 'result ' => [],
25012501 ],
25022502 [
You can’t perform that action at this time.
0 commit comments