1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 09:34:10 +02:00

Max text length

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@120 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2007-07-11 10:22:59 +00:00
parent df96e54e3b
commit 63441b12f3
2 changed files with 17 additions and 2 deletions

View File

@@ -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; }
</style>

View File

@@ -86,11 +86,27 @@ for (var i=0; <?php echo $i; ?> > i; i++) {
echo '<div><input name="limit" size="3" value="' . htmlspecialchars($limit) . '" /></div>';
echo "</fieldset>\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 "<fieldset><legend>" . lang('Text length') . "</legend>\n";
echo '<div><input name="text_length" size="3" value="' . htmlspecialchars($text_length) . '" /></div>';
echo "</fieldset>\n";
}
echo "<fieldset><legend>" . lang('Action') . "</legend><div><input type='submit' value='" . lang('Select') . "' /></div></fieldset>\n";
echo "</form>\n";
echo "<div style='clear: left;'></div>\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 "<p class='message'>" . lang('No rows.') . "</p>\n";
} else {