$mysql->result takes always first row
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@116 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
d433043ff7
commit
c8f50f9ad4
|
@ -13,8 +13,7 @@ if (extension_loaded("mysqli")) {
|
|||
);
|
||||
}
|
||||
|
||||
function result($result, $offset, $field = 0) {
|
||||
$result->data_seek($offset);
|
||||
function result($result, $field = 0) {
|
||||
$row = $result->fetch_array();
|
||||
return $row[$field];
|
||||
}
|
||||
|
@ -63,8 +62,8 @@ if (extension_loaded("mysqli")) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function result($result, $offset, $field = 0) {
|
||||
return mysql_result($result->_result, $offset, $field);
|
||||
function result($result, $field = 0) {
|
||||
return mysql_result($result->_result, 0, $field);
|
||||
}
|
||||
|
||||
function select_db($database) {
|
||||
|
|
|
@ -6,7 +6,7 @@ function normalize_enum($match) {
|
|||
}
|
||||
|
||||
$pattern = "\\s*(IN|OUT|INOUT)?\\s*(?:`((?:[^`]+|``)*)`\\s*|\\b(\\S+)\\s+)([a-z]+)(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(?:zerofill\\s+)?(unsigned)?";
|
||||
$create = $mysql->result($mysql->query("SHOW CREATE " . (isset($_GET["callf"]) ? "FUNCTION" : "PROCEDURE") . " " . idf_escape($_GET["call"])), 0, 2);
|
||||
$create = $mysql->result($mysql->query("SHOW CREATE " . (isset($_GET["callf"]) ? "FUNCTION" : "PROCEDURE") . " " . idf_escape($_GET["call"])), 2);
|
||||
preg_match("~\\($pattern(?:\\s*,$pattern)*~is", $create, $match);
|
||||
$in = array();
|
||||
$out = array();
|
||||
|
|
|
@ -37,7 +37,7 @@ if ($_POST) {
|
|||
$name = $_GET["db"];
|
||||
$collate = array();
|
||||
if (strlen($_GET["db"]) && ($result = $mysql->query("SHOW CREATE DATABASE " . idf_escape($_GET["db"])))) {
|
||||
if (preg_match('~ COLLATE ([^ ]+)~', $mysql->result($result, 0, 1), $match)) {
|
||||
if (preg_match('~ COLLATE ([^ ]+)~', $mysql->result($result, 1), $match)) {
|
||||
$collate = $match[1];
|
||||
}
|
||||
$result->free();
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<?php
|
||||
header("Content-Type: application/octet-stream");
|
||||
echo $mysql->result($mysql->query("SELECT " . idf_escape($_GET["field"]) . " FROM " . idf_escape($_GET["download"]) . " WHERE " . implode(" AND ", where()) . " LIMIT 1"), 0);
|
||||
echo $mysql->result($mysql->query("SELECT " . idf_escape($_GET["field"]) . " FROM " . idf_escape($_GET["download"]) . " WHERE " . implode(" AND ", where()) . " LIMIT 1"));
|
||||
|
|
|
@ -11,7 +11,7 @@ function dump($db) {
|
|||
$result = $mysql->query("SHOW $routine STATUS");
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
if (!strlen($_GET["db"]) || $row["Db"] === $_GET["db"]) {
|
||||
$routines[$row["Db"]][] = $mysql->result($mysql->query("SHOW CREATE $routine " . idf_escape($row["Db"]) . "." . idf_escape($row["Name"])), 0, 2) . ";;\n\n";
|
||||
$routines[$row["Db"]][] = $mysql->result($mysql->query("SHOW CREATE $routine " . idf_escape($row["Db"]) . "." . idf_escape($row["Name"])), 2) . ";;\n\n";
|
||||
}
|
||||
}
|
||||
$result->free();
|
||||
|
@ -21,7 +21,7 @@ function dump($db) {
|
|||
|
||||
$result = $mysql->query("SHOW CREATE DATABASE " . idf_escape($db));
|
||||
if ($result) {
|
||||
echo $mysql->result($result, 0, 1) . ";\n";
|
||||
echo $mysql->result($result, 1) . ";\n";
|
||||
$result->free();
|
||||
}
|
||||
echo "USE " . idf_escape($db) . ";\n";
|
||||
|
@ -30,7 +30,7 @@ function dump($db) {
|
|||
while ($row = $result->fetch_assoc()) {
|
||||
$result1 = $mysql->query("SHOW CREATE TABLE " . idf_escape($row["Name"]));
|
||||
if ($result1) {
|
||||
echo $mysql->result($result1, 0, 1) . ";\n";
|
||||
echo $mysql->result($result1, 1) . ";\n";
|
||||
$result1->free();
|
||||
if (isset($row["Engine"])) {
|
||||
$result1 = $mysql->query("SELECT * FROM " . idf_escape($row["Name"])); //! enum and set as numbers
|
||||
|
|
|
@ -74,7 +74,7 @@ function foreign_keys($table) {
|
|||
$return = array();
|
||||
$result = $mysql->query("SHOW CREATE TABLE " . idf_escape($table));
|
||||
if ($result) {
|
||||
$create_table = $mysql->result($result, 0, 1);
|
||||
$create_table = $mysql->result($result, 1);
|
||||
$result->free();
|
||||
preg_match_all('~FOREIGN KEY \\((.+)\\) REFERENCES (?:`(.+)`\\.)?`(.+)` \\((.+)\\)~', $create_table, $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $match) {
|
||||
|
|
|
@ -94,7 +94,7 @@ for (var i=0; <?php echo $i; ?> > i; i++) {
|
|||
if (!$result->num_rows) {
|
||||
echo "<p class='message'>" . lang('No rows.') . "</p>\n";
|
||||
} else {
|
||||
$found_rows = $mysql->result($mysql->query(" SELECT FOUND_ROWS()"), 0); // space for mysql.trace_mode
|
||||
$found_rows = $mysql->result($mysql->query(" SELECT FOUND_ROWS()")); // space for mysql.trace_mode
|
||||
$foreign_keys = array();
|
||||
foreach (foreign_keys($_GET["select"]) as $foreign_key) {
|
||||
foreach ($foreign_key[2] as $val) {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<?php
|
||||
page_header(lang('View') . ": " . htmlspecialchars($_GET["view"]));
|
||||
echo "<pre class='jush-sql'>" . htmlspecialchars(preg_replace('~^.* AS ~U', '', $mysql->result($mysql->query("SHOW CREATE VIEW " . idf_escape($_GET["view"])), 0, 1))) . "</pre>\n";
|
||||
echo "<pre class='jush-sql'>" . htmlspecialchars(preg_replace('~^.* AS ~U', '', $mysql->result($mysql->query("SHOW CREATE VIEW " . idf_escape($_GET["view"])), 1))) . "</pre>\n";
|
||||
|
|
Loading…
Reference in a new issue