Skip to content
Browse files

Database abstraction

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@97 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 01f52eb commit ae372aabbafdd4ed838907f524f598282535f155 jakubvrana committed Jul 10, 2007
Showing with 276 additions and 204 deletions.
  1. +99 −25 abstraction.inc.php
  2. +3 −10 auth.inc.php
  3. +17 −25 call.inc.php
  4. +2 −2 connect.inc.php
  5. +9 −8 create.inc.php
  6. +12 −12 database.inc.php
  7. +9 −8 design.inc.php
  8. +1 −1 download.inc.php
  9. +30 −32 dump.inc.php
  10. +8 −3 edit.inc.php
  11. +42 −36 functions.inc.php
  12. +6 −5 index.php
  13. +2 −2 indexes.inc.php
  14. +2 −0 lang.inc.php
  15. +12 −12 select.inc.php
  16. +12 −13 sql.inc.php
  17. +9 −9 table.inc.php
  18. +1 −1 view.inc.php
View
124 abstraction.inc.php
@@ -1,42 +1,116 @@
<?php
if (extension_loaded("mysqli")) {
class Min_MySQLi extends MySQLi {
- function mysqli_result($result, $row, $field) {
- mysqli_data_seek($result, $row);
- $row = mysql_fetch_assoc($result);
+ function Min_MySQLi() {
+ $this->init();
+ }
+
+ function connect($server, $username, $password) {
+ return $this->real_connect(
+ (strlen($server) ? $server : ini_get("mysqli.default_host")),
+ (strlen("$server$username") ? $username : ini_get("mysqli.default_user")),
+ (strlen("$server$username$password") ? $password : ini_get("mysqli.default_pw"))
+ );
+ }
+
+ function result($result, $offset, $field = 0) {
+ $result->data_seek($offset);
+ $row = $result->fetch_array();
return $row[$field];
}
}
- $mysql = mysqli_init();
+
+ $mysql = new Min_MySQLi;
+
} elseif (extension_loaded("mysql")) {
class Min_MySQL {
- var $_link;
- function real_connect($server, $username, $password) { return $this->_link = mysql_connect($server, $username, $password, false, 131072); }
- function query($query) { return new Min_MySQLResult(mysql_query($query, $this->_link)); }
- function result($result, $row, $field = 0) { return mysql_result($result->_result, $row, $field); }
- function error() { return mysql_error($this->_link); }
- function affected_rows() { return mysql_affected_rows($this->_link); }
- function select_db($database) { return mysql_select_db($database, $this->_link); }
- function real_escape_string($string) { return mysql_real_escape_string($string, $this->_link); }
- function get_server_info() { return mysql_get_server_info($this->_link); }
-
- function fetch_field($result, $offset = null) {
- $row = mysql_fetch_field($result, $offset);
+ var $_link, $_result, $server_info, $affected_rows, $error;
+
+ function connect($server, $username, $password) {
+ $this->_link = @mysql_pconnect(
+ (strlen($server) ? $server : ini_get("mysql.default_host")),
+ (strlen("$server$username") ? $username : ini_get("mysql.default_user")),
+ (strlen("$server$username$password") ? $password : ini_get("mysql.default_password")),
+ 131072 // CLIENT_MULTI_RESULTS for CALL
+ );
+ if ($this->_link) {
+ $this->server_info = mysql_get_server_info($this->_link);
+ }
+ return (bool) $this->_link;
+ }
+
+ function query($query) {
+ $result = mysql_query($query, $this->_link);
+ if (!$result) {
+ $this->error = mysql_error($this->_link);
+ return false;
+ } elseif ($result === true) {
+ $this->affected_rows = mysql_affected_rows($this->_link);
+ return true;
+ }
+ return new Min_MySQLResult($result);
+ }
+
+ function multi_query($query) {
+ return $this->_result = $this->query($query);
+ }
+
+ function store_result() {
+ return $this->_result;
+ }
+
+ function next_result() {
+ return false;
+ }
+
+ function result($result, $offset, $field = 0) {
+ return mysql_result($result->_result, $offset, $field);
+ }
+
+ function select_db($database) {
+ return mysql_select_db($database, $this->_link);
+ }
+
+ function real_escape_string($string) {
+ return mysql_real_escape_string($string, $this->_link);
+ }
+ }
+
+ class Min_MySQLResult {
+ var $_result, $_offset, $num_rows;
+
+ function Min_MySQLResult($result) {
+ $this->_result = $result;
+ $this->_offset = 0;
+ $this->num_rows = mysql_num_rows($result);
+ }
+
+ function fetch_assoc() {
+ return mysql_fetch_assoc($this->_result);
+ }
+
+ function fetch_row() {
+ return mysql_fetch_row($this->_result);
+ }
+
+ function fetch_field() {
+ $row = mysql_fetch_field($this->_result, $this->_offset++);
$row->orgtable = $row->table;
$row->orgname = $row->name;
$row->charsetnr = ($row->blob ? 63 : 0);
return $row;
}
+
+ function free() {
+ return mysql_free_result($this->_result);
+ }
}
- class Min_MySQLResult {
- var $_result;
- function Min_MySQLResult($result) { $this->_result = $result; }
- function fetch_assoc() { return mysql_fetch_assoc($this->_result); }
- function fetch_row() { return mysql_fetch_row($this->_result); }
- function free_result() { return mysql_free_result($this->_result); }
- function num_rows() { return mysql_num_rows($this->_result); }
- }
+
$mysql = new Min_MySQL;
+
} else {
-
+ page_header(lang('No MySQL extension'));
+ echo "<p class='error'>" . lang('None of supported PHP extensions (%s) are available.', 'mysqli, mysql') . "</p>\n";
+ page_footer("auth");
+ exit;
}
View
13 auth.inc.php
@@ -14,14 +14,7 @@
$_SESSION["tokens"][$_GET["server"]] = array();
}
-$username = $_SESSION["usernames"][$_GET["server"]];
-$password = $_SESSION["passwords"][$_GET["server"]];
-if (isset($_GET["logout"]) || !@mysql_connect(
- (strlen($_GET["server"]) ? $_GET["server"] : ini_get("mysql.default_host")),
- (strlen("$_GET[server]$username") ? $username : ini_get("mysql.default_user")),
- (strlen("$_GET[server]$username$password") ? $password : ini_get("mysql.default_password")),
- false, 131072 // CLIENT_MULTI_RESULTS for CALL
-)) {
+if (isset($_GET["logout"]) || !$mysql->connect($_GET["server"], $_SESSION["usernames"][$_GET["server"]], $_SESSION["passwords"][$_GET["server"]])) {
page_header(lang('Login'));
if (isset($_GET["logout"])) {
echo "<p class='message'>" . lang('Logout successful.') . "</p>\n";
@@ -32,7 +25,7 @@
<form action="" method="post">
<table border="0" cellspacing="0" cellpadding="2">
<tr><th><?php echo lang('Server'); ?>:</th><td><input name="server" value="<?php echo htmlspecialchars($_GET["server"]); ?>" maxlength="60" /></td></tr>
- <tr><th><?php echo lang('Username'); ?>:</th><td><input name="username" value="<?php echo htmlspecialchars($username); ?>" maxlength="16" /></td></tr>
+ <tr><th><?php echo lang('Username'); ?>:</th><td><input name="username" value="<?php echo htmlspecialchars($_SESSION["usernames"][$_GET["server"]]); ?>" maxlength="16" /></td></tr>
<tr><th><?php echo lang('Password'); ?>:</th><td><input type="password" name="password" /></td></tr>
<tr><th><?php
foreach ($_POST as $key => $val) { // expired session
@@ -60,4 +53,4 @@
page_footer("auth");
exit;
}
-mysql_query("SET SQL_QUOTE_SHOW_CREATE=1");
+$mysql->query("SET SQL_QUOTE_SHOW_CREATE=1");
View
42 call.inc.php
@@ -1,10 +1,13 @@
<?php
+page_header(lang('Call') . ": " . htmlspecialchars($_GET["call"]));
+
function normalize_enum($match) {
return "'" . str_replace("'", "''", addcslashes(stripcslashes(str_replace($match[0]{0} . $match[0]{0}, $match[0]{0}, substr($match[0], 1, -1))), '\\')) . "'";
}
+
$length = '\'(?:[^\'\\\\]*|\\\\.)+\'|"(?:[^"\\\\]*|\\\\.)+"';
$pattern = "\\s*(IN|OUT|INOUT)?\\s*(?:`((?:[^`]*|``)+)`\\s*|\\b(\\S+)\\s+)([a-z]+)(?:\\s*\\(((?:[^'\")]*|$length)+)\\))?\\s*(?:zerofill\\s+)?(unsigned)?";
-$create = mysql_result(mysql_query("SHOW CREATE " . (isset($_GET["callf"]) ? "FUNCTION" : "PROCEDURE") . " " . idf_escape($_GET["call"])), 0, 2);
+$create = $mysql->result($mysql->query("SHOW CREATE " . (isset($_GET["callf"]) ? "FUNCTION" : "PROCEDURE") . " " . idf_escape($_GET["call"])), 0, 2);
preg_match("~\\($pattern(?:\\s*,$pattern)*~is", $create, $match);
$in = array();
$out = array();
@@ -26,43 +29,32 @@ function normalize_enum($match) {
}
$params[$i] = $field;
}
+
if ($_POST) {
$call = array();
foreach ($params as $key => $field) {
if (in_array($key, $in)) {
$val = process_input($key, $field);
if (isset($out[$key])) {
- mysql_query("SET @" . idf_escape($field["field"]) . " = " . $val);
+ $mysql->query("SET @" . idf_escape($field["field"]) . " = " . $val);
}
}
$call[] = (isset($out[$key]) ? "@" . idf_escape($field["field"]) : $val);
}
- $result = mysql_query((isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . idf_escape($_GET["call"]) . "(" . implode(", ", $call) . ")");
- if (!$result) {
- $error = mysql_error();
- } elseif ($result === true) {
- $message = lang('Routine has been called, %d row(s) affected.', mysql_affected_rows());
- if (!$out) {
- redirect(substr($SELF, 0, -1), $message);
- }
- }
-}
-
-page_header(lang('Call') . ": " . htmlspecialchars($_GET["call"]));
-
-if ($_POST) {
+ $result = $mysql->multi_query((isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . idf_escape($_GET["call"]) . "(" . implode(", ", $call) . ")");
if (!$result) {
- echo "<p class='error'>" . lang('Error during calling') . ": " . htmlspecialchars($error) . "</p>\n";
+ echo "<p class='error'>" . lang('Error during calling') . ": " . htmlspecialchars($mysql->error) . "</p>\n";
} else {
- if ($result === true) {
- echo "<p class='message'>$message</p>\n";
- } else {
- select($result);
- echo "<br />\n";
- }
+ do {
+ $result = $mysql->store_result();
+ if (is_object($result)) {
+ select($result);
+ } else {
+ echo "<p class='message'>" . lang('Routine has been called, %d row(s) affected.', $mysql->affected_rows) . "</p>\n";
+ }
+ } while ($mysql->next_result());
if ($out) {
- select(mysql_query("SELECT " . implode(", ", $out)));
- echo "<br />\n";
+ select($mysql->query("SELECT " . implode(", ", $out)));
}
}
}
View
4 connect.inc.php
@@ -1,5 +1,5 @@
<?php
-if (!(strlen($_GET["db"]) ? mysql_select_db($_GET["db"]) : isset($_GET["sql"]) || isset($_GET["dump"]) || isset($_GET["database"]))) {
+if (!(strlen($_GET["db"]) ? $mysql->select_db($_GET["db"]) : isset($_GET["sql"]) || isset($_GET["dump"]) || isset($_GET["database"]))) {
page_header(lang('Select database'));
if (strlen($_GET["db"])) {
echo "<p class='error'>" . lang('Invalid database.') . "</p>\n";
@@ -9,4 +9,4 @@
page_footer("db");
exit;
}
-mysql_query("SET CHARACTER SET utf8");
+$mysql->query("SET CHARACTER SET utf8");
View
17 create.inc.php
@@ -29,20 +29,20 @@
. idf_escape($field["field"]) . " $field[type]"
. ($field["length"] ? "($field[length])" : "")
. (preg_match('~int|float|double|decimal~', $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "")
- . (preg_match('~char|text|enum|set~', $field["type"]) && $field["collation"] ? " COLLATE '" . mysql_real_escape_string($field["collation"]) . "'" : "")
+ . (preg_match('~char|text|enum|set~', $field["type"]) && $field["collation"] ? " COLLATE '" . $mysql->real_escape_string($field["collation"]) . "'" : "")
. ($field["null"] ? "" : " NOT NULL")
. ($key == $_POST["auto_increment"] ? " AUTO_INCREMENT$auto_increment_index" : "")
- . " COMMENT '" . mysql_real_escape_string($field["comment"]) . "'"
+ . " COMMENT '" . $mysql->real_escape_string($field["comment"]) . "'"
. (strlen($_GET["create"]) && !strlen($field["orig"]) ? $after : "")
;
$after = "AFTER " . idf_escape($field["field"]);
} elseif (strlen($field["orig"])) {
$fields[] = "DROP " . idf_escape($field["orig"]);
}
}
- $status = ($_POST["Engine"] ? " ENGINE='" . mysql_real_escape_string($_POST["Engine"]) . "'" : "")
- . ($_POST["Collation"] ? " COLLATE '" . mysql_real_escape_string($_POST["Collation"]) . "'" : "")
- . " COMMENT='" . mysql_real_escape_string($_POST["Comment"]) . "'"
+ $status = ($_POST["Engine"] ? " ENGINE='" . $mysql->real_escape_string($_POST["Engine"]) . "'" : "")
+ . ($_POST["Collation"] ? " COLLATE '" . $mysql->real_escape_string($_POST["Collation"]) . "'" : "")
+ . " COMMENT='" . $mysql->real_escape_string($_POST["Comment"]) . "'"
;
if (strlen($_GET["create"])) {
$query = "ALTER TABLE " . idf_escape($_GET["create"]) . " " . implode(", ", $fields) . ", RENAME TO " . idf_escape($_POST["name"]) . ", $status";
@@ -52,10 +52,10 @@
$message = lang('Table has been created.');
}
}
- if (mysql_query($query)) {
+ if ($mysql->query($query)) {
redirect(($_POST["drop"] ? substr($SELF, 0, -1) : $SELF . "table=" . urlencode($_POST["name"])), $message);
}
- $error = mysql_error();
+ $error = $mysql->error;
}
page_header(strlen($_GET["create"]) ? lang('Alter table') . ': ' . htmlspecialchars($_GET["create"]) : lang('Create table'));
@@ -72,7 +72,8 @@
$row["fields"][$row["auto_increment"]]["auto_increment"] = true;
}
} elseif (strlen($_GET["create"])) {
- $row = mysql_fetch_assoc(mysql_query("SHOW TABLE STATUS LIKE '" . mysql_real_escape_string($_GET["create"]) . "'"));
+ $result = $mysql->query("SHOW TABLE STATUS LIKE '" . $mysql->real_escape_string($_GET["create"]) . "'");
+ $row = $result->fetch_assoc();
$row["name"] = $_GET["create"];
$row["fields"] = array_values(fields($_GET["create"]));
} else {
View
24 database.inc.php
@@ -1,30 +1,30 @@
<?php
if ($_POST && !$error) {
if ($_POST["drop"]) {
- if (mysql_query("DROP DATABASE " . idf_escape($_GET["db"]))) {
+ if ($mysql->query("DROP DATABASE " . idf_escape($_GET["db"]))) {
redirect(substr(preg_replace('~(\\?)db=[^&]*&|&db=[^&]*~', '\\1', $SELF), 0, -1), lang('Database has been dropped.'));
}
} elseif ($_GET["db"] !== $_POST["name"]) {
- if (mysql_query("CREATE DATABASE " . idf_escape($_POST["name"]) . ($_POST["collation"] ? " COLLATE '" . mysql_real_escape_string($_POST["collation"]) . "'" : ""))) {
+ if ($mysql->query("CREATE DATABASE " . idf_escape($_POST["name"]) . ($_POST["collation"] ? " COLLATE '" . $mysql->real_escape_string($_POST["collation"]) . "'" : ""))) {
if (!strlen($_GET["db"])) {
redirect(preg_replace('~(\\?)db=[^&]*&|&db=[^&]*~', '\\1', $SELF) . "db=" . urlencode($_POST["name"]), lang('Database has been created.'));
}
- $result = mysql_query("SHOW TABLES");
- while ($row = mysql_fetch_row($result)) {
- if (!mysql_query("RENAME TABLE " . idf_escape($row[0]) . " TO " . idf_escape($_POST["name"]) . "." . idf_escape($row[0]))) {
+ $result = $mysql->query("SHOW TABLES");
+ while ($row = $result->fetch_row()) {
+ if (!$mysql->query("RENAME TABLE " . idf_escape($row[0]) . " TO " . idf_escape($_POST["name"]) . "." . idf_escape($row[0]))) {
break;
}
}
- mysql_free_result($result);
+ $result->free();
if (!$row) {
- mysql_query("DROP DATABASE " . idf_escape($_GET["db"]));
+ $mysql->query("DROP DATABASE " . idf_escape($_GET["db"]));
redirect(preg_replace('~(\\?)db=[^&]*&|&db=[^&]*~', '\\1', $SELF) . "db=" . urlencode($_POST["name"]), lang('Database has been renamed.'));
}
}
- } elseif (!$_POST["collation"] || mysql_query("ALTER DATABASE " . idf_escape($_POST["name"]) . " COLLATE '" . mysql_real_escape_string($_POST["collation"]) . "'")) {
+ } elseif (!$_POST["collation"] || $mysql->query("ALTER DATABASE " . idf_escape($_POST["name"]) . " COLLATE '" . $mysql->real_escape_string($_POST["collation"]) . "'")) {
redirect(substr($SELF, 0, -1), ($_POST["collation"] ? lang('Database has been altered.') : null));
}
- $error = mysql_error();
+ $error = $mysql->error;
}
page_header(strlen($_GET["db"]) ? lang('Alter database') . ": " . htmlspecialchars($_GET["db"]) : lang('Create database'));
@@ -36,11 +36,11 @@
} else {
$name = $_GET["db"];
$collate = array();
- if (strlen($_GET["db"]) && ($result = mysql_query("SHOW CREATE DATABASE " . idf_escape($_GET["db"])))) {
- if (preg_match('~ COLLATE ([^ ]+)~', mysql_result($result, 0, 1), $match)) {
+ if (strlen($_GET["db"]) && ($result = $mysql->query("SHOW CREATE DATABASE " . idf_escape($_GET["db"])))) {
+ if (preg_match('~ COLLATE ([^ ]+)~', $mysql->result($result, 0, 1), $match)) {
$collate = $match[1];
}
- mysql_free_result($result);
+ $result->free();
}
}
?>
View
17 design.inc.php
@@ -16,6 +16,7 @@ function page_header($title) {
H2 { font-size: 150%; margin-top: 0; }
FIELDSET { float: left; padding: .5em; margin: 0; }
PRE { margin: 0; margin: .12em 0; }
+TABLE { margin-bottom: 1em; }
.error { color: Red; }
.message { color: Green; }
#menu { position: absolute; top: 8px; left: 8px; width: 15em; overflow: auto; white-space: nowrap; }
@@ -38,7 +39,7 @@ function page_header($title) {
}
function page_footer($missing = false) {
- global $SELF;
+ global $SELF, $mysql;
?>
</div>
@@ -56,30 +57,30 @@ function page_footer($missing = false) {
<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)</option>
<?php
flush();
- $result = mysql_query("SHOW DATABASES");
- while ($row = mysql_fetch_row($result)) {
+ $result = $mysql->query("SHOW DATABASES");
+ while ($row = $result->fetch_row()) {
echo "<option" . ($row[0] == $_GET["db"] ? " selected='selected'" : "") . ">" . htmlspecialchars($row[0]) . "</option>\n";
}
- mysql_free_result($result);
+ $result->free();
?>
</select><?php if (isset($_GET["sql"])) { ?><input type="hidden" name="sql" value="" /><?php } ?></p>
<noscript><p><input type="submit" value="<?php echo lang('Use'); ?>" /></p></noscript>
</form>
<?php
if ($missing != "db" && strlen($_GET["db"])) {
- $result = mysql_query("SHOW TABLE STATUS");
- if (!mysql_num_rows($result)) {
+ $result = $mysql->query("SHOW TABLE STATUS");
+ if (!$result->num_rows) {
echo "<p class='message'>" . lang('No tables.') . "</p>\n";
} else {
echo "<p>\n";
- while ($row = mysql_fetch_assoc($result)) {
+ while ($row = $result->fetch_assoc()) {
echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row["Name"]) . '">' . lang('select') . '</a> ';
echo '<a href="' . htmlspecialchars($SELF) . (isset($row["Engine"]) ? 'table' : 'view') . '=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a><br />\n";
}
echo "</p>\n";
}
echo '<p><a href="' . htmlspecialchars($SELF) . 'create=">' . lang('Create new table') . "</a></p>\n";
- mysql_free_result($result);
+ $result->free();
}
}
?>
View
2 download.inc.php
@@ -1,3 +1,3 @@
<?php
header("Content-Type: application/octet-stream");
-echo mysql_result(mysql_query("SELECT " . idf_escape($_GET["field"]) . " FROM " . idf_escape($_GET["download"]) . " WHERE " . implode(" AND ", where()) . " LIMIT 1"), 0);
+echo $mysql->result($mysql->query("SELECT " . idf_escape($_GET["field"]) . " FROM " . idf_escape($_GET["download"]) . " WHERE " . implode(" AND ", where()) . " LIMIT 1"), 0);
View
62 dump.inc.php
@@ -2,65 +2,63 @@
header("Content-Type: text/plain; charset=utf-8");
function dump($db) {
+ global $mysql;
static $routines;
- static $version;
if (!isset($routines)) {
- $version = mysql_get_server_info();
$routines = array();
- if ($version >= 5) {
+ if ($mysql->server_info >= 5) {
foreach (array("FUNCTION", "PROCEDURE") as $routine) {
- $result = mysql_query("SHOW $routine STATUS");
- while ($row = mysql_fetch_assoc($result)) {
+ $result = $mysql->query("SHOW $routine STATUS");
+ while ($row = $result->fetch_assoc()) {
if (!strlen($_GET["db"]) || $row["Db"] === $_GET["db"]) {
- $routines[$row["Db"]][] = mysql_result(mysql_query("SHOW CREATE $routine " . idf_escape($row["Db"]) . "." . idf_escape($row["Name"])), 0, 2) . ";;\n\n";
+ $routines[$row["Db"]][] = $mysql->result($mysql->query("SHOW CREATE $routine " . idf_escape($row["Db"]) . "." . idf_escape($row["Name"])), 0, 2) . ";;\n\n";
}
}
- mysql_free_result($result);
+ $result->free();
}
}
}
- $result = mysql_query("SHOW CREATE DATABASE " . idf_escape($db));
+ $result = $mysql->query("SHOW CREATE DATABASE " . idf_escape($db));
if ($result) {
- echo mysql_result($result, 0, 1) . ";\n";
- mysql_free_result($result);
+ echo $mysql->result($result, 0, 1) . ";\n";
+ $result->free();
}
echo "USE " . idf_escape($db) . ";\n";
echo "SET CHARACTER SET utf8;\n\n";
- $result = mysql_query("SHOW TABLE STATUS");
- while ($row = mysql_fetch_assoc($result)) {
- $result1 = mysql_query("SHOW CREATE TABLE " . idf_escape($row["Name"]));
+ $result = $mysql->query("SHOW TABLE STATUS");
+ while ($row = $result->fetch_assoc()) {
+ $result1 = $mysql->query("SHOW CREATE TABLE " . idf_escape($row["Name"]));
if ($result1) {
- echo mysql_result($result1, 0, 1) . ";\n";
- mysql_free_result($result1);
+ echo $mysql->result($result1, 0, 1) . ";\n";
+ $result1->free();
if (isset($row["Engine"])) {
- $result1 = mysql_query("SELECT * FROM " . idf_escape($row["Name"])); //! enum and set as numbers
+ $result1 = $mysql->query("SELECT * FROM " . idf_escape($row["Name"])); //! enum and set as numbers
if ($result1) {
- while ($row1 = mysql_fetch_row($result1)) {
- echo "INSERT INTO " . idf_escape($row["Name"]) . " VALUES ('" . implode("', '", array_map('mysql_real_escape_string', $row1)) . "');\n";
+ while ($row1 = $result1->fetch_row()) {
+ echo "INSERT INTO " . idf_escape($row["Name"]) . " VALUES ('" . implode("', '", array_map(array($mysql, 'real_escape_string'), $row1)) . "');\n";
}
- mysql_free_result($result1);
+ $result1->free();
}
}
echo "\n";
}
}
- mysql_free_result($result);
+ $result->free();
- if ($version >= 5) {
- $result = mysql_query("SHOW TRIGGERS");
- $triggers = mysql_num_rows($result);
- if ($triggers || $routines[$db]) {
+ if ($mysql->server_info >= 5) {
+ $result = $mysql->query("SHOW TRIGGERS");
+ if ($result->num_rows || $routines[$db]) {
echo "DELIMITER ;;\n\n";
}
- while ($row = mysql_fetch_assoc($result)) {
+ while ($row = $result->fetch_assoc()) {
echo "CREATE TRIGGER " . idf_escape($row["Trigger"]) . " $row[Timing] $row[Event] ON " . idf_escape($row["Table"]) . " FOR EACH ROW $row[Statement];;\n\n";
}
- mysql_free_result($result);
echo implode("", (array) $routines[$db]);
- if ($triggers || $routines[$db]) {
+ if ($result->num_rows || $routines[$db]) {
echo "DELIMITER ;\n\n";
}
+ $result->free();
}
echo "\n\n";
@@ -69,13 +67,13 @@ function dump($db) {
if (strlen($_GET["db"])) {
dump($_GET["db"]);
} else {
- $result = mysql_query("SHOW DATABASES");
- while ($row = mysql_fetch_assoc($result)) {
- if ($row["Database"] != "information_schema" || mysql_get_server_info() < 5) {
- if (mysql_select_db($row["Database"])) {
+ $result = $mysql->query("SHOW DATABASES");
+ while ($row = $result->fetch_assoc()) {
+ if ($row["Database"] != "information_schema" || $mysql->server_info < 5) {
+ if ($mysql->select_db($row["Database"])) {
dump($row["Database"]);
}
}
}
- mysql_free_result($result);
+ $result->free();
}
View
11 edit.inc.php
@@ -30,10 +30,10 @@
$message = lang('Item has been inserted.');
}
}
- if (!$set || mysql_query($query)) {
+ if (!$set || $mysql->query($query)) {
redirect($SELF . (isset($_GET["default"]) ? "table=" : ($_POST["insert"] ? "edit=" : "select=")) . urlencode($_GET["edit"]), ($set ? $message : null));
}
- $error = mysql_error();
+ $error = $mysql->error;
}
page_header((isset($_GET["default"]) ? lang('Default values') : ($_GET["where"] ? lang('Edit') : lang('Insert'))) . ": " . htmlspecialchars($_GET["edit"]));
@@ -50,7 +50,12 @@
$select[] = ($field["type"] == "enum" || $field["type"] == "set" ? "1*" . idf_escape($name) . " AS " : "") . idf_escape($name);
}
}
- $data = ($select ? mysql_fetch_assoc(mysql_query("SELECT " . implode(", ", $select) . " FROM " . idf_escape($_GET["edit"]) . " WHERE " . implode(" AND ", $where) . " LIMIT 1")) : array());
+ if ($select) {
+ $result = $mysql->query("SELECT " . implode(", ", $select) . " FROM " . idf_escape($_GET["edit"]) . " WHERE " . implode(" AND ", $where) . " LIMIT 1");
+ $data = $result->fetch_assoc();
+ } else {
+ $data = array();
+ }
} else {
unset($data);
}
View
78 functions.inc.php
@@ -30,10 +30,11 @@ function optionlist($options, $selected = array(), $not_vals = false) {
}
function fields($table) {
+ global $mysql;
$return = array();
- $result = mysql_query("SHOW FULL COLUMNS FROM " . idf_escape($table));
+ $result = $mysql->query("SHOW FULL COLUMNS FROM " . idf_escape($table));
if ($result) {
- while ($row = mysql_fetch_assoc($result)) {
+ while ($row = $result->fetch_assoc()) {
preg_match('~^([^(]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~', $row["Type"], $match);
$return[$row["Field"]] = array(
"field" => $row["Field"],
@@ -48,29 +49,31 @@ function fields($table) {
"comment" => $row["Comment"],
);
}
- mysql_free_result($result);
+ $result->free();
}
return $return;
}
function indexes($table) {
+ global $mysql;
$return = array();
- $result = mysql_query("SHOW INDEX FROM " . idf_escape($table));
- while ($row = mysql_fetch_assoc($result)) {
+ $result = $mysql->query("SHOW INDEX FROM " . idf_escape($table));
+ while ($row = $result->fetch_assoc()) {
$return[$row["Key_name"]]["type"] = ($row["Key_name"] == "PRIMARY" ? "PRIMARY" : ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? "INDEX" : "UNIQUE")));
$return[$row["Key_name"]]["columns"][$row["Seq_in_index"]] = $row["Column_name"];
}
- mysql_free_result($result);
+ $result->free();
return $return;
}
function foreign_keys($table) {
+ global $mysql;
static $pattern = '~`((?:[^`]*|``)+)`~';
$return = array();
- $result = mysql_query("SHOW CREATE TABLE " . idf_escape($table));
+ $result = $mysql->query("SHOW CREATE TABLE " . idf_escape($table));
if ($result) {
- $create_table = mysql_result($result, 0, 1);
- mysql_free_result($result);
+ $create_table = $mysql->result($result, 0, 1);
+ $result->free();
preg_match_all('~FOREIGN KEY \\((.+)\\) REFERENCES (?:`(.+)`\\.)?`(.+)` \\((.+)\\)~', $create_table, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
preg_match_all($pattern, $match[1], $source);
@@ -102,9 +105,10 @@ function unique_idf($row, $indexes) {
}
function where() {
+ global $mysql;
$return = array();
foreach ((array) $_GET["where"] as $key => $val) {
- $return[] = idf_escape(bracket_escape($key, "back")) . " = BINARY '" . mysql_real_escape_string($val) . "'"; //! enum and set
+ $return[] = idf_escape(bracket_escape($key, "back")) . " = BINARY '" . $mysql->real_escape_string($val) . "'"; //! enum and set
}
foreach ((array) $_GET["null"] as $key) {
$return[] = idf_escape(bracket_escape($key, "back")) . " IS NULL";
@@ -113,24 +117,26 @@ function where() {
}
function collations() {
+ global $mysql;
$return = array();
- $result = mysql_query("SHOW COLLATION");
- while ($row = mysql_fetch_assoc($result)) {
+ $result = $mysql->query("SHOW COLLATION");
+ while ($row = $result->fetch_assoc()) {
$return[$row["Charset"]][] = $row["Collation"];
}
- mysql_free_result($result);
+ $result->free();
return $return;
}
function engines() {
+ global $mysql;
$return = array();
- $result = mysql_query("SHOW ENGINES");
- while ($row = mysql_fetch_assoc($result)) {
+ $result = $mysql->query("SHOW ENGINES");
+ while ($row = $result->fetch_assoc()) {
if ($row["Support"] == "YES" || $row["Support"] == "DEFAULT") {
$return[] = $row["Engine"];
}
}
- mysql_free_result($result);
+ $result->free();
return $return;
}
@@ -180,37 +186,36 @@ function get_file($key) {
}
function select($result) {
- if (!mysql_num_rows($result)) {
+ if (!$result->num_rows) {
echo "<p class='message'>" . lang('No rows.') . "</p>\n";
} else {
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
- for ($i=0; $row = mysql_fetch_row($result); $i++) {
+ for ($i=0; $row = $result->fetch_row(); $i++) {
if (!$i) {
echo "<thead><tr>";
$links = array();
$indexes = array();
$columns = array();
$blobs = array();
for ($j=0; $j < count($row); $j++) {
- $field = mysql_fetch_field($result, $j);
- //! table and column aliases
- if (strlen($field->table) && $field->primary_key) {
- $links[$j] = $field->table;
- if (!isset($indexes[$field->table])) {
- $indexes[$field->table] = array();
- foreach (indexes($field->table) as $index) {
+ $field = $result->fetch_field();
+ if (strlen($field->orgtable) && $field->primary_key) {
+ $links[$j] = $field->orgtable;
+ if (!isset($indexes[$field->orgtable])) {
+ $indexes[$field->orgtable] = array();
+ foreach (indexes($field->orgtable) as $index) {
if ($index["type"] == "PRIMARY") {
- $indexes[$field->table] = array_flip($index["columns"]);
+ $indexes[$field->orgtable] = array_flip($index["columns"]);
break;
}
}
- $columns[$field->table] = $indexes[$field->table];
+ $columns[$field->orgtable] = $indexes[$field->orgtable];
}
- unset($columns[$field->table][$field->name]);
- $indexes[$field->table][$field->name] = $j;
- $links[$j] = $field->table;
+ unset($columns[$field->orgtable][$field->orgname]);
+ $indexes[$field->orgtable][$field->orgname] = $j;
+ $links[$j] = $field->orgtable;
}
- if ($field->blob) {
+ if ($field->charsetnr == 63) {
$blobs[$j] = true;
}
echo "<th>" . htmlspecialchars($field->name) . "</th>";
@@ -237,7 +242,7 @@ function select($result) {
}
echo "</table>\n";
}
- mysql_free_result($result);
+ $result->free();
}
function input($name, $field, $value) {
@@ -283,22 +288,23 @@ function input($name, $field, $value) {
}
function process_input($name, $field) {
+ global $mysql;
$name = bracket_escape($name);
$return = $_POST["fields"][$name];
if (preg_match('~char|text|set|binary|blob~', $field["type"]) ? $_POST["null"][$name] : !strlen($return)) {
$return = "NULL";
} elseif ($field["type"] == "enum") {
- $return = (isset($_GET["default"]) ? "'" . mysql_real_escape_string($return) . "'" : intval($return));
+ $return = (isset($_GET["default"]) ? "'" . $mysql->real_escape_string($return) . "'" : intval($return));
} elseif ($field["type"] == "set") {
- $return = (isset($_GET["default"]) ? "'" . implode(",", array_map('mysql_real_escape_string', (array) $return)) . "'" : array_sum((array) $return));
+ $return = (isset($_GET["default"]) ? "'" . implode(",", array_map(array($mysql, 'real_escape_string'), (array) $return)) . "'" : array_sum((array) $return));
} elseif (preg_match('~binary|blob~', $field["type"])) {
$file = get_file($name);
if (!is_string($file) && !$field["null"]) {
return false; //! report errors, also empty $_POST (too big POST data, not only FILES)
}
- $return = "_binary'" . (is_string($file) ? mysql_real_escape_string($file) : "") . "'";
+ $return = "_binary'" . (is_string($file) ? $mysql->real_escape_string($file) : "") . "'";
} else {
- $return = "'" . mysql_real_escape_string($return) . "'";
+ $return = "'" . $mysql->real_escape_string($return) . "'";
}
return $return;
}
View
11 index.php
@@ -8,6 +8,7 @@
include "./functions.inc.php";
include "./lang.inc.php";
include "./design.inc.php";
+include "./abstraction.inc.php";
include "./auth.inc.php";
include "./connect.inc.php";
@@ -49,12 +50,12 @@
$TOKENS = array();
page_header(htmlspecialchars(lang('Database') . ": " . $_GET["db"]));
echo '<p><a href="' . htmlspecialchars($SELF) . 'database=">' . lang('Alter database') . "</a></p>\n";
- if (mysql_get_server_info() >= 5) {
- $result = mysql_query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '" . mysql_real_escape_string($_GET["db"]) . "'");
- if (mysql_num_rows($result)) {
+ if ($mysql->server_info >= 5) {
+ $result = $mysql->query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '" . $mysql->real_escape_string($_GET["db"]) . "'");
+ if ($result->num_rows) {
echo "<h2>" . lang('Routines') . "</h2>\n";
echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
- while ($row = mysql_fetch_assoc($result)) {
+ while ($row = $result->fetch_assoc()) {
echo "<tr valign='top'>";
echo "<th>" . htmlspecialchars($row["ROUTINE_TYPE"]) . "</th>";
echo '<td><a href="' . htmlspecialchars($SELF) . ($row["ROUTINE_TYPE"] == "FUNCTION" ? 'callf' : 'call') . '=' . urlencode($row["ROUTINE_NAME"]) . '">' . htmlspecialchars($row["ROUTINE_NAME"]) . '</a></td>';
@@ -63,7 +64,7 @@
}
echo "</table>\n";
}
- mysql_free_result($result);
+ $result->free();
}
}
}
View
4 indexes.inc.php
@@ -27,10 +27,10 @@
foreach ($indexes as $name => $existing) {
$alter[] = "DROP INDEX " . idf_escape($name);
}
- if (!$alter || mysql_query("ALTER TABLE " . idf_escape($_GET["indexes"]) . " " . implode(", ", $alter))) {
+ if (!$alter || $mysql->query("ALTER TABLE " . idf_escape($_GET["indexes"]) . " " . implode(", ", $alter))) {
redirect($SELF . "table=" . urlencode($_GET["indexes"]), ($alter ? lang('Indexes has been altered.') : null));
}
- $error = mysql_error();
+ $error = $mysql->error;
}
page_header(lang('Indexes') . ': ' . htmlspecialchars($_GET["indexes"]));
View
2 lang.inc.php
@@ -100,6 +100,8 @@ function lang($idf = null, $number = null) {
'Routine has been called, %d row(s) affected.' => array('Procedura byla zavolána, byl změněn %d záznam.', 'Procedura byla zavolána, byly změněny %d záznamy.', 'Procedura byla zavolána, bylo změněno %d záznamů.'),
'Call' => 'Zavolat',
'Error during calling' => 'Chyba při volání',
+ 'No MySQL extension' => 'Žádná MySQL extenze',
+ 'None of supported PHP extensions (%s) are available.' => 'Není dostupná žádná z podporovaných PHP extenzí (%s).',
),
);
if (!isset($idf)) {
View
24 select.inc.php
@@ -15,7 +15,7 @@
}
if (!$columns) {
- echo "<p class='error'>" . lang('Unable to select the table') . ($fields ? "" : ": " . mysql_error()) . ".</p>\n";
+ echo "<p class='error'>" . lang('Unable to select the table') . ($fields ? "" : ": " . $mysql->error) . ".</p>\n";
} else {
$indexes = indexes($_GET["select"]);
echo "<form action='' id='form'>\n<fieldset><legend>" . lang('Search') . "</legend>\n";
@@ -30,7 +30,7 @@
foreach ($indexes as $i => $index) {
if ($index["type"] == "FULLTEXT") {
if (strlen($_GET["fulltext"][$i])) {
- $where[] = "MATCH (" . implode(", ", array_map('idf_escape', $index["columns"])) . ") AGAINST ('" . mysql_real_escape_string($_GET["fulltext"][$i]) . "'" . (isset($_GET["boolean"][$i]) ? " IN BOOLEAN MODE" : "") . ")";
+ $where[] = "MATCH (" . implode(", ", array_map('idf_escape', $index["columns"])) . ") AGAINST ('" . $mysql->real_escape_string($_GET["fulltext"][$i]) . "'" . (isset($_GET["boolean"][$i]) ? " IN BOOLEAN MODE" : "") . ")";
}
echo "(<i>" . implode("</i>, <i>", $index["columns"]) . "</i>) AGAINST";
echo ' <input name="fulltext[' . $i . ']" value="' . htmlspecialchars($_GET["fulltext"][$i]) . '" />';
@@ -42,7 +42,7 @@
$i = 0;
foreach ((array) $_GET["where"] as $val) {
if (strlen($val["col"]) && in_array($val["op"], $operators)) {
- $where[] = idf_escape($val["col"]) . " $val[op]" . ($val["op"] != "IS NULL" ? " '" . mysql_real_escape_string($val["val"]) . "'" : "");
+ $where[] = idf_escape($val["col"]) . " $val[op]" . ($val["op"] != "IS NULL" ? " '" . $mysql->real_escape_string($val["val"]) . "'" : "");
echo "<div><select name='where[$i][col]'><option></option>" . optionlist($columns, $val["col"], "not_vals") . "</select>";
echo "<select name='where[$i][op]' onchange=\"where_change(this);\">" . optionlist($operators, $val["op"], "not_vals") . "</select>";
echo "<input name='where[$i][val]' value=\"" . htmlspecialchars($val["val"]) . "\" /></div>\n";
@@ -90,32 +90,32 @@ function where_change(op) {
echo "</form>\n";
echo "<div style='clear: left; margin-bottom: 1em;'></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"]) : ""));
- if (!mysql_num_rows($result)) {
+ $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"]) : ""));
+ if (!$result->num_rows) {
echo "<p class='message'>" . lang('No rows.') . "</p>\n";
} else {
- $found_rows = mysql_result(mysql_query(" SELECT FOUND_ROWS()"), 0); // space for mysql.trace_mode
+ $found_rows = $mysql->result($mysql->query(" SELECT FOUND_ROWS()"), 0); // space for mysql.trace_mode
$foreign_keys = array();
foreach (foreign_keys($_GET["select"]) as $foreign_key) {
foreach ($foreign_key[2] as $val) {
$foreign_keys[$val][] = $foreign_key;
}
}
$childs = array();
- if (mysql_get_server_info() >= 5) {
+ if ($mysql->server_info >= 5) {
// would be possible in earlier versions too, but only by examining all tables (in all databases)
- $result1 = mysql_query("SELECT * FROM information_schema.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = '" . mysql_real_escape_string($_GET["db"]) . "' AND REFERENCED_TABLE_NAME = '" . mysql_real_escape_string($_GET["select"]) . "' ORDER BY ORDINAL_POSITION");
- while ($row1 = mysql_fetch_assoc($result1)) {
+ $result1 = $mysql->query("SELECT * FROM information_schema.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = '" . $mysql->real_escape_string($_GET["db"]) . "' AND REFERENCED_TABLE_NAME = '" . $mysql->real_escape_string($_GET["select"]) . "' ORDER BY ORDINAL_POSITION");
+ while ($row1 = $result1->fetch_assoc()) {
$childs[$row1["CONSTRAINT_NAME"]][0] = $row1["TABLE_SCHEMA"];
$childs[$row1["CONSTRAINT_NAME"]][1] = $row1["TABLE_NAME"];
$childs[$row1["CONSTRAINT_NAME"]][2][] = $row1["REFERENCED_COLUMN_NAME"];
$childs[$row1["CONSTRAINT_NAME"]][3][] = $row1["COLUMN_NAME"];
}
- mysql_free_result($result1);
+ $result1->free();
}
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
- for ($j=0; $row = mysql_fetch_assoc($result); $j++) {
+ for ($j=0; $row = $result->fetch_assoc(); $j++) {
if (!$j) {
echo "<thead><tr><th>" . implode("</th><th>", array_map('htmlspecialchars', array_keys($row))) . "</th><th>" . lang('Action') . "</th></tr></thead>\n";
}
@@ -161,5 +161,5 @@ function where_change(op) {
echo "</p>\n";
}
}
- mysql_free_result($result);
+ $result->free();
}
View
25 sql.inc.php
@@ -18,21 +18,20 @@
} else {
$empty = false;
echo "<pre class='jush-sql'>" . htmlspecialchars(substr($query, 0, $match[0][1])) . "</pre>\n";
- $result = mysql_query(substr($query, 0, $match[0][1]));
+ if (!$mysql->multi_query(substr($query, 0, $match[0][1]))) {
+ echo "<p class='error'>" . lang('Error in query') . ": " . htmlspecialchars($mysql->error) . "</p>\n";
+ } else{
+ do {
+ $result = $mysql->store_result();
+ if (is_object($result)) {
+ select($result);
+ } else {
+ echo "<p class='message'>" . lang('Query executed OK, %d row(s) affected.', $mysql->affected_rows) . "</p>\n";
+ }
+ } while ($mysql->next_result());
+ }
$query = substr($query, $match[0][1] + strlen($match[0][0]));
$offset = 0;
- if (!$result) {
- echo "<p class='error'>" . lang('Error in query') . ": " . htmlspecialchars(mysql_error()) . "</p>\n";
- } elseif ($result === true) {
- /* more secure but less user-friendly
- if (token_delete()) {
- $token = token();
- }
- */
- echo "<p class='message'>" . lang('Query executed OK, %d row(s) affected.', mysql_affected_rows()) . "</p>\n";
- } else {
- select($result);
- }
}
}
}
View
18 table.inc.php
@@ -1,20 +1,20 @@
<?php
page_header(lang('Table') . ": " . htmlspecialchars($_GET["table"]));
-$result = mysql_query("SHOW COLUMNS FROM " . idf_escape($_GET["table"]));
+$result = $mysql->query("SHOW COLUMNS FROM " . idf_escape($_GET["table"]));
if (!$result) {
- echo "<p class='error'>" . lang('Unable to show the table definition') . ": " . mysql_error() . ".</p>\n";
+ echo "<p class='error'>" . lang('Unable to show the table definition') . ": " . $mysql->error . ".</p>\n";
} else {
$auto_increment_only = true;
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
- while ($row = mysql_fetch_assoc($result)) {
+ while ($row = $result->fetch_assoc()) {
if (!$row["auto_increment"]) {
$auto_increment_only = false;
}
echo "<tr><th>" . htmlspecialchars($row["Field"]) . "</th><td>$row[Type]" . ($row["Null"] == "YES" ? " <i>NULL</i>" : "") . "</td></tr>\n";
}
echo "</table>\n";
- mysql_free_result($result);
+ $result->free();
echo "<p>";
echo '<a href="' . htmlspecialchars($SELF) . 'create=' . urlencode($_GET["table"]) . '">' . lang('Alter table') . '</a>';
@@ -44,15 +44,15 @@
}
}
-if (mysql_get_server_info() >= 5) {
- $result = mysql_query("SHOW TRIGGERS LIKE '" . mysql_real_escape_string($_GET["table"]) . "'");
- if (mysql_num_rows($result)) {
+if ($mysql->server_info >= 5) {
+ $result = $mysql->query("SHOW TRIGGERS LIKE '" . $mysql->real_escape_string($_GET["table"]) . "'");
+ if ($result->num_rows) {
echo "<h3>" . lang('Triggers') . "</h3>\n";
echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
- while ($row = mysql_fetch_assoc($result)) {
+ while ($row = $result->fetch_assoc()) {
echo "<tr valign='top'><th>$row[Timing]</th><th>$row[Event]</th><td><pre class='jush-sql'>" . htmlspecialchars($row["Statement"]) . "</pre></td></tr>\n";
}
echo "</table>\n";
}
- mysql_free_result($result);
+ $result->free();
}
View
2 view.inc.php
@@ -1,3 +1,3 @@
<?php
page_header(lang('View') . ": " . htmlspecialchars($_GET["view"]));
-echo "<pre class='jush-sql'>" . htmlspecialchars(preg_replace('~^.* AS ~U', '', mysql_result(mysql_query("SHOW CREATE VIEW " . idf_escape($_GET["view"])), 0, 1))) . "</pre>\n";
+echo "<pre class='jush-sql'>" . htmlspecialchars(preg_replace('~^.* AS ~U', '', $mysql->result($mysql->query("SHOW CREATE VIEW " . idf_escape($_GET["view"])), 0, 1))) . "</pre>\n";

0 comments on commit ae372aa

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