Error conditions

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@504 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2008-09-30 09:40:38 +00:00
parent 1e18cd73f7
commit f384b1af87
4 changed files with 13 additions and 5 deletions

View 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];
}

View 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";
}

View 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";
}
}
}

View file

@ -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";