]> git.joonet.de Git - adminer.git/commitdiff
Respect MySQL version
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 6 Jul 2007 09:55:51 +0000 (09:55 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 6 Jul 2007 09:55:51 +0000 (09:55 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@60 7c3ca157-0c34-0410-bff1-cbf682f78f5c

dump.inc.php
index.php
table.inc.php

index b7c3b53608c5e82e49b28f1fe5e9fd082d3f266a..047e01f4f58c18599d06f3a3d360e1b98c8736b3 100644 (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"]);
                        }
index 5494cab2185f41b9e239e5746dafdab992e314f9..df9b132a9d6bc8e3c9b8fffe9c4dca1ea0154a74 100644 (file)
--- a/index.php
+++ b/index.php
@@ -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();
 }
index a47a956b307a9a54d511aa17262fbe877f6e770d..79d606b1c9578e1c5f093c90dc15126b34dabb5d 100644 (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);