1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 15:47:00 +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) {
$result = $this->query($query);
if (!$result || !$result->num_rows) {
return false;
}
return mysql_result($result->result, 0, $field);
return ($result ? $result->fetch_column($field) : false);
}
}
@@ -210,6 +207,14 @@ if (!defined('Adminer\DRIVER')) {
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
* @return object properties: name, type, orgtable, orgname, charsetnr
*/

View File

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

View File

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