diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index e46ba47d..dc5efabb 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -3,9 +3,10 @@ * @param Min_Result * @param Min_DB connection to examine indexes * @param array +* @param int * @return array $orgtables */ -function select($result, $connection2 = null, $orgtables = array()) { +function select($result, $connection2 = null, $orgtables = array(), $limit = 0) { global $jush; $links = array(); // colno => orgtable - create links from these columns $indexes = array(); // orgtable => array(column => colno) - primary keys @@ -14,7 +15,7 @@ function select($result, $connection2 = null, $orgtables = array()) { $types = array(); // colno => type - display char in $return = array(); // table => orgtable - mapping to use in EXPLAIN odd(''); // reset odd for each result - for ($i=0; $row = $result->fetch_row(); $i++) { + for ($i=0; (!$limit || $i < $limit) && ($row = $result->fetch_row()); $i++) { if (!$i) { echo "\n"; echo ""; diff --git a/adminer/include/version.inc.php b/adminer/include/version.inc.php index 730f98c6..ba564aa7 100644 --- a/adminer/include/version.inc.php +++ b/adminer/include/version.inc.php @@ -1,2 +1,2 @@ 'Seřadit', 'descending' => 'sestupně', 'Limit' => 'Limit', + 'Limit rows' => 'Limit řádek', 'Text length' => 'Délka textů', 'Action' => 'Akce', 'Full table scan' => 'Průchod celé tabulky', 'Unable to select the table' => 'Nepodařilo se vypsat tabulku', 'No rows.' => 'Žádné řádky.', + '%d / ' => '%d / ', '%d row(s)' => array('%d řádek', '%d řádky', '%d řádků'), 'Page' => 'Stránka', 'last' => 'poslední', diff --git a/adminer/lang/en.inc.php b/adminer/lang/en.inc.php index 52559f98..b4b3b57b 100644 --- a/adminer/lang/en.inc.php +++ b/adminer/lang/en.inc.php @@ -5,6 +5,7 @@ $translations = array( '%d byte(s)' => array('%d byte', '%d bytes'), 'Routine has been called, %d row(s) affected.' => array('Routine has been called, %d row affected.', 'Routine has been called, %d rows affected.'), '%d process(es) have been killed.' => array('%d process has been killed.', '%d processes have been killed.'), + '%d / ' => '%d / ', '%d row(s)' => array('%d row', '%d rows'), '%d item(s) have been affected.' => array('%d item has been affected.', '%d items have been affected.'), '%d row(s) have been imported.' => array('%d row has been imported.', '%d rows have been imported.'), diff --git a/adminer/lang/xx.inc.php b/adminer/lang/xx.inc.php index 5e5c15f7..fa3896b2 100644 --- a/adminer/lang/xx.inc.php +++ b/adminer/lang/xx.inc.php @@ -234,11 +234,13 @@ $translations = array( 'Sort' => 'xx', 'descending' => 'xx', 'Limit' => 'xx', + 'Limit rows' => 'xx', 'Text length' => 'xx', 'Action' => 'xx', 'Full table scan' => 'xx', 'Unable to select the table' => 'xx', 'No rows.' => 'xx', + '%d / ' => 'xx', '%d row(s)' => array('xx', 'xx'), 'Page' => 'xx', 'last' => 'xx', diff --git a/adminer/sql.inc.php b/adminer/sql.inc.php index 7f2e4695..d1835f87 100644 --- a/adminer/sql.inc.php +++ b/adminer/sql.inc.php @@ -121,10 +121,13 @@ if (!$error && $_POST) { } } elseif (is_object($result)) { - $orgtables = select($result, $connection2); + $limit = $_POST["limit"]; + $orgtables = select($result, $connection2, array(), $limit); if (!$_POST["only_errors"]) { echo "\n"; - echo "

" . ($result->num_rows ? lang('%d row(s)', $result->num_rows) : "") . $time; + $num_rows = $result->num_rows; + echo "

" . ($num_rows ? ($limit && $num_rows > $limit ? lang('%d / ', $limit) : "") . lang('%d row(s)', $num_rows) : ""); + echo $time; $id = "export-$commands"; $export = ", " . lang('Export') . "

$execute\n"; + echo lang('Limit rows') . ": \n"; } else { echo "

" . lang('File upload') . "
"; diff --git a/changes.txt b/changes.txt index 37ac5e9e..9d3abcea 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,5 @@ -Adminer 4.1.1-dev: +Adminer 4.2.0-dev: +Allow limiting number of displayed rows in SQL command Fix reading routine column collations Unlock session in alter database Make master key unreadable to others (bug #410)