mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 06:37:33 +02:00
Non-MySQL: Better field types in SQL command
This commit is contained in:
@@ -140,7 +140,7 @@ if (isset($_GET["mssql"])) {
|
||||
$field = $this->fields[$this->offset++];
|
||||
$return = new \stdClass;
|
||||
$return->name = $field["Name"];
|
||||
$return->type = ($field["Type"] == 1 ? 254 : 0);
|
||||
$return->type = ($field["Type"] == 1 ? 254 : 15);
|
||||
$return->charsetnr = 0;
|
||||
return $return;
|
||||
}
|
||||
|
@@ -219,7 +219,7 @@ if (!defined('Adminer\DRIVER')) {
|
||||
}
|
||||
|
||||
/** Fetch next field
|
||||
* @return object properties: name, type (9 for number, 254 for char), charsetnr (63 for binary); optionally: table, orgtable, orgname
|
||||
* @return object properties: name, type (0 number, 15 varchar, 254 char), charsetnr (63 binary); optionally: table, orgtable, orgname
|
||||
*/
|
||||
function fetch_field() {
|
||||
$return = mysql_fetch_field($this->result, $this->offset++); // offset required under certain conditions
|
||||
|
@@ -70,10 +70,10 @@ if (isset($_GET["sqlite"])) {
|
||||
|
||||
function fetch_field() {
|
||||
$column = $this->offset++;
|
||||
$type = $this->result->columnType($column); //! map to MySQL numbers
|
||||
$type = $this->result->columnType($column);
|
||||
return (object) array(
|
||||
"name" => $this->result->columnName($column),
|
||||
"type" => $type,
|
||||
"type" => ($type == SQLITE3_TEXT ? 15 : 0),
|
||||
"charsetnr" => ($type == SQLITE3_BLOB ? 63 : 0), // 63 - binary
|
||||
);
|
||||
}
|
||||
|
@@ -93,8 +93,9 @@ if (extension_loaded('pdo')) {
|
||||
|
||||
function fetch_field() {
|
||||
$row = (object) $this->getColumnMeta($this->_offset++);
|
||||
$row->type = $row->pdo_type; //! map to MySQL numbers
|
||||
$row->charsetnr = (isset($row->flags) && in_array("blob", (array) $row->flags) ? 63 : 0);
|
||||
$type = $row->pdo_type;
|
||||
$row->type = ($type == \PDO::PARAM_INT ? 0 : 15);
|
||||
$row->charsetnr = ($type == \PDO::PARAM_LOB || (isset($row->flags) && in_array("blob", (array) $row->flags)) ? 63 : 0);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
@@ -139,7 +139,7 @@ if (isset($_GET["imap"])) {
|
||||
function fetch_field() {
|
||||
$field = current($this->fields);
|
||||
next($this->fields);
|
||||
return ($field != '' ? (object) array('name' => $field, 'type' => 0, 'charsetnr' => 0) : false);
|
||||
return ($field != '' ? (object) array('name' => $field, 'type' => 15, 'charsetnr' => 0) : false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -112,7 +112,7 @@ if (isset($_GET["mongo"])) {
|
||||
$name = $keys[$this->offset++];
|
||||
return (object) array(
|
||||
'name' => $name,
|
||||
'type' => 0,
|
||||
'type' => 15,
|
||||
'charsetnr' => $this->charset[$name],
|
||||
);
|
||||
}
|
||||
|
@@ -112,7 +112,7 @@ if (isset($_GET["simpledb"])) {
|
||||
|
||||
function fetch_field() {
|
||||
$keys = array_keys($this->rows[0]);
|
||||
return (object) array('name' => $keys[$this->offset++], 'type' => 0, 'charsetnr' => 0);
|
||||
return (object) array('name' => $keys[$this->offset++], 'type' => 15, 'charsetnr' => 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user