mirror of
https://github.com/vrana/adminer.git
synced 2025-08-13 10:04:07 +02:00
Always return array from table_status()
This commit is contained in:
@@ -357,9 +357,6 @@ if (isset($_GET["mssql"])) {
|
||||
FROM sys.all_objects AS ao
|
||||
WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V') " . ($name != "" ? "AND name = " . q($name) : "ORDER BY name")) as $row
|
||||
) {
|
||||
if ($name != "") {
|
||||
return $row;
|
||||
}
|
||||
$return[$row["Name"]] = $row;
|
||||
}
|
||||
return $return;
|
||||
@@ -662,7 +659,7 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)) as $row
|
||||
|
||||
function create_sql($table, $auto_increment, $style) {
|
||||
global $driver;
|
||||
if (is_view(table_status($table))) {
|
||||
if (is_view(table_status1($table))) {
|
||||
$view = view($table);
|
||||
return "CREATE VIEW " . table($table) . " AS $view[select]";
|
||||
}
|
||||
|
@@ -549,7 +549,7 @@ if (!defined('Adminer\DRIVER')) {
|
||||
/** Get table status
|
||||
* @param string
|
||||
* @param bool return only "Name", "Engine" and "Comment" fields
|
||||
* @return array{Name:string, Engine:string, Comment:string, Oid:int, Rows:int, Collation:string, Auto_increment:int, Data_length:int, Index_length:int, Data_free:int}[] or only inner array with $name
|
||||
* @return array{Name:string, Engine:string, Comment:string, Oid:int, Rows:int, Collation:string, Auto_increment:int, Data_length:int, Index_length:int, Data_free:int}[]
|
||||
*/
|
||||
function table_status($name = "", $fast = false) {
|
||||
$return = array();
|
||||
@@ -570,7 +570,6 @@ if (!defined('Adminer\DRIVER')) {
|
||||
if ($name != "") {
|
||||
// MariaDB: Table name is returned as lowercase on macOS, so we fix it here.
|
||||
$row["Name"] = $name;
|
||||
return $row;
|
||||
}
|
||||
$return[$row["Name"]] = $row;
|
||||
}
|
||||
|
@@ -298,9 +298,6 @@ ORDER BY 1"
|
||||
UNION SELECT view_name, 'view', 0, 0 FROM $view" . ($name != "" ? " WHERE view_name = $search" : "") . "
|
||||
ORDER BY 1") as $row
|
||||
) {
|
||||
if ($name != "") {
|
||||
return $row;
|
||||
}
|
||||
$return[$row["Name"]] = $row;
|
||||
}
|
||||
return $return;
|
||||
|
@@ -414,7 +414,7 @@ WHERE relkind IN ('r', 'm', 'v', 'f', 'p')
|
||||
) {
|
||||
$return[$row["Name"]] = $row;
|
||||
}
|
||||
return ($name != "" ? $return[$name] : $return);
|
||||
return $return;
|
||||
}
|
||||
|
||||
function is_view($table_status) {
|
||||
@@ -683,7 +683,7 @@ ORDER BY conkey, conname") as $row
|
||||
|
||||
function drop_tables($tables) {
|
||||
foreach ($tables as $table) {
|
||||
$status = table_status($table);
|
||||
$status = table_status1($table);
|
||||
if (!queries("DROP " . strtoupper($status["Engine"]) . " " . table($table))) {
|
||||
return false;
|
||||
}
|
||||
@@ -693,7 +693,7 @@ ORDER BY conkey, conname") as $row
|
||||
|
||||
function move_tables($tables, $views, $target) {
|
||||
foreach (array_merge($tables, $views) as $table) {
|
||||
$status = table_status($table);
|
||||
$status = table_status1($table);
|
||||
if (!queries("ALTER " . strtoupper($status["Engine"]) . " " . table($table) . " SET SCHEMA " . idf_escape($target))) {
|
||||
return false;
|
||||
}
|
||||
@@ -834,7 +834,7 @@ AND typelem = 0"
|
||||
function foreign_keys_sql($table) {
|
||||
$return = "";
|
||||
|
||||
$status = table_status($table);
|
||||
$status = table_status1($table);
|
||||
$fkeys = foreign_keys($table);
|
||||
ksort($fkeys);
|
||||
|
||||
@@ -850,7 +850,7 @@ AND typelem = 0"
|
||||
$return_parts = array();
|
||||
$sequences = array();
|
||||
|
||||
$status = table_status($table);
|
||||
$status = table_status1($table);
|
||||
if (is_view($status)) {
|
||||
$view = view($table);
|
||||
return rtrim("CREATE VIEW " . idf_escape($table) . " AS $view[select]", ";");
|
||||
@@ -927,7 +927,7 @@ AND typelem = 0"
|
||||
}
|
||||
|
||||
function trigger_sql($table) {
|
||||
$status = table_status($table);
|
||||
$status = table_status1($table);
|
||||
$return = "";
|
||||
foreach (triggers($table) as $trg_id => $trg) {
|
||||
$trigger = trigger($trg_id, $status['Name']);
|
||||
|
@@ -233,7 +233,7 @@ if (isset($_GET["sqlite"])) {
|
||||
foreach (get_rows("SELECT * FROM sqlite_sequence", null, "") as $row) {
|
||||
$return[$row["name"]]["Auto_increment"] = $row["seq"];
|
||||
}
|
||||
return ($name != "" ? $return[$name] : $return);
|
||||
return $return;
|
||||
}
|
||||
|
||||
function is_view($table_status) {
|
||||
|
Reference in New Issue
Block a user