Respect MySQL version

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@60 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2007-07-06 09:55:51 +00:00
parent e75952cd7f
commit f32b615eba
3 changed files with 26 additions and 22 deletions

View file

@ -45,7 +45,7 @@ if (strlen($_GET["db"])) {
} else {
$result = mysql_query("SHOW DATABASES");
while ($row = mysql_fetch_assoc($result)) {
if ($row["Database"] != "information_schema") {
if ($row["Database"] != "information_schema" || mysql_get_server_info() < 5) {
if (mysql_select_db($row["Database"])) {
dump($row["Database"]);
}

View file

@ -32,21 +32,23 @@ if (isset($_GET["dump"])) {
} else {
page_header(htmlspecialchars(lang('Database') . ": " . $_GET["db"]));
echo '<p><a href="' . htmlspecialchars($SELF) . 'database=">' . lang('Alter database') . "</a></p>\n";
$result = mysql_query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '" . mysql_real_escape_string($_GET["db"]) . "'");
if (mysql_num_rows($result)) {
echo "<h2>" . lang('Routines') . "</h2>\n";
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
while ($row = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<td>" . htmlspecialchars($row["ROUTINE_TYPE"]) . "</td>";
echo "<th>" . htmlspecialchars($row["ROUTINE_NAME"]) . "</th>"; //! parameters from SHOW CREATE {PROCEDURE|FUNCTION}
echo "<td>" . nl2br(htmlspecialchars($row["ROUTINE_DEFINITION"])) . "</td>";
echo "</tr>\n";
//! call, drop, replace
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)) {
echo "<h2>" . lang('Routines') . "</h2>\n";
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
while ($row = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<td>" . htmlspecialchars($row["ROUTINE_TYPE"]) . "</td>";
echo "<th>" . htmlspecialchars($row["ROUTINE_NAME"]) . "</th>"; //! parameters from SHOW CREATE {PROCEDURE|FUNCTION}
echo "<td>" . nl2br(htmlspecialchars($row["ROUTINE_DEFINITION"])) . "</td>";
echo "</tr>\n";
//! call, drop, replace
}
echo "</table>\n";
}
echo "</table>\n";
mysql_free_result($result);
}
mysql_free_result($result);
}
page_footer();
}

View file

@ -32,13 +32,15 @@ if ($foreign_keys) {
echo "</table>\n";
}
$result = mysql_query("SHOW TRIGGERS LIKE '" . mysql_real_escape_string($_GET["table"]) . "'");
if (mysql_num_rows($result)) {
echo "<h3>" . lang('Triggers') . "</h3>\n";
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
while ($row = mysql_fetch_assoc($result)) {
echo "<tr><th>$row[Timing]</th><th>$row[Event]</th><td>" . htmlspecialchars($row["Statement"]) . "</td></tr>\n";
if (mysql_get_server_info() >= 5) {
$result = mysql_query("SHOW TRIGGERS LIKE '" . mysql_real_escape_string($_GET["table"]) . "'");
if (mysql_num_rows($result)) {
echo "<h3>" . lang('Triggers') . "</h3>\n";
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
while ($row = mysql_fetch_assoc($result)) {
echo "<tr><th>$row[Timing]</th><th>$row[Event]</th><td>" . htmlspecialchars($row["Statement"]) . "</td></tr>\n";
}
echo "</table>\n";
}
echo "</table>\n";
mysql_free_result($result);
}
mysql_free_result($result);