mirror of
https://github.com/vrana/adminer.git
synced 2026-03-04 11:31:34 +01:00
Always return array from table_status()
This commit is contained in:
@@ -23,7 +23,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row
|
||||
$return[$row["TABLE_NAME"]]["keys"][$row["CONSTRAINT_NAME"]][$row["COLUMN_NAME"]] = $row["REFERENCED_COLUMN_NAME"];
|
||||
}
|
||||
foreach ($return as $key => $val) {
|
||||
$name = Adminer\adminer()->tableName(Adminer\table_status($key, true));
|
||||
$name = Adminer\adminer()->tableName(Adminer\table_status1($key, true));
|
||||
if ($name != "") {
|
||||
$search = preg_quote($tableName);
|
||||
$separator = '(:|\s*-)?\s+';
|
||||
|
||||
@@ -309,9 +309,6 @@ if (isset($_GET["clickhouse"])) {
|
||||
'Name' => $table['name'],
|
||||
'Engine' => $table['engine'],
|
||||
);
|
||||
if ($name === $table['name']) {
|
||||
return $return[$table['name']];
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -384,16 +384,17 @@ if (isset($_GET["elastic"])) {
|
||||
|
||||
if ($name != "") {
|
||||
if (isset($stats["indices"][$name])) {
|
||||
return format_index_status($name, $stats["indices"][$name]);
|
||||
return array(format_index_status($name, $stats["indices"][$name]));
|
||||
} else {
|
||||
foreach ($aliases as $index_name => $index) {
|
||||
foreach ($index["aliases"] as $alias_name => $alias) {
|
||||
if ($alias_name == $name) {
|
||||
return format_alias_status($alias_name, $stats["indices"][$index_name]);
|
||||
return array(format_alias_status($alias_name, $stats["indices"][$index_name]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
ksort($stats["indices"]);
|
||||
|
||||
@@ -184,16 +184,13 @@ if (isset($_GET["firebird"])) {
|
||||
function table_status($name = "", $fast = false) {
|
||||
$connection = connection();
|
||||
$return = array();
|
||||
$data = tables_list();
|
||||
$data = ($name != "" ? array($name => 1) : tables_list());
|
||||
foreach ($data as $index => $val) {
|
||||
$index = trim($index);
|
||||
$return[$index] = array(
|
||||
'Name' => $index,
|
||||
'Engine' => 'standard',
|
||||
);
|
||||
if ($name == $index) {
|
||||
return $return[$index];
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ if (isset($_GET["imap"])) {
|
||||
preg_match_all('~"uid" = (\d+)~', $query, $matches);
|
||||
return imap_delete($this->imap, implode(",", $matches[1]), FT_UID);
|
||||
} elseif (preg_match('~^SELECT COUNT\(\*\)\sFROM "(.+?)"~s', $query, $match)) {
|
||||
$status = table_status($match[1]);
|
||||
$status = table_status1($match[1]);
|
||||
return new Result(array(array($status["Rows"])));
|
||||
} elseif (preg_match('~^SELECT (.+)\sFROM "(.+?)"(?:\sWHERE "uid" = (\d+))?.*?(?:\sLIMIT (\d+)(?:\sOFFSET (\d+))?)?~s', $query, $match)) {
|
||||
list(, $columns, $table, $uid, $limit, $offset) = $match;
|
||||
@@ -233,11 +233,8 @@ if (isset($_GET["imap"])) {
|
||||
}
|
||||
|
||||
function table_status($name = "", $fast = false) {
|
||||
if ($name != "") {
|
||||
return connection()->table_status($name, $fast);
|
||||
}
|
||||
$return = array();
|
||||
foreach (tables_list() as $table => $type) {
|
||||
foreach (($name != "" ? array($name => 1) : tables_list()) as $table => $type) {
|
||||
$return[$table] = connection()->table_status($table, $fast);
|
||||
}
|
||||
return $return;
|
||||
|
||||
@@ -391,11 +391,8 @@ if (isset($_GET["mongo"])) {
|
||||
|
||||
function table_status($name = "", $fast = false) {
|
||||
$return = array();
|
||||
foreach (tables_list() as $table => $type) {
|
||||
$return[$table] = array("Name" => $table);
|
||||
if ($name == $table) {
|
||||
return $return[$table];
|
||||
}
|
||||
foreach (($name != "" ? array($name => 1) : tables_list()) as $table => $type) {
|
||||
$return[$table] = array("Name" => $table, "Engine" => "");
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -316,9 +316,6 @@ if (isset($_GET["simpledb"])) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($name != "") {
|
||||
return $row;
|
||||
}
|
||||
$return[$table] = $row;
|
||||
}
|
||||
return $return;
|
||||
|
||||
Reference in New Issue
Block a user