From 63441b12f33f52db60791cf89114db4718c64a68 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Wed, 11 Jul 2007 10:22:59 +0000 Subject: [PATCH] Max text length git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@120 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- design.inc.php | 1 - select.inc.php | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/design.inc.php b/design.inc.php index 58463e24..abd34502 100644 --- a/design.inc.php +++ b/design.inc.php @@ -22,7 +22,6 @@ PRE { margin: .12em 0; } TABLE { margin-top: 1em; } .error { color: Red; } .message { color: Green; } -.select TD { max-height: 3em; overflow: auto; } #menu { position: absolute; top: 8px; left: 8px; width: 15em; overflow: auto; white-space: nowrap; } #content { margin-left: 16em; } diff --git a/select.inc.php b/select.inc.php index bfe4b5ef..5503d863 100644 --- a/select.inc.php +++ b/select.inc.php @@ -86,11 +86,27 @@ for (var i=0; > i; i++) { echo '
'; echo "\n"; + $select = array(); + unset($text_length); + foreach ($columns as $column) { + if (preg_match('~text|blob~', $fields[$column]["type"])) { + $text_length = (isset($_GET["text_length"]) ? $_GET["text_length"] : "100"); + $select[] = (intval($text_length) ? "LEFT(" . idf_escape($column) . ", " . intval($text_length) . ") AS " : "") . idf_escape($column); + } else { + $select[] = idf_escape($column); + } + } + if (isset($text_length)) { + echo "
" . lang('Text length') . "\n"; + echo '
'; + echo "
\n"; + } + echo "
" . lang('Action') . "
\n"; echo "\n"; echo "
\n"; - $result = $mysql->query("SELECT SQL_CALC_FOUND_ROWS " . implode(", ", array_map('idf_escape', $columns)) . " FROM " . idf_escape($_GET["select"]) . ($where ? " WHERE " . implode(" AND ", $where) : "") . ($order ? " ORDER BY " . implode(", ", $order) : "") . (strlen($limit) ? " LIMIT " . intval($limit) . " OFFSET " . ($limit * $_GET["page"]) : "")); + $result = $mysql->query("SELECT SQL_CALC_FOUND_ROWS " . implode(", ", $select) . " FROM " . idf_escape($_GET["select"]) . ($where ? " WHERE " . implode(" AND ", $where) : "") . ($order ? " ORDER BY " . implode(", ", $order) : "") . (strlen($limit) ? " LIMIT " . intval($limit) . " OFFSET " . ($limit * $_GET["page"]) : "")); if (!$result->num_rows) { echo "

" . lang('No rows.') . "

\n"; } else {