1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-18 20:31:19 +02:00

Don't modify $query by adminer_select_query

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@801 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-07-11 19:52:48 +00:00
parent c16c57b1b1
commit c74c06ad49
3 changed files with 5 additions and 28 deletions

View File

@@ -47,19 +47,14 @@ function adminer_select_links($table_status) {
return call_adminer('select_links', '<a href="' . htmlspecialchars($SELF) . (isset($table_status["Engine"]) ? 'table=' : 'view=') . urlencode($_GET['select']) . '">' . lang('Table structure') . '</a>', $table_status);
}
/** Process and print select query before execution
/** Query printed in select before execution
* @param string query to be executed
* @return string
*/
function adminer_select_query($query) {
global $SELF;
// it would be nice if $query can be passed by reference and printed value would be returned but call_user() doesn't allow reference parameters
$return = call_adminer('select_query', "", $query);
if (!$return) {
echo "<p><code class='jush-sql'>" . htmlspecialchars($query) . "</code> <a href='" . htmlspecialchars($SELF) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a></p>\n";
return $query;
}
return $return;
return call_adminer('select_query', "<p><code class='jush-sql'>" . htmlspecialchars($query) . "</code> <a href='" . htmlspecialchars($SELF) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a></p>\n", $query);
}
/** Query printed after execution in the message

View File

@@ -239,7 +239,7 @@ if (!$columns) {
echo "</form>\n";
$query = "SELECT " . (count($group) < count($select) ? "SQL_CALC_FOUND_ROWS " : "") . $from . $group_by . (strlen($limit) ? " LIMIT " . intval($limit) . (intval($_GET["page"]) ? " OFFSET " . ($limit * $_GET["page"]) : "") : "");
$query = adminer_select_query($query);
echo adminer_select_query($query);
$result = $dbh->query($query);
if (!$result) {