diff --git a/adminer/create.inc.php b/adminer/create.inc.php index a9a04bde..9f41f38c 100644 --- a/adminer/create.inc.php +++ b/adminer/create.inc.php @@ -88,7 +88,6 @@ while ($row = $result->fetch_assoc()) { $engines[] = $row["Engine"]; } } -$result->free(); $row = array( "Engine" => $_COOKIE["adminer_engine"], @@ -116,7 +115,6 @@ if ($_POST) { $from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . $dbh->quote($_GET["db"]) . " AND TABLE_NAME = " . $dbh->quote($_GET["create"]); $result = $dbh->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1"); list($row["partition_by"], $row["partitions"], $row["partition"]) = $result->fetch_row(); - $result->free(); $row["partition_names"] = array(); $row["partition_values"] = array(); $result = $dbh->query("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION"); @@ -124,7 +122,6 @@ if ($_POST) { $row["partition_names"][] = $row1["PARTITION_NAME"]; $row["partition_values"][] = $row1["PARTITION_DESCRIPTION"]; } - $result->free(); $row["partition_names"][] = ""; } } diff --git a/adminer/database.inc.php b/adminer/database.inc.php index e04355bf..6563e977 100644 --- a/adminer/database.inc.php +++ b/adminer/database.inc.php @@ -24,7 +24,6 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c break; } } - $result->free(); if (!$row) { queries("DROP DATABASE " . idf_escape($_GET["db"])); } @@ -56,7 +55,6 @@ if ($_POST) { break; } } - $result->free(); } elseif (($result = $dbh->query("SHOW CREATE DATABASE " . idf_escape($_GET["db"])))) { $create = $dbh->result($result, 1); if (preg_match('~ COLLATE ([^ ]+)~', $create, $match)) { @@ -65,7 +63,6 @@ if ($_POST) { // default collation $collate = $collations[$match[1]][0]; } - $result->free(); } ?> diff --git a/adminer/db.inc.php b/adminer/db.inc.php index 1e361a98..b72a68ca 100644 --- a/adminer/db.inc.php +++ b/adminer/db.inc.php @@ -89,7 +89,6 @@ if ($dbh->server_info >= 5) { } echo "\n"; } - $result->free(); echo '

' . lang('Create procedure') . ' ' . lang('Create function') . "\n"; } @@ -106,6 +105,5 @@ if ($dbh->server_info >= 5.1 && ($result = $dbh->query("SHOW EVENTS"))) { } echo "\n"; } - $result->free(); echo '

' . lang('Create event') . "\n"; } diff --git a/adminer/dump.inc.php b/adminer/dump.inc.php index 512c7c50..f3aa6052 100644 --- a/adminer/dump.inc.php +++ b/adminer/dump.inc.php @@ -21,7 +21,6 @@ function dump_triggers($table, $style) { } echo "\nDELIMITER ;\n"; } - $result->free(); } } @@ -44,7 +43,6 @@ if ($_POST) { } $create = $dbh->result($result, 1); echo ($style == "CREATE+ALTER" ? preg_replace('~^CREATE DATABASE ~', '\\0IF NOT EXISTS ', $create) : $create) . ";\n"; - $result->free(); } if ($style && $_POST["format"] != "csv") { echo "USE " . idf_escape($db) . ";\n\n"; @@ -56,7 +54,6 @@ if ($_POST) { $out .= ($style != 'DROP+CREATE' ? "DROP $routine IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "") . $dbh->result($dbh->query("SHOW CREATE $routine " . idf_escape($row["Name"])), 2) . ";;\n\n"; } - $result->free(); } } if ($dbh->server_info >= 5.1) { @@ -65,7 +62,6 @@ if ($_POST) { $out .= ($style != 'DROP+CREATE' ? "DROP EVENT IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "") . $dbh->result($dbh->query("SHOW CREATE EVENT " . idf_escape($row["Name"])), 3) . ";;\n\n"; } - $result->free(); } echo ($out ? "DELIMITER ;;\n\n$out" . "DELIMITER ;\n\n" : ""); } @@ -130,7 +126,6 @@ while ($row = $result->fetch_assoc()) { ALTER TABLE " . idf_escape($row["TABLE_NAME"]) . " ENGINE=$row[ENGINE] COLLATE=$row[TABLE_COLLATION] COMMENT=$comment; END IF" : "BEGIN END") . ";"; } -$result->free(); ?> ELSE diff --git a/adminer/edit.inc.php b/adminer/edit.inc.php index 5dca700b..336e34a7 100644 --- a/adminer/edit.inc.php +++ b/adminer/edit.inc.php @@ -57,7 +57,6 @@ if ($_POST["save"]) { if ($select) { $result = $dbh->query("SELECT " . implode(", ", $select) . " FROM " . idf_escape($_GET["edit"]) . " WHERE $where " . (isset($_GET["select"]) ? "HAVING COUNT(*) = 1" : "LIMIT 1")); $row = $result->fetch_assoc(); - $result->free(); } } ?> diff --git a/adminer/event.inc.php b/adminer/event.inc.php index b83730f7..8a5f4e42 100644 --- a/adminer/event.inc.php +++ b/adminer/event.inc.php @@ -31,7 +31,6 @@ if ($_POST) { } elseif (strlen($_GET["event"])) { $result = $dbh->query("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = " . $dbh->quote($_GET["db"]) . " AND EVENT_NAME = " . $dbh->quote($_GET["event"])); $row = $result->fetch_assoc(); - $result->free(); } ?> diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index f7631a83..c59e45a9 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -449,7 +449,6 @@ class Adminer { echo '' . $this->tableName(array("Name" => $row[0])) . "
\n"; //! Adminer::tableName may work with full table status } } - $result->free(); } echo '

' . lang('Create new table') . "\n"; } diff --git a/adminer/include/export.inc.php b/adminer/include/export.inc.php index 6731ef2d..963cae82 100644 --- a/adminer/include/export.inc.php +++ b/adminer/include/export.inc.php @@ -13,7 +13,6 @@ function dump_table($table, $style, $is_view = false) { echo "DROP " . ($is_view ? "VIEW" : "TABLE") . " IF EXISTS " . idf_escape($table) . ";\n"; } $create = $dbh->result($result, 1); - $result->free(); echo ($style != "CREATE+ALTER" ? $create : ($is_view ? substr_replace($create, " OR REPLACE", 6, 0) : substr_replace($create, " IF NOT EXISTS", 12, 0))) . ";\n\n"; } if ($style == "CREATE+ALTER" && !$is_view) { @@ -48,7 +47,6 @@ CREATE PROCEDURE adminer_alter () BEGIN $fields[] = $row; $after = $row["COLUMN_NAME"]; } - $result->free(); ?>'; DECLARE columns CURSOR FOR ; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; @@ -142,7 +140,6 @@ function dump_data($table, $style, $select = "") { if ($_POST["format"] != "csv" && $style != "INSERT+UPDATE" && $result->num_rows) { echo ";\n"; } - $result->free(); } } } diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 2e01bda2..c2ad5fbe 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -51,7 +51,6 @@ function get_vals($query, $column = 0) { while ($row = $result->fetch_row()) { $return[] = $row[$column]; } - $result->free(); } return $return; } @@ -245,7 +244,6 @@ function select($result, $dbh2 = null) { } echo "\n"; } - $result->free(); } function is_utf8($val) { diff --git a/adminer/include/mysql.inc.php b/adminer/include/mysql.inc.php index 4c6c68ac..4cfc926d 100644 --- a/adminer/include/mysql.inc.php +++ b/adminer/include/mysql.inc.php @@ -118,8 +118,8 @@ if (extension_loaded("mysqli")) { return $row; } - function free() { - return mysql_free_result($this->_result); + function __destruct() { + mysql_free_result($this->_result); } } @@ -176,7 +176,6 @@ function table_status($name = "") { } $return[$row["Name"]] = $row; } - $result->free(); return (strlen($name) ? $return[$name] : $return); } @@ -213,7 +212,6 @@ function fields($table) { "primary" => ($row["Key"] == "PRI"), ); } - $result->free(); } return $return; } @@ -231,7 +229,6 @@ function indexes($table, $dbh2 = null) { $return[$row["Key_name"]]["columns"][$row["Seq_in_index"]] = $row["Column_name"]; $return[$row["Key_name"]]["lengths"][$row["Seq_in_index"]] = $row["Sub_part"]; } - $result->free(); } return $return; } @@ -243,7 +240,6 @@ function foreign_keys($table) { $result = $dbh->query("SHOW CREATE TABLE " . idf_escape($table)); if ($result) { $create_table = $dbh->result($result, 1); - $result->free(); preg_match_all("~CONSTRAINT `($pattern)` FOREIGN KEY \\(((?:`$pattern`,? ?)+)\\) REFERENCES `($pattern)`(?:\\.`($pattern)`)? \\(((?:`$pattern`,? ?)+)\\)(?: ON DELETE (" . implode("|", $on_actions) . "))?(?: ON UPDATE (" . implode("|", $on_actions) . "))?~", $create_table, $matches, PREG_SET_ORDER); foreach ($matches as $match) { preg_match_all("~`($pattern)`~", $match[2], $source); @@ -273,7 +269,6 @@ function collations() { while ($row = $result->fetch_assoc()) { $return[$row["Charset"]][] = $row["Collation"]; } - $result->free(); ksort($return); foreach ($return as $key => $val) { sort($return[$key]); diff --git a/adminer/include/pdo.inc.php b/adminer/include/pdo.inc.php index b6d1e5c6..e1e93bb9 100644 --- a/adminer/include/pdo.inc.php +++ b/adminer/include/pdo.inc.php @@ -78,9 +78,5 @@ if (extension_loaded('pdo')) { $row->charsetnr = (in_array("blob", $row->flags) ? 63 : 0); return $row; } - - function free() { - // $this->__destruct() is not callable - } } } diff --git a/adminer/privileges.inc.php b/adminer/privileges.inc.php index 7872147e..5107e470 100644 --- a/adminer/privileges.inc.php +++ b/adminer/privileges.inc.php @@ -22,4 +22,3 @@ while ($row = $result->fetch_assoc()) { echo '' . lang('edit') . '' . h($row["User"]) . "" . h($row["Host"]) . "\n"; } echo "\n"; -$result->free(); diff --git a/adminer/processlist.inc.php b/adminer/processlist.inc.php index 4118229f..b30640dc 100644 --- a/adminer/processlist.inc.php +++ b/adminer/processlist.inc.php @@ -22,7 +22,6 @@ for ($i=0; $row = $result->fetch_assoc(); $i++) { } echo "" . implode("", array_map('nbsp', $row)) . "\n"; } -$result->free(); ?>

diff --git a/adminer/select.inc.php b/adminer/select.inc.php index 3a8cbc58..9a7ebe9a 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -182,7 +182,6 @@ if (!$columns) { while ($row = $result->fetch_assoc()) { $rows[] = $row; } - $result->free(); // use count($rows) without LIMIT, COUNT(*) without grouping, FOUND_ROWS otherwise (slowest) $found_rows = (intval($limit) && $group && count($group) < count($select) ? $dbh->result($dbh->query(" SELECT FOUND_ROWS()")) // space to allow mysql.trace_mode diff --git a/adminer/sql.inc.php b/adminer/sql.inc.php index 16ae107a..ab0e681f 100644 --- a/adminer/sql.inc.php +++ b/adminer/sql.inc.php @@ -71,6 +71,7 @@ if (!$error && $_POST) { } echo "

" . lang('Query executed OK, %d row(s) affected.', $dbh->affected_rows) . "\n"; } + unset($result); // free resultset } while ($dbh->next_result()); } $query = substr($query, $offset); diff --git a/adminer/table.inc.php b/adminer/table.inc.php index 47c0c927..e84b980e 100644 --- a/adminer/table.inc.php +++ b/adminer/table.inc.php @@ -18,7 +18,6 @@ if ($result) { echo "\n"; } echo "\n"; - $result->free(); echo "

"; if ($is_view) { @@ -74,7 +73,6 @@ if ($result) { } echo "\n"; } - $result->free(); echo '

' . lang('Add trigger') . "\n"; } } diff --git a/adminer/trigger.inc.php b/adminer/trigger.inc.php index 3bc6cbba..b01b66fd 100644 --- a/adminer/trigger.inc.php +++ b/adminer/trigger.inc.php @@ -22,7 +22,6 @@ if ($_POST) { } elseif (strlen($_GET["name"])) { $result = $dbh->query("SHOW TRIGGERS WHERE `Trigger` = " . $dbh->quote($_GET["name"])); $row = $result->fetch_assoc(); - $result->free(); } ?> diff --git a/adminer/user.inc.php b/adminer/user.inc.php index ff09ca1f..6e25ee5b 100644 --- a/adminer/user.inc.php +++ b/adminer/user.inc.php @@ -6,7 +6,6 @@ while ($row = $result->fetch_assoc()) { $privileges[$context][$row["Privilege"]] = $row["Comment"]; } } -$result->free(); $privileges["Server Admin"] += $privileges["File access on server"]; $privileges["Databases"]["Create routine"] = $privileges["Procedures"]["Create routine"]; // MySQL bug #30305 unset($privileges["Procedures"]["Create routine"]); @@ -55,7 +54,6 @@ if (isset($_GET["host"]) && ($result = $dbh->query("SHOW GRANTS FOR " . $dbh->qu $old_pass = $match[1]; } } - $result->free(); } if ($_POST && !$error) { diff --git a/adminer/variables.inc.php b/adminer/variables.inc.php index b1cdda0f..a977b986 100644 --- a/adminer/variables.inc.php +++ b/adminer/variables.inc.php @@ -8,5 +8,4 @@ while ($row = $result->fetch_assoc()) { echo "" . h($row["Variable_name"]) . ""; echo "" . nbsp($row["Value"]); } -$result->free(); echo "\n"; diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index feb73935..ec0370e1 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -56,7 +56,6 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5 while ($row = $result->fetch_assoc()) { $return[$row["TABLE_NAME"]][$row["CONSTRAINT_NAME"]][$row["COLUMN_NAME"]] = $row["REFERENCED_COLUMN_NAME"]; } - $result->free(); } return $return; } @@ -95,7 +94,6 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5 while ($row = $result->fetch_row()) { $descriptions[$row[0]] = $row[1]; } - $result->free(); // use the descriptions foreach ($rows as $n => $row) { $return[$n][$key] = $descriptions[$row[$key]]; @@ -274,7 +272,6 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5 $sent++; } } - $result->free(); } redirect(remove_from_uri(), lang('%d e-mail(s) have been sent.', $sent)); } @@ -306,7 +303,6 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5 while ($row = $result->fetch_row()) { $return[$row[0]] = $row[1]; } - $result->free(); return "" . optionlist($return, $value, true) . ""; } } diff --git a/editor/include/export.inc.php b/editor/include/export.inc.php index b04e6cc8..cc52b224 100644 --- a/editor/include/export.inc.php +++ b/editor/include/export.inc.php @@ -10,7 +10,6 @@ function dump_data($table, $style, $select = "") { while ($row = $result->fetch_assoc()) { dump_csv($row); } - $result->free(); } }