Allow limiting number of displayed rows in SQL command (bug #406)
This commit is contained in:
parent
f839d5ac25
commit
25329cebf3
|
@ -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 <code>
|
||||
$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 "<table cellspacing='0' class='nowrap'>\n";
|
||||
echo "<thead><tr>";
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<?php
|
||||
$VERSION = "4.1.1-dev";
|
||||
$VERSION = "4.2.0-dev";
|
||||
|
|
|
@ -235,11 +235,13 @@ $translations = array(
|
|||
'Sort' => '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í',
|
||||
|
|
|
@ -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.'),
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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 "<form action='' method='post'>\n";
|
||||
echo "<p>" . ($result->num_rows ? lang('%d row(s)', $result->num_rows) : "") . $time;
|
||||
$num_rows = $result->num_rows;
|
||||
echo "<p>" . ($num_rows ? ($limit && $num_rows > $limit ? lang('%d / ', $limit) : "") . lang('%d row(s)', $num_rows) : "");
|
||||
echo $time;
|
||||
$id = "export-$commands";
|
||||
$export = ", <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('Export') . "</a><span id='$id' class='hidden'>: "
|
||||
. html_select("output", $adminer->dumpOutput(), $adminer_export["output"]) . " "
|
||||
|
@ -199,6 +202,7 @@ if (!isset($_GET["import"])) {
|
|||
textarea("query", $q, 20);
|
||||
echo ($_POST ? "" : "<script type='text/javascript'>focus(document.getElementsByTagName('textarea')[0]);</script>\n");
|
||||
echo "<p>$execute\n";
|
||||
echo lang('Limit rows') . ": <input type='number' name='limit' class='size' value='" . h($_POST ? $_POST["limit"] : $_GET["limit"]) . "'>\n";
|
||||
|
||||
} else {
|
||||
echo "<fieldset><legend>" . lang('File upload') . "</legend><div>";
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue