diff --git a/changes.txt b/changes.txt index e8e71653..b9806ef1 100644 --- a/changes.txt +++ b/changes.txt @@ -1,6 +1,7 @@ Adminer 2.2.1-dev: Improve concurrency Move number of tables to DB info (performance) +Search by foreign keys (Editor) Link new item in backward keys (Editor) Adminer 2.2.0 (released 2009-10-20): diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index 2490b985..24b3cd01 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -1,6 +1,7 @@ ="); + var $values = array(); function name() { return lang('Editor'); @@ -124,10 +125,12 @@ ORDER BY ORDINAL_POSITION"); $ids[$row[$key]] = exact_value($row[$key]); } // uses constant number of queries to get the descriptions, join would be complex, multiple queries would be slow - $descriptions = array(); - $result = $connection->query("SELECT $id, $name FROM " . idf_escape($foreignKey["table"]) . " WHERE $id IN (" . implode(", ", $ids) . ")"); - while ($row = $result->fetch_row()) { - $descriptions[$row[0]] = $row[1]; + $descriptions = $this->values[$foreignKey["table"]]; + if (!$descriptions) { + $result = $connection->query("SELECT $id, $name FROM " . idf_escape($foreignKey["table"]) . " WHERE $id IN (" . implode(", ", $ids) . ")"); + while ($row = $result->fetch_row()) { + $descriptions[$row[0]] = $row[1]; + } } // use the descriptions foreach ($rows as $n => $row) { @@ -177,6 +180,23 @@ ORDER BY ORDINAL_POSITION"); function selectSearchPrint($where, $columns, $indexes) { //! foreign keys echo '