1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 23:57:29 +02:00

Fix $result visibility

This commit is contained in:
Jakub Vrana
2025-03-11 12:53:35 +01:00
parent 5d3376e620
commit 1defc94d12
3 changed files with 19 additions and 12 deletions

View File

@@ -177,10 +177,7 @@ if (!defined('Adminer\DRIVER')) {
*/ */
function result($query, $field = 0) { function result($query, $field = 0) {
$result = $this->query($query); $result = $this->query($query);
if (!$result || !$result->num_rows) { return ($result ? $result->fetch_column($field) : false);
return false;
}
return mysql_result($result->result, 0, $field);
} }
} }
@@ -210,6 +207,14 @@ if (!defined('Adminer\DRIVER')) {
return mysql_fetch_row($this->result); return mysql_fetch_row($this->result);
} }
/** Fetch a single column
* @param int
* @return string or false if there are no rows
*/
function fetch_column($field) {
return ($this->num_rows ? mysql_result($this->result, 0, $field) : false);
}
/** Fetch next field /** Fetch next field
* @return object properties: name, type, orgtable, orgname, charsetnr * @return object properties: name, type, orgtable, orgname, charsetnr
*/ */

View File

@@ -75,10 +75,7 @@ if (isset($_GET["oracle"])) {
function result($query, $field = 0) { function result($query, $field = 0) {
$result = $this->query($query); $result = $this->query($query);
if (!is_object($result) || !oci_fetch($result->result)) { return (is_object($result) ? $result->fetch_column($field) : false);
return false;
}
return oci_result($result->result, $field + 1);
} }
} }
@@ -107,6 +104,10 @@ if (isset($_GET["oracle"])) {
return $this->convert(oci_fetch_row($this->result)); return $this->convert(oci_fetch_row($this->result));
} }
function fetch_column($field) {
return (oci_fetch($this->result) ? oci_result($this->result, $field + 1) : false);
}
function fetch_field() { function fetch_field() {
$column = $this->offset++; $column = $this->offset++;
$return = new \stdClass; $return = new \stdClass;

View File

@@ -104,10 +104,7 @@ if (isset($_GET["pgsql"])) {
function result($query, $field = 0) { function result($query, $field = 0) {
$result = $this->query($query); $result = $this->query($query);
if (!$result || !$result->num_rows) { return ($result ? $result->fetch_column($field) : false);
return false;
}
return pg_fetch_result($result->result, 0, $field);
} }
function warnings() { function warnings() {
@@ -132,6 +129,10 @@ if (isset($_GET["pgsql"])) {
return pg_fetch_row($this->result); return pg_fetch_row($this->result);
} }
function fetch_column($field) {
return ($this->num_rows ? pg_fetch_result($this->result, 0, $field) : false);
}
function fetch_field() { function fetch_field() {
$column = $this->offset++; $column = $this->offset++;
$return = new \stdClass; $return = new \stdClass;