]> git.joonet.de Git - adminer.git/commitdiff
Improve limit check in edit-foreign plugin
authorJiří Barouš <Amunak@users.noreply.github.com>
Tue, 26 Apr 2016 10:31:40 +0000 (12:31 +0200)
committerJakub Vrana <jakub@vrana.cz>
Sat, 18 Feb 2017 17:32:32 +0000 (18:32 +0100)
The limit is enforced in the query to prevent out-of-memory errors for big target tables.

plugins/edit-foreign.php

index 0bb825a2efb29f028edfa1e4eec40b4225fa0f39..0b5227c69b50e138d69614d119147326068e1b65 100644 (file)
@@ -30,7 +30,7 @@ class AdminerEditForeign {
                                        if (preg_match('~binary~', $field["type"])) {
                                                $column = "HEX($column)";
                                        }
-                                       $options = array("" => "") + get_vals("SELECT $column FROM " . table($target) . " ORDER BY 1");
+                                       $options = array("" => "") + get_vals("SELECT $column FROM " . table($target) . " ORDER BY 1" . ($this->_limit ? " LIMIT " . ($this->_limit + 1) : ""));
                                        if ($this->_limit && count($options) - 1 > $this->_limit) {
                                                return;
                                        }