]> git.joonet.de Git - adminer.git/commitdiff
Error conditions
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Tue, 30 Sep 2008 09:40:38 +0000 (09:40 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Tue, 30 Sep 2008 09:40:38 +0000 (09:40 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@504 7c3ca157-0c34-0410-bff1-cbf682f78f5c

abstraction.inc.php
dump.inc.php
export.inc.php
index.php

index a02933ccd4cdefa68991520a0f9cfd8501ce1d36..a0a60b6687500a98709c542c0446af43f96d3eda 100644 (file)
@@ -19,6 +19,9 @@ if (extension_loaded("mysqli")) {
                }
                
                function result($result, $field = 0) {
+                       if (!$result) {
+                               return false;
+                       }
                        $row = $result->fetch_array();
                        return $row[$field];
                }
@@ -72,6 +75,9 @@ if (extension_loaded("mysqli")) {
                }
                
                function result($result, $field = 0) {
+                       if (!$result) {
+                               return false;
+                       }
                        return mysql_result($result->_result, 0, $field);
                }
                
@@ -160,6 +166,9 @@ if (extension_loaded("mysqli")) {
                }
                
                function result($result, $field = 0) {
+                       if (!$result) {
+                               return false;
+                       }
                        $row = $result->fetch();
                        return $row[$field];
                }
index bad01177f88fa318fa8ef16248b69f1d9b22647c..480d321a08579d48326394296e91907d2ac389f6 100644 (file)
@@ -16,7 +16,7 @@ if ($_POST) {
                echo "SET NAMES utf8;\n";
                echo "SET foreign_key_checks = 0;\n";
                echo "SET time_zone = '" . $mysql->escape_string($mysql->result($mysql->query("SELECT @@time_zone"))) . "';\n";
-               echo "SET max_allowed_packet = $max_packet, GLOBAL max_allowed_packet = $max_packet;\n";
+               echo "SET max_allowed_packet = $max_packet;\n"; // ignored because of MySQL bug #22891
                echo "\n";
        }
        
index 48794a30be73433b8c6c650eb380d01d46cb24fb..95f61ba8358dff1b0c908983905f526df99089ad 100644 (file)
@@ -32,7 +32,7 @@ function dump_table($table, $style, $is_view = false) {
                                }
                                if ($row_size > $max_packet) {
                                        $max_packet = min(1073741824, 1024 * ceil($row_size / 1024));
-                                       echo "SET max_allowed_packet = $max_packet, GLOBAL max_allowed_packet = $max_packet;\n";
+                                       echo "SET max_allowed_packet = $max_packet;\n";
                                }
                        }
                }
index 87fd6edb6aa7fa1adb9d8c2ab26fe5bd483df9a4..85067acc01e8e8060819d0ed25bb748ef2fc1774 100644 (file)
--- a/index.php
+++ b/index.php
@@ -160,7 +160,7 @@ if (isset($_GET["download"])) {
                                        echo '<tr class="nowrap"><td>' . (isset($row["Rows"]) ? '<input type="checkbox" name="tables[]" value="' . htmlspecialchars($row["Name"]) . '"' . (in_array($row["Name"], (array) $_POST["tables"], true) ? ' checked="checked"' : '') . ' /></td><th><a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a></th><td align='left'>$row[Engine]</td><td align='left'>$row[Collation]" : '&nbsp;</td><th><a href="' . htmlspecialchars($SELF) . 'view=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . '</a></th><td colspan="6">' . lang('View'));
                                        $row["count"] = $mysql->result($mysql->query("SELECT COUNT(*) FROM " . idf_escape($row["Name"])));
                                        foreach ((isset($row["Rows"]) ? array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "create") : array()) + array("count" => "select") as $key => $link) {
-                                               echo '</td><td align="right">' . (isset($row[$key]) ? '<a href="' . htmlspecialchars("$SELF$link=") . urlencode($row["Name"]) . '">' . number_format($row[$key], 0, '.', lang(',')) . '</a>' : '&nbsp;');
+                                               echo '</td><td align="right">' . (strlen($row[$key]) ? '<a href="' . htmlspecialchars("$SELF$link=") . urlencode($row["Name"]) . '">' . number_format($row[$key], 0, '.', lang(',')) . '</a>' : '&nbsp;');
                                        }
                                        echo "</td></tr>\n";
                                }
@@ -190,9 +190,8 @@ if (isset($_GET["download"])) {
                                echo '<p><a href="' . htmlspecialchars($SELF) . 'procedure=">' . lang('Create procedure') . '</a> <a href="' . htmlspecialchars($SELF) . 'function=">' . lang('Create function') . "</a></p>\n";
                        }
                        
-                       if ($mysql->server_info >= 5.1) {
+                       if ($mysql->server_info >= 5.1 && ($result = $mysql->query("SHOW EVENTS"))) {
                                echo "<h3>" . lang('Events') . "</h3>\n";
-                               $result = $mysql->query("SHOW EVENTS");
                                if ($result->num_rows) {
                                        echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
                                        echo "<thead><tr><th>" . lang('Name') . "</th><td>" . lang('Schedule') . "</td><td>" . lang('Start') . "</td><td>" . lang('End') . "</td></tr></thead>\n";