Skip to content
Browse files

Save queries to history

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@654 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 622f6aa commit 10bdbed14f91e5f0a86935ebc4f4ab2a90dfa76c jakubvrana committed Jun 4, 2009
Showing with 8 additions and 5 deletions.
  1. +5 −1 include/functions.inc.php
  2. +1 −1 sql.inc.php
  3. +2 −3 todo.txt
View
6 include/functions.inc.php
@@ -94,7 +94,11 @@ function redirect($location, $message = null) {
function query_redirect($query, $location, $message, $redirect = true, $execute = true, $failed = false) {
global $dbh, $error, $SELF;
$id = "sql-" . count($_SESSION["messages"]);
- $sql = ($query ? " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><span id='$id' class='hidden'><br /><code class='jush-sql'>" . htmlspecialchars($query) . '</code> <a href="' . htmlspecialchars($SELF) . 'sql=' . urlencode($query) . '">' . lang('Edit') . '</a></span>' : "");
+ $sql = "";
+ if ($query) {
+ $sql = " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><span id='$id' class='hidden'><br /><code class='jush-sql'>" . htmlspecialchars($query) . '</code> <a href="' . htmlspecialchars($SELF) . 'sql=&amp;history=' . count($_SESSION["history"]) . '">' . lang('Edit') . '</a></span>';
+ $_SESSION["history"][] = $query;
+ }
if ($execute) {
$failed = !$dbh->query($query);
}
View
2 sql.inc.php
@@ -67,7 +67,7 @@
?>
<form action="" method="post">
-<p><textarea name="query" rows="20" cols="80" style="width: 98%;"><?php echo htmlspecialchars($_POST ? $_POST["query"] : $_GET["sql"]); ?></textarea></p>
+<p><textarea name="query" rows="20" cols="80" style="width: 98%;"><?php echo htmlspecialchars($_POST ? $_POST["query"] : (strlen($_GET["history"]) ? $_SESSION["history"][$_GET["history"]] : $_GET["sql"])); ?></textarea></p>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>" />
<input type="submit" value="<?php echo lang('Execute'); ?>" />
View
5 todo.txt
@@ -1,14 +1,13 @@
-Join repeated echo in _compile.php
Bulk database create and drop
Add whisperer to fields with foreign key
Highlight found fields
MySQL 5 BIT data type
Transactions in export
Compress export and import
Create view and routine options
-SQL queries history - utilize in edit link in .message and .error
+Visualize SQL queries history
Function to fix database encoding - http://php.vrana.cz/prevod-kodovani-mysql.php
? Save token also to cookie - for session expiration and login in other window
? Save uploaded files after error to session variable instead of hidden field
-? Aliasing of built-in functions can save 7 KB, substitution of $_GET and friends can save 2 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB, JS shrink can save 1 KB
+? Aliasing of built-in functions can save 7 KB, substitution of $_GET and friends can save 2 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB, JS packer can save 1 KB
? AJAX editing - select page has all data to display edit form

0 comments on commit 10bdbed

Please sign in to comment.
Something went wrong with that request. Please try again.