From f32b615eba18207763a1f065f2cde9a8520f9f53 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Fri, 6 Jul 2007 09:55:51 +0000 Subject: [PATCH] Respect MySQL version git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@60 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- dump.inc.php | 2 +- index.php | 28 +++++++++++++++------------- table.inc.php | 18 ++++++++++-------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/dump.inc.php b/dump.inc.php index b7c3b536..047e01f4 100644 --- a/dump.inc.php +++ b/dump.inc.php @@ -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"]); } diff --git a/index.php b/index.php index 5494cab2..df9b132a 100644 --- a/index.php +++ b/index.php @@ -32,21 +32,23 @@ if (isset($_GET["dump"])) { } else { page_header(htmlspecialchars(lang('Database') . ": " . $_GET["db"])); echo '

' . lang('Alter database') . "

\n"; - $result = mysql_query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '" . mysql_real_escape_string($_GET["db"]) . "'"); - if (mysql_num_rows($result)) { - echo "

" . lang('Routines') . "

\n"; - echo "\n"; - while ($row = mysql_fetch_assoc($result)) { - echo ""; - echo ""; - echo ""; //! parameters from SHOW CREATE {PROCEDURE|FUNCTION} - echo ""; - echo "\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 "

" . lang('Routines') . "

\n"; + echo "
" . htmlspecialchars($row["ROUTINE_TYPE"]) . "" . htmlspecialchars($row["ROUTINE_NAME"]) . "" . nl2br(htmlspecialchars($row["ROUTINE_DEFINITION"])) . "
\n"; + while ($row = mysql_fetch_assoc($result)) { + echo ""; + echo ""; + echo ""; //! parameters from SHOW CREATE {PROCEDURE|FUNCTION} + echo ""; + echo "\n"; + //! call, drop, replace + } + echo "
" . htmlspecialchars($row["ROUTINE_TYPE"]) . "" . htmlspecialchars($row["ROUTINE_NAME"]) . "" . nl2br(htmlspecialchars($row["ROUTINE_DEFINITION"])) . "
\n"; } - echo "\n"; + mysql_free_result($result); } - mysql_free_result($result); } page_footer(); } diff --git a/table.inc.php b/table.inc.php index a47a956b..79d606b1 100644 --- a/table.inc.php +++ b/table.inc.php @@ -32,13 +32,15 @@ if ($foreign_keys) { echo "\n"; } -$result = mysql_query("SHOW TRIGGERS LIKE '" . mysql_real_escape_string($_GET["table"]) . "'"); -if (mysql_num_rows($result)) { - echo "

" . lang('Triggers') . "

\n"; - echo "\n"; - while ($row = mysql_fetch_assoc($result)) { - echo "\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 "

" . lang('Triggers') . "

\n"; + echo "
$row[Timing]$row[Event]" . htmlspecialchars($row["Statement"]) . "
\n"; + while ($row = mysql_fetch_assoc($result)) { + echo "\n"; + } + echo "
$row[Timing]$row[Event]" . htmlspecialchars($row["Statement"]) . "
\n"; } - echo "\n"; + mysql_free_result($result); } -mysql_free_result($result);