1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 01:24:17 +02:00

Allow limiting number of displayed rows in SQL command (bug #406)

This commit is contained in:
Jakub Vrana
2014-12-06 11:11:34 -08:00
parent f839d5ac25
commit 25329cebf3
7 changed files with 17 additions and 6 deletions

View File

@@ -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>";