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 { } else {
$result = mysql_query("SHOW DATABASES"); $result = mysql_query("SHOW DATABASES");
while ($row = mysql_fetch_assoc($result)) { 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"])) { if (mysql_select_db($row["Database"])) {
dump($row["Database"]); dump($row["Database"]);
} }

View file

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

View file

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