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

Wrap SQL query

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1343 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2010-03-11 20:11:31 +00:00
parent 7da9cce10d
commit e44fbc2e49
3 changed files with 5 additions and 5 deletions

View File

@@ -126,7 +126,7 @@ class Adminer {
* @return string * @return string
*/ */
function selectQuery($query) { function selectQuery($query) {
return "<p><code class='jush-sql'>" . h($query) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>\n"; return "<p><code class='jush-sql'>" . h(str_replace("\n", " ", $query)) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>\n";
} }
/** Description of a row in a table /** Description of a row in a table

View File

@@ -23,8 +23,8 @@ list($select, $group) = $adminer->selectColumnsProcess($columns, $indexes);
$where = $adminer->selectSearchProcess($fields, $indexes); $where = $adminer->selectSearchProcess($fields, $indexes);
$order = $adminer->selectOrderProcess($fields, $indexes); $order = $adminer->selectOrderProcess($fields, $indexes);
$limit = $adminer->selectLimitProcess(); $limit = $adminer->selectLimitProcess();
$from = ($select ? implode(", ", $select) : "*") . " FROM " . idf_escape($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : ""); $from = ($select ? implode(", ", $select) : "*") . "\nFROM " . idf_escape($TABLE) . ($where ? "\nWHERE " . implode(" AND ", $where) : "");
$group_by = ($group && count($group) < count($select) ? " GROUP BY " . implode(", ", $group) : "") . ($order ? " ORDER BY " . implode(", ", $order) : ""); $group_by = ($group && count($group) < count($select) ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : "");
if ($_POST && !$error) { if ($_POST && !$error) {
$where_check = "(" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . ")"; $where_check = "(" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . ")";
@@ -163,7 +163,7 @@ if (!$columns) {
$adminer->selectActionPrint($text_length); $adminer->selectActionPrint($text_length);
echo "</form>\n"; echo "</form>\n";
$query = "SELECT " . (intval($limit) && $group && count($group) < count($select) ? "SQL_CALC_FOUND_ROWS " : "") . $from . $group_by . ($limit != "" ? " LIMIT " . intval($limit) . ($_GET["page"] ? " OFFSET " . ($limit * $_GET["page"]) : "") : ""); $query = "SELECT " . (intval($limit) && $group && count($group) < count($select) ? "SQL_CALC_FOUND_ROWS " : "") . $from . $group_by . ($limit != "" ? "\nLIMIT " . intval($limit) . ($_GET["page"] ? " OFFSET " . ($limit * $_GET["page"]) : "") : "");
echo $adminer->selectQuery($query); echo $adminer->selectQuery($query);
$result = $connection->query($query); $result = $connection->query($query);

View File

@@ -105,7 +105,7 @@ ORDER BY ORDINAL_POSITION");
} }
function selectQuery($query) { function selectQuery($query) {
return "<!-- " . str_replace("--", "--><!--", $query) . " -->\n"; return "<!--\n" . str_replace("--", "--><!--", $query) . "\n-->\n";
} }
function rowDescription($table) { function rowDescription($table) {