mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 07:36:44 +02:00
Doc-comments: Fix type errors
This commit is contained in:
@@ -91,13 +91,13 @@ if (isset($_GET["clickhouse"])) {
|
||||
reset($this->rows);
|
||||
}
|
||||
|
||||
function fetch_assoc(): array {
|
||||
function fetch_assoc() {
|
||||
$row = current($this->rows);
|
||||
next($this->rows);
|
||||
return $row === false ? false : array_combine($this->columns, $row);
|
||||
}
|
||||
|
||||
function fetch_row(): array {
|
||||
function fetch_row() {
|
||||
$row = current($this->rows);
|
||||
next($this->rows);
|
||||
return $row;
|
||||
|
@@ -49,26 +49,19 @@ if (isset($_GET["elastic"])) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
/** Perform query relative to actual selected DB
|
||||
* @return array|false
|
||||
*/
|
||||
function query(string $path, ?array $content = null, string $method = 'GET') {
|
||||
/** Perform query relative to actual selected DB */
|
||||
function query(string $query, bool $unbuffered = false) {
|
||||
// Support for global search through all tables
|
||||
if ($path != "" && $path[0] == "S" && preg_match('/SELECT 1 FROM ([^ ]+) WHERE (.+) LIMIT ([0-9]+)/', $path, $matches)) {
|
||||
$driver = driver();
|
||||
|
||||
if ($query[0] == "S" && preg_match('/SELECT 1 FROM ([^ ]+) WHERE (.+) LIMIT ([0-9]+)/', $query, $matches)) {
|
||||
$where = explode(" AND ", $matches[2]);
|
||||
|
||||
return $driver->select($matches[1], array("*"), $where, array(), array(), $matches[3]);
|
||||
return driver()->select($matches[1], array("*"), $where, array(), array(), $matches[3]);
|
||||
}
|
||||
|
||||
return $this->rootQuery($path, $content, $method);
|
||||
}
|
||||
|
||||
function connect(string $server, string $username, string $password): bool {
|
||||
preg_match('~^(https?://)?(.*)~', $server, $match);
|
||||
$this->url = ($match[1] ?: "http://") . urlencode($username) . ":" . urlencode($password) . "@$match[2]";
|
||||
$return = $this->query('');
|
||||
$return = $this->rootQuery('');
|
||||
if ($return) {
|
||||
$this->server_info = $return['version']['number'];
|
||||
}
|
||||
@@ -94,13 +87,13 @@ if (isset($_GET["elastic"])) {
|
||||
reset($this->rows);
|
||||
}
|
||||
|
||||
function fetch_assoc(): array {
|
||||
function fetch_assoc() {
|
||||
$return = current($this->rows);
|
||||
next($this->rows);
|
||||
return $return;
|
||||
}
|
||||
|
||||
function fetch_row(): array {
|
||||
function fetch_row() {
|
||||
$row = $this->fetch_assoc();
|
||||
return $row ? array_values($row) : false;
|
||||
}
|
||||
@@ -228,7 +221,7 @@ if (isset($_GET["elastic"])) {
|
||||
$id = trim($parts[1]);
|
||||
$query = "$type/$id";
|
||||
|
||||
return $this->conn->query($query, $record, 'POST');
|
||||
return $this->conn->rootQuery($query, $record, 'POST');
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -245,7 +238,7 @@ if (isset($_GET["elastic"])) {
|
||||
unset($record[$key]);
|
||||
}
|
||||
}
|
||||
$response = $this->conn->query($query, $record, 'POST');
|
||||
$response = $this->conn->rootQuery($query, $record, 'POST');
|
||||
if ($response == false) {
|
||||
return false;
|
||||
}
|
||||
@@ -273,7 +266,7 @@ if (isset($_GET["elastic"])) {
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$query = "$table/_doc/$id";
|
||||
$response = $this->conn->query($query, null, 'DELETE');
|
||||
$response = $this->conn->rootQuery($query, null, 'DELETE');
|
||||
if (isset($response['result']) && $response['result'] == 'deleted') {
|
||||
$this->conn->affected_rows++;
|
||||
}
|
||||
@@ -532,7 +525,7 @@ if (isset($_GET["elastic"])) {
|
||||
$properties = array('properties' => $properties);
|
||||
}
|
||||
|
||||
return connection()->query("_mapping/$name", $properties, 'PUT');
|
||||
return connection()->rootQuery("_mapping/$name", $properties, 'PUT');
|
||||
}
|
||||
|
||||
/** Drop types
|
||||
@@ -541,7 +534,7 @@ if (isset($_GET["elastic"])) {
|
||||
function drop_tables(array $tables): bool {
|
||||
$return = true;
|
||||
foreach ($tables as $table) { //! convert to bulk api
|
||||
$return = $return && connection()->query(urlencode($table), null, 'DELETE');
|
||||
$return = $return && connection()->rootQuery(urlencode($table), null, 'DELETE');
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
@@ -60,11 +60,11 @@ if (isset($_GET["firebird"])) {
|
||||
// $this->num_rows = ibase_num_rows($result);
|
||||
}
|
||||
|
||||
function fetch_assoc(): array {
|
||||
function fetch_assoc() {
|
||||
return ibase_fetch_assoc($this->result);
|
||||
}
|
||||
|
||||
function fetch_row(): array {
|
||||
function fetch_row() {
|
||||
return ibase_fetch_row($this->result);
|
||||
}
|
||||
|
||||
|
@@ -123,13 +123,13 @@ if (isset($_GET["imap"])) {
|
||||
$this->fields = array_keys(idx($result, 0, array()));
|
||||
}
|
||||
|
||||
function fetch_assoc(): array {
|
||||
function fetch_assoc() {
|
||||
$row = current($this->result);
|
||||
next($this->result);
|
||||
return $row;
|
||||
}
|
||||
|
||||
function fetch_row(): array {
|
||||
function fetch_row() {
|
||||
$row = $this->fetch_assoc();
|
||||
return ($row ? array_values($row) : false);
|
||||
}
|
||||
|
@@ -97,7 +97,7 @@ if (isset($_GET["mongo"])) {
|
||||
$this->num_rows = count($this->rows);
|
||||
}
|
||||
|
||||
function fetch_assoc(): array {
|
||||
function fetch_assoc() {
|
||||
$row = current($this->rows);
|
||||
if (!$row) {
|
||||
return $row;
|
||||
@@ -110,7 +110,7 @@ if (isset($_GET["mongo"])) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
function fetch_row(): array {
|
||||
function fetch_row() {
|
||||
$return = $this->fetch_assoc();
|
||||
if (!$return) {
|
||||
return $return;
|
||||
|
@@ -76,7 +76,7 @@ if (isset($_GET["simpledb"])) {
|
||||
return (is_object($element) && $element['encoding'] == 'base64' ? base64_decode($element) : (string) $element);
|
||||
}
|
||||
|
||||
function fetch_assoc(): array {
|
||||
function fetch_assoc() {
|
||||
$row = current($this->rows);
|
||||
if (!$row) {
|
||||
return $row;
|
||||
@@ -89,7 +89,7 @@ if (isset($_GET["simpledb"])) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
function fetch_row(): array {
|
||||
function fetch_row() {
|
||||
$return = $this->fetch_assoc();
|
||||
if (!$return) {
|
||||
return $return;
|
||||
|
Reference in New Issue
Block a user