mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 22:56:46 +02:00
Notices: Declare properties in fetch_field()
This commit is contained in:
@@ -140,8 +140,8 @@ if (isset($_GET["mssql"])) {
|
|||||||
$field = $this->fields[$this->offset++];
|
$field = $this->fields[$this->offset++];
|
||||||
$return = new \stdClass;
|
$return = new \stdClass;
|
||||||
$return->name = $field["Name"];
|
$return->name = $field["Name"];
|
||||||
$return->orgname = $field["Name"];
|
|
||||||
$return->type = ($field["Type"] == 1 ? 254 : 0);
|
$return->type = ($field["Type"] == 1 ? 254 : 0);
|
||||||
|
$return->charsetnr = 0;
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -219,12 +219,11 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Fetch next field
|
/** Fetch next field
|
||||||
* @return object properties: name, type, orgtable, orgname, charsetnr
|
* @return object properties: name, type (9 for number, 254 for char), charsetnr (63 for binary); optionally: table, orgtable, orgname
|
||||||
*/
|
*/
|
||||||
function fetch_field() {
|
function fetch_field() {
|
||||||
$return = mysql_fetch_field($this->result, $this->offset++); // offset required under certain conditions
|
$return = mysql_fetch_field($this->result, $this->offset++); // offset required under certain conditions
|
||||||
$return->orgtable = $return->table;
|
$return->orgtable = $return->table;
|
||||||
$return->orgname = $return->name;
|
|
||||||
$return->charsetnr = ($return->blob ? 63 : 0);
|
$return->charsetnr = ($return->blob ? 63 : 0);
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@@ -112,8 +112,7 @@ if (isset($_GET["oracle"])) {
|
|||||||
$column = $this->offset++;
|
$column = $this->offset++;
|
||||||
$return = new \stdClass;
|
$return = new \stdClass;
|
||||||
$return->name = oci_field_name($this->result, $column);
|
$return->name = oci_field_name($this->result, $column);
|
||||||
$return->orgname = $return->name;
|
$return->type = oci_field_type($this->result, $column); //! map to MySQL numbers
|
||||||
$return->type = oci_field_type($this->result, $column);
|
|
||||||
$return->charsetnr = (preg_match("~raw|blob|bfile~", $return->type) ? 63 : 0); // 63 - binary
|
$return->charsetnr = (preg_match("~raw|blob|bfile~", $return->type) ? 63 : 0); // 63 - binary
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@@ -133,12 +133,9 @@ if (isset($_GET["pgsql"])) {
|
|||||||
function fetch_field() {
|
function fetch_field() {
|
||||||
$column = $this->offset++;
|
$column = $this->offset++;
|
||||||
$return = new \stdClass;
|
$return = new \stdClass;
|
||||||
if (function_exists('pg_field_table')) {
|
$return->orgtable = pg_field_table($this->result, $column);
|
||||||
$return->orgtable = pg_field_table($this->result, $column);
|
|
||||||
}
|
|
||||||
$return->name = pg_field_name($this->result, $column);
|
$return->name = pg_field_name($this->result, $column);
|
||||||
$return->orgname = $return->name;
|
$return->type = pg_field_type($this->result, $column); //! map to MySQL numbers
|
||||||
$return->type = pg_field_type($this->result, $column);
|
|
||||||
$return->charsetnr = ($return->type == "bytea" ? 63 : 0); // 63 - binary
|
$return->charsetnr = ($return->type == "bytea" ? 63 : 0); // 63 - binary
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@@ -70,7 +70,7 @@ if (isset($_GET["sqlite"])) {
|
|||||||
|
|
||||||
function fetch_field() {
|
function fetch_field() {
|
||||||
$column = $this->offset++;
|
$column = $this->offset++;
|
||||||
$type = $this->result->columnType($column);
|
$type = $this->result->columnType($column); //! map to MySQL numbers
|
||||||
return (object) array(
|
return (object) array(
|
||||||
"name" => $this->result->columnName($column),
|
"name" => $this->result->columnName($column),
|
||||||
"type" => $type,
|
"type" => $type,
|
||||||
|
@@ -25,12 +25,14 @@ function select($result, $connection2 = null, $orgtables = array(), $limit = 0)
|
|||||||
for ($j=0; $j < count($row); $j++) {
|
for ($j=0; $j < count($row); $j++) {
|
||||||
$field = $result->fetch_field();
|
$field = $result->fetch_field();
|
||||||
$name = $field->name;
|
$name = $field->name;
|
||||||
$orgtable = $field->orgtable;
|
$orgtable = (isset($field->orgtable) ? $field->orgtable : "");
|
||||||
$orgname = $field->orgname;
|
$orgname = (isset($field->orgname) ? $field->orgname : $name);
|
||||||
$return[$field->table] = $orgtable;
|
|
||||||
if ($orgtables && JUSH == "sql") { // MySQL EXPLAIN
|
if ($orgtables && JUSH == "sql") { // MySQL EXPLAIN
|
||||||
$links[$j] = ($name == "table" ? "table=" : ($name == "possible_keys" ? "indexes=" : null));
|
$links[$j] = ($name == "table" ? "table=" : ($name == "possible_keys" ? "indexes=" : null));
|
||||||
} elseif ($orgtable != "") {
|
} elseif ($orgtable != "") {
|
||||||
|
if (isset($field->table)) {
|
||||||
|
$return[$field->table] = $orgtable;
|
||||||
|
}
|
||||||
if (!isset($indexes[$orgtable])) {
|
if (!isset($indexes[$orgtable])) {
|
||||||
// find primary key in each table
|
// find primary key in each table
|
||||||
$indexes[$orgtable] = array();
|
$indexes[$orgtable] = array();
|
||||||
|
@@ -93,8 +93,7 @@ if (extension_loaded('pdo')) {
|
|||||||
|
|
||||||
function fetch_field() {
|
function fetch_field() {
|
||||||
$row = (object) $this->getColumnMeta($this->_offset++);
|
$row = (object) $this->getColumnMeta($this->_offset++);
|
||||||
$row->orgtable = $row->table;
|
$row->type = $row->pdo_type; //! map to MySQL numbers
|
||||||
$row->orgname = $row->name;
|
|
||||||
$row->charsetnr = (in_array("blob", (array) $row->flags) ? 63 : 0);
|
$row->charsetnr = (in_array("blob", (array) $row->flags) ? 63 : 0);
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
@@ -125,8 +125,8 @@ if (isset($_GET["clickhouse"])) {
|
|||||||
$return = new \stdClass;
|
$return = new \stdClass;
|
||||||
if ($column < count($this->columns)) {
|
if ($column < count($this->columns)) {
|
||||||
$return->name = $this->meta[$column]['name'];
|
$return->name = $this->meta[$column]['name'];
|
||||||
$return->orgname = $return->name;
|
$return->type = $this->meta[$column]['type']; //! map to MySQL numbers
|
||||||
$return->type = $this->meta[$column]['type'];
|
$return->charsetnr = 0;
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@@ -102,9 +102,8 @@ if (isset($_GET["firebird"])) {
|
|||||||
$field = ibase_field_info($this->result, $this->offset++);
|
$field = ibase_field_info($this->result, $this->offset++);
|
||||||
return (object) array(
|
return (object) array(
|
||||||
'name' => $field['name'],
|
'name' => $field['name'],
|
||||||
'orgname' => $field['name'],
|
'type' => $field['type'], //! map to MySQL numbers
|
||||||
'type' => $field['type'],
|
'charsetnr' => 0,
|
||||||
'charsetnr' => $field['length'],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -139,7 +139,7 @@ if (isset($_GET["imap"])) {
|
|||||||
function fetch_field() {
|
function fetch_field() {
|
||||||
$field = current($this->fields);
|
$field = current($this->fields);
|
||||||
next($this->fields);
|
next($this->fields);
|
||||||
return ($field != '' ? (object) array('name' => $field) : false);
|
return ($field != '' ? (object) array('name' => $field, 'type' => 0, 'charsetnr' => 0) : false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -112,6 +112,7 @@ if (isset($_GET["mongo"])) {
|
|||||||
$name = $keys[$this->offset++];
|
$name = $keys[$this->offset++];
|
||||||
return (object) array(
|
return (object) array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
|
'type' => 0,
|
||||||
'charsetnr' => $this->charset[$name],
|
'charsetnr' => $this->charset[$name],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -112,7 +112,7 @@ if (isset($_GET["simpledb"])) {
|
|||||||
|
|
||||||
function fetch_field() {
|
function fetch_field() {
|
||||||
$keys = array_keys($this->rows[0]);
|
$keys = array_keys($this->rows[0]);
|
||||||
return (object) array('name' => $keys[$this->offset++]);
|
return (object) array('name' => $keys[$this->offset++], 'type' => 0, 'charsetnr' => 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user