mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 14:46:36 +02:00
Code style: Indent long statements
This commit is contained in:
@@ -99,15 +99,17 @@ if ($adminer->homepage()) {
|
||||
echo '<td colspan="6"><a href="' . h(ME) . "view=" . urlencode($name) . '" title="' . lang('Alter view') . '">' . (preg_match('~materialized~i', $type) ? lang('Materialized view') : lang('View')) . '</a>';
|
||||
echo '<td align="right"><a href="' . h(ME) . "select=" . urlencode($name) . '" title="' . lang('Select data') . '">?</a>';
|
||||
} else {
|
||||
foreach (array(
|
||||
"Engine" => array(),
|
||||
"Collation" => array(),
|
||||
"Data_length" => array("create", lang('Alter table')),
|
||||
"Index_length" => array("indexes", lang('Alter indexes')),
|
||||
"Data_free" => array("edit", lang('New item')),
|
||||
"Auto_increment" => array("auto_increment=1&create", lang('Alter table')),
|
||||
"Rows" => array("select", lang('Select data')),
|
||||
) as $key => $link) {
|
||||
foreach (
|
||||
array(
|
||||
"Engine" => array(),
|
||||
"Collation" => array(),
|
||||
"Data_length" => array("create", lang('Alter table')),
|
||||
"Index_length" => array("indexes", lang('Alter indexes')),
|
||||
"Data_free" => array("edit", lang('New item')),
|
||||
"Auto_increment" => array("auto_increment=1&create", lang('Alter table')),
|
||||
"Rows" => array("select", lang('Select data')),
|
||||
) as $key => $link
|
||||
) {
|
||||
$id = " id='$key-" . h($name) . "'";
|
||||
echo ($link ? "<td align='right'>" . (support("table") || $key == "Rows" || (support("indexes") && $key != "Data_length")
|
||||
? "<a href='" . h(ME . "$link[0]=") . urlencode($name) . "'$id title='$link[1]'>?</a>"
|
||||
|
@@ -310,9 +310,11 @@ if (isset($_GET["mssql"])) {
|
||||
|
||||
function table_status($name = "") {
|
||||
$return = array();
|
||||
foreach (get_rows("SELECT ao.name AS Name, ao.type_desc AS Engine, (SELECT value FROM fn_listextendedproperty(default, 'SCHEMA', schema_name(schema_id), 'TABLE', ao.name, null, null)) AS Comment
|
||||
foreach (
|
||||
get_rows("SELECT ao.name AS Name, ao.type_desc AS Engine, (SELECT value FROM fn_listextendedproperty(default, 'SCHEMA', schema_name(schema_id), 'TABLE', ao.name, null, null)) AS Comment
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
@@ -366,11 +368,13 @@ WHERE o.schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND o.type IN ('S', 'U',
|
||||
function indexes($table, $connection2 = null) {
|
||||
$return = array();
|
||||
// sp_statistics doesn't return information about primary key
|
||||
foreach (get_rows("SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
|
||||
foreach (
|
||||
get_rows("SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
|
||||
FROM sys.indexes i
|
||||
INNER JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id
|
||||
INNER JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id
|
||||
WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row) {
|
||||
WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row
|
||||
) {
|
||||
$name = $row["name"];
|
||||
$return[$name]["type"] = ($row["is_primary_key"] ? "PRIMARY" : ($row["is_unique"] ? "UNIQUE" : "INDEX"));
|
||||
$return[$name]["lengths"] = array();
|
||||
@@ -492,7 +496,8 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row) {
|
||||
} elseif (!queries(($val[0] != "PRIMARY"
|
||||
? "CREATE $val[0] " . ($val[0] != "INDEX" ? "INDEX " : "") . idf_escape($val[1] != "" ? $val[1] : uniqid($table . "_")) . " ON " . table($table)
|
||||
: "ALTER TABLE " . table($table) . " ADD PRIMARY KEY"
|
||||
) . " (" . implode(", ", $val[2]) . ")")) {
|
||||
) . " (" . implode(", ", $val[2]) . ")")
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -679,12 +684,14 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)) as $row
|
||||
$on_actions = str_replace('RESTRICT|', '', $on_actions);
|
||||
$types = array();
|
||||
$structured_types = array();
|
||||
foreach (array( //! use sys.types
|
||||
lang('Numbers') => array("tinyint" => 3, "smallint" => 5, "int" => 10, "bigint" => 20, "bit" => 1, "decimal" => 0, "real" => 12, "float" => 53, "smallmoney" => 10, "money" => 20),
|
||||
lang('Date and time') => array("date" => 10, "smalldatetime" => 19, "datetime" => 19, "datetime2" => 19, "time" => 8, "datetimeoffset" => 10),
|
||||
lang('Strings') => array("char" => 8000, "varchar" => 8000, "text" => 2147483647, "nchar" => 4000, "nvarchar" => 4000, "ntext" => 1073741823),
|
||||
lang('Binary') => array("binary" => 8000, "varbinary" => 8000, "image" => 2147483647),
|
||||
) as $key => $val) {
|
||||
foreach (
|
||||
array( //! use sys.types
|
||||
lang('Numbers') => array("tinyint" => 3, "smallint" => 5, "int" => 10, "bigint" => 20, "bit" => 1, "decimal" => 0, "real" => 12, "float" => 53, "smallmoney" => 10, "money" => 20),
|
||||
lang('Date and time') => array("date" => 10, "smalldatetime" => 19, "datetime" => 19, "datetime2" => 19, "time" => 8, "datetimeoffset" => 10),
|
||||
lang('Strings') => array("char" => 8000, "varchar" => 8000, "text" => 2147483647, "nchar" => 4000, "nvarchar" => 4000, "ntext" => 1073741823),
|
||||
lang('Binary') => array("binary" => 8000, "varbinary" => 8000, "image" => 2147483647),
|
||||
) as $key => $val
|
||||
) {
|
||||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
|
@@ -876,7 +876,8 @@ if (!defined("DRIVER")) {
|
||||
$name = ($target == DB ? table("copy_$table") : idf_escape($target) . "." . table($table));
|
||||
$view = view($table);
|
||||
if (($_POST["overwrite"] && !queries("DROP VIEW IF EXISTS $name"))
|
||||
|| !queries("CREATE VIEW $name AS $view[select]")) { //! USE to avoid db.table
|
||||
|| !queries("CREATE VIEW $name AS $view[select]") //! USE to avoid db.table
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1175,14 +1176,16 @@ if (!defined("DRIVER")) {
|
||||
function driver_config() {
|
||||
$types = array(); ///< @var array [$type => $maximum_unsigned_length, ...]
|
||||
$structured_types = array(); ///< @var array [$description => [$type, ...], ...]
|
||||
foreach (array(
|
||||
lang('Numbers') => array("tinyint" => 3, "smallint" => 5, "mediumint" => 8, "int" => 10, "bigint" => 20, "decimal" => 66, "float" => 12, "double" => 21),
|
||||
lang('Date and time') => array("date" => 10, "datetime" => 19, "timestamp" => 19, "time" => 10, "year" => 4),
|
||||
lang('Strings') => array("char" => 255, "varchar" => 65535, "tinytext" => 255, "text" => 65535, "mediumtext" => 16777215, "longtext" => 4294967295),
|
||||
lang('Lists') => array("enum" => 65535, "set" => 64),
|
||||
lang('Binary') => array("bit" => 20, "binary" => 255, "varbinary" => 65535, "tinyblob" => 255, "blob" => 65535, "mediumblob" => 16777215, "longblob" => 4294967295),
|
||||
lang('Geometry') => array("geometry" => 0, "point" => 0, "linestring" => 0, "polygon" => 0, "multipoint" => 0, "multilinestring" => 0, "multipolygon" => 0, "geometrycollection" => 0),
|
||||
) as $key => $val) {
|
||||
foreach (
|
||||
array(
|
||||
lang('Numbers') => array("tinyint" => 3, "smallint" => 5, "mediumint" => 8, "int" => 10, "bigint" => 20, "decimal" => 66, "float" => 12, "double" => 21),
|
||||
lang('Date and time') => array("date" => 10, "datetime" => 19, "timestamp" => 19, "time" => 10, "year" => 4),
|
||||
lang('Strings') => array("char" => 255, "varchar" => 65535, "tinytext" => 255, "text" => 65535, "mediumtext" => 16777215, "longtext" => 4294967295),
|
||||
lang('Lists') => array("enum" => 65535, "set" => 64),
|
||||
lang('Binary') => array("bit" => 20, "binary" => 255, "varbinary" => 65535, "tinyblob" => 255, "blob" => 65535, "mediumblob" => 16777215, "longblob" => 4294967295),
|
||||
lang('Geometry') => array("geometry" => 0, "point" => 0, "linestring" => 0, "polygon" => 0, "multipoint" => 0, "multilinestring" => 0, "multipolygon" => 0, "geometrycollection" => 0),
|
||||
) as $key => $val
|
||||
) {
|
||||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
|
@@ -160,8 +160,8 @@ if (isset($_GET["oracle"])) {
|
||||
}
|
||||
}
|
||||
if (!(($where && queries("UPDATE " . table($table) . " SET " . implode(", ", $update) . " WHERE " . implode(" AND ", $where)) && $connection->affected_rows)
|
||||
|| queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")")
|
||||
)) {
|
||||
|| queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")"))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -322,12 +322,14 @@ ORDER BY 1") as $row
|
||||
function indexes($table, $connection2 = null) {
|
||||
$return = array();
|
||||
$owner = where_owner(" AND ", "aic.table_owner");
|
||||
foreach (get_rows("SELECT aic.*, ac.constraint_type, atc.data_default
|
||||
foreach (
|
||||
get_rows("SELECT aic.*, ac.constraint_type, atc.data_default
|
||||
FROM all_ind_columns aic
|
||||
LEFT JOIN all_constraints ac ON aic.index_name = ac.constraint_name AND aic.table_name = ac.table_name AND aic.index_owner = ac.owner
|
||||
LEFT JOIN all_tab_cols atc ON aic.column_name = atc.column_name AND aic.table_name = atc.table_name AND aic.index_owner = atc.owner
|
||||
WHERE aic.table_name = " . q($table) . "$owner
|
||||
ORDER BY ac.constraint_type, aic.column_position", $connection2) as $row) {
|
||||
ORDER BY ac.constraint_type, aic.column_position", $connection2) as $row
|
||||
) {
|
||||
$index_name = $row["INDEX_NAME"];
|
||||
$column_name = $row["DATA_DEFAULT"];
|
||||
$column_name = ($column_name ? trim($column_name, '"') : $row["COLUMN_NAME"]); // trim - possibly wrapped in quotes but never contains quotes inside
|
||||
@@ -521,12 +523,14 @@ ORDER BY PROCESS
|
||||
function driver_config() {
|
||||
$types = array();
|
||||
$structured_types = array();
|
||||
foreach (array(
|
||||
lang('Numbers') => array("number" => 38, "binary_float" => 12, "binary_double" => 21),
|
||||
lang('Date and time') => array("date" => 10, "timestamp" => 29, "interval year" => 12, "interval day" => 28), //! year(), day() to second()
|
||||
lang('Strings') => array("char" => 2000, "varchar2" => 4000, "nchar" => 2000, "nvarchar2" => 4000, "clob" => 4294967295, "nclob" => 4294967295),
|
||||
lang('Binary') => array("raw" => 2000, "long raw" => 2147483648, "blob" => 4294967295, "bfile" => 4294967296),
|
||||
) as $key => $val) {
|
||||
foreach (
|
||||
array(
|
||||
lang('Numbers') => array("number" => 38, "binary_float" => 12, "binary_double" => 21),
|
||||
lang('Date and time') => array("date" => 10, "timestamp" => 29, "interval year" => 12, "interval day" => 28), //! year(), day() to second()
|
||||
lang('Strings') => array("char" => 2000, "varchar2" => 4000, "nchar" => 2000, "nvarchar2" => 4000, "clob" => 4294967295, "nclob" => 4294967295),
|
||||
lang('Binary') => array("raw" => 2000, "long raw" => 2147483648, "blob" => 4294967295, "bfile" => 4294967296),
|
||||
) as $key => $val
|
||||
) {
|
||||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
|
@@ -209,8 +209,8 @@ if (isset($_GET["pgsql"])) {
|
||||
}
|
||||
}
|
||||
if (!(($where && queries("UPDATE " . table($table) . " SET " . implode(", ", $update) . " WHERE " . implode(" AND ", $where)) && $connection->affected_rows)
|
||||
|| queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")")
|
||||
)) {
|
||||
|| queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")"))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -450,11 +450,13 @@ ORDER BY a.attnum") as $row
|
||||
function foreign_keys($table) {
|
||||
global $on_actions;
|
||||
$return = array();
|
||||
foreach (get_rows("SELECT conname, condeferrable::int AS deferrable, pg_get_constraintdef(oid) AS definition
|
||||
foreach (
|
||||
get_rows("SELECT conname, condeferrable::int AS deferrable, pg_get_constraintdef(oid) AS definition
|
||||
FROM pg_constraint
|
||||
WHERE conrelid = (SELECT pc.oid FROM pg_class AS pc INNER JOIN pg_namespace AS pn ON (pn.oid = pc.relnamespace) WHERE pc.relname = " . q($table) . " AND pn.nspname = current_schema())
|
||||
AND contype = 'f'::char
|
||||
ORDER BY conkey, conname") as $row) {
|
||||
ORDER BY conkey, conname") as $row
|
||||
) {
|
||||
if (preg_match('~FOREIGN KEY\s*\((.+)\)\s*REFERENCES (.+)\((.+)\)(.*)$~iA', $row['definition'], $match)) {
|
||||
$row['source'] = array_map('Adminer\idf_unescape', array_map('trim', explode(',', $match[1])));
|
||||
if (preg_match('~^(("([^"]|"")+"|[^"]+)\.)?"?("([^"]|"")+"|[^"]+)$~', $match[2], $match2)) {
|
||||
@@ -721,11 +723,7 @@ ORDER BY SPECIFIC_NAME');
|
||||
|
||||
function found_rows($table_status, $where) {
|
||||
global $connection;
|
||||
if (preg_match(
|
||||
"~ rows=([0-9]+)~",
|
||||
$connection->result("EXPLAIN SELECT * FROM " . idf_escape($table_status["Name"]) . ($where ? " WHERE " . implode(" AND ", $where) : "")),
|
||||
$regs
|
||||
)) {
|
||||
if (preg_match("~ rows=([0-9]+)~", $connection->result("EXPLAIN SELECT * FROM " . idf_escape($table_status["Name"]) . ($where ? " WHERE " . implode(" AND ", $where) : "")), $regs)) {
|
||||
return $regs[1];
|
||||
}
|
||||
return false;
|
||||
@@ -918,14 +916,16 @@ AND typelem = 0"
|
||||
function driver_config() {
|
||||
$types = array();
|
||||
$structured_types = array();
|
||||
foreach (array( //! arrays
|
||||
lang('Numbers') => array("smallint" => 5, "integer" => 10, "bigint" => 19, "boolean" => 1, "numeric" => 0, "real" => 7, "double precision" => 16, "money" => 20),
|
||||
lang('Date and time') => array("date" => 13, "time" => 17, "timestamp" => 20, "timestamptz" => 21, "interval" => 0),
|
||||
lang('Strings') => array("character" => 0, "character varying" => 0, "text" => 0, "tsquery" => 0, "tsvector" => 0, "uuid" => 0, "xml" => 0),
|
||||
lang('Binary') => array("bit" => 0, "bit varying" => 0, "bytea" => 0),
|
||||
lang('Network') => array("cidr" => 43, "inet" => 43, "macaddr" => 17, "macaddr8" => 23, "txid_snapshot" => 0),
|
||||
lang('Geometry') => array("box" => 0, "circle" => 0, "line" => 0, "lseg" => 0, "path" => 0, "point" => 0, "polygon" => 0),
|
||||
) as $key => $val) { //! can be retrieved from pg_type
|
||||
foreach (
|
||||
array( //! arrays
|
||||
lang('Numbers') => array("smallint" => 5, "integer" => 10, "bigint" => 19, "boolean" => 1, "numeric" => 0, "real" => 7, "double precision" => 16, "money" => 20),
|
||||
lang('Date and time') => array("date" => 13, "time" => 17, "timestamp" => 20, "timestamptz" => 21, "interval" => 0),
|
||||
lang('Strings') => array("character" => 0, "character varying" => 0, "text" => 0, "tsquery" => 0, "tsvector" => 0, "uuid" => 0, "xml" => 0),
|
||||
lang('Binary') => array("bit" => 0, "bit varying" => 0, "bytea" => 0),
|
||||
lang('Network') => array("cidr" => 43, "inet" => 43, "macaddr" => 17, "macaddr8" => 23, "txid_snapshot" => 0),
|
||||
lang('Geometry') => array("box" => 0, "circle" => 0, "line" => 0, "lseg" => 0, "path" => 0, "point" => 0, "polygon" => 0),
|
||||
) as $key => $val //! can be retrieved from pg_type
|
||||
) {
|
||||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
|
@@ -23,13 +23,15 @@ if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET
|
||||
|
||||
page_header(lang('Select database'), $error, false);
|
||||
echo "<p class='links'>\n";
|
||||
foreach (array(
|
||||
'database' => lang('Create database'),
|
||||
'privileges' => lang('Privileges'),
|
||||
'processlist' => lang('Process list'),
|
||||
'variables' => lang('Variables'),
|
||||
'status' => lang('Status'),
|
||||
) as $key => $val) {
|
||||
foreach (
|
||||
array(
|
||||
'database' => lang('Create database'),
|
||||
'privileges' => lang('Privileges'),
|
||||
'processlist' => lang('Process list'),
|
||||
'variables' => lang('Variables'),
|
||||
'status' => lang('Status'),
|
||||
) as $key => $val
|
||||
) {
|
||||
if (support($key)) {
|
||||
echo "<a href='" . h(ME) . "$key='>$val</a>\n";
|
||||
}
|
||||
|
@@ -315,12 +315,14 @@ function default_value($field) {
|
||||
* @return string class=''
|
||||
*/
|
||||
function type_class($type) {
|
||||
foreach (array(
|
||||
'char' => 'text',
|
||||
'date' => 'time|year',
|
||||
'binary' => 'blob',
|
||||
'enum' => 'set',
|
||||
) as $key => $val) {
|
||||
foreach (
|
||||
array(
|
||||
'char' => 'text',
|
||||
'date' => 'time|year',
|
||||
'binary' => 'blob',
|
||||
'enum' => 'set',
|
||||
) as $key => $val
|
||||
) {
|
||||
if (preg_match("~$key|$val~", $type)) {
|
||||
return " class='$key'";
|
||||
}
|
||||
|
@@ -229,8 +229,8 @@ if (isset($rights["insert"]) || !support("table")) {
|
||||
$params = array();
|
||||
foreach ((array) $_GET["where"] as $val) {
|
||||
if (isset($foreign_keys[$val["col"]]) && count($foreign_keys[$val["col"]]) == 1
|
||||
&& ($val["op"] == "=" || (!$val["op"] && (is_array($val["val"]) || !preg_match('~[_%]~', $val["val"]))) // LIKE in Editor
|
||||
)) {
|
||||
&& ($val["op"] == "=" || (!$val["op"] && (is_array($val["val"]) || !preg_match('~[_%]~', $val["val"])))) // LIKE in Editor
|
||||
) {
|
||||
$params["set" . "[" . bracket_escape($val["col"]) . "]"] = $val["val"];
|
||||
}
|
||||
}
|
||||
|
@@ -88,8 +88,8 @@ if ($_POST && !$error) {
|
||||
}
|
||||
if (preg_match('~^(.+)\s*(\(.*\))?$~U', $object, $match) && (
|
||||
!grant("REVOKE", $revoke, $match[2], " ON $match[1] FROM $new_user") //! SQL injection
|
||||
|| !grant("GRANT", $grant, $match[2], " ON $match[1] TO $new_user")
|
||||
)) {
|
||||
|| !grant("GRANT", $grant, $match[2], " ON $match[1] TO $new_user"))
|
||||
) {
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
@@ -152,14 +152,16 @@ foreach ($grants as $object => $grant) {
|
||||
}
|
||||
echo "</thead>\n";
|
||||
|
||||
foreach (array(
|
||||
"" => "",
|
||||
"Server Admin" => lang('Server'),
|
||||
"Databases" => lang('Database'),
|
||||
"Tables" => lang('Table'),
|
||||
"Columns" => lang('Column'),
|
||||
"Procedures" => lang('Routine'),
|
||||
) as $context => $desc) {
|
||||
foreach (
|
||||
array(
|
||||
"" => "",
|
||||
"Server Admin" => lang('Server'),
|
||||
"Databases" => lang('Database'),
|
||||
"Tables" => lang('Table'),
|
||||
"Columns" => lang('Column'),
|
||||
"Procedures" => lang('Routine'),
|
||||
) as $context => $desc
|
||||
) {
|
||||
foreach ((array) $privileges[$context] as $privilege => $comment) {
|
||||
echo "<tr><td" . ($desc ? ">$desc<td" : " colspan='2'") . ' lang="en" title="' . h($comment) . '">' . h($privilege);
|
||||
$i = 0;
|
||||
|
@@ -110,12 +110,14 @@ class Adminer {
|
||||
|
||||
function backwardKeys($table, $tableName) {
|
||||
$return = array();
|
||||
foreach (get_rows("SELECT TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME, REFERENCED_COLUMN_NAME
|
||||
foreach (
|
||||
get_rows("SELECT TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME, REFERENCED_COLUMN_NAME
|
||||
FROM information_schema.KEY_COLUMN_USAGE
|
||||
WHERE TABLE_SCHEMA = " . q($this->database()) . "
|
||||
AND REFERENCED_TABLE_SCHEMA = " . q($this->database()) . "
|
||||
AND REFERENCED_TABLE_NAME = " . q($table) . "
|
||||
ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
||||
ORDER BY ORDINAL_POSITION", null, "") as $row //! requires MySQL 5
|
||||
) {
|
||||
$return[$row["TABLE_NAME"]]["keys"][$row["CONSTRAINT_NAME"]][$row["COLUMN_NAME"]] = $row["REFERENCED_COLUMN_NAME"];
|
||||
}
|
||||
foreach ($return as $key => $val) {
|
||||
|
@@ -25,7 +25,6 @@
|
||||
<exclude name="PSR12.Classes.OpeningBraceSpace.Found"/>
|
||||
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
|
||||
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
|
||||
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.CloseParenthesisLine"/>
|
||||
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine"/>
|
||||
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.LineIndent"/>
|
||||
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/><!-- Replaced by: Generic.Functions.OpeningFunctionBraceKernighanRitchie -->
|
||||
|
@@ -371,12 +371,14 @@ if (isset($_GET["clickhouse"])) {
|
||||
function driver_config() {
|
||||
$types = array();
|
||||
$structured_types = array();
|
||||
foreach (array( //! arrays
|
||||
lang('Numbers') => array("Int8" => 3, "Int16" => 5, "Int32" => 10, "Int64" => 19, "UInt8" => 3, "UInt16" => 5, "UInt32" => 10, "UInt64" => 20, "Float32" => 7, "Float64" => 16, 'Decimal' => 38, 'Decimal32' => 9, 'Decimal64' => 18, 'Decimal128' => 38),
|
||||
lang('Date and time') => array("Date" => 13, "DateTime" => 20),
|
||||
lang('Strings') => array("String" => 0),
|
||||
lang('Binary') => array("FixedString" => 0),
|
||||
) as $key => $val) {
|
||||
foreach (
|
||||
array( //! arrays
|
||||
lang('Numbers') => array("Int8" => 3, "Int16" => 5, "Int32" => 10, "Int64" => 19, "UInt8" => 3, "UInt16" => 5, "UInt32" => 10, "UInt64" => 20, "Float32" => 7, "Float64" => 16, 'Decimal' => 38, 'Decimal32' => 9, 'Decimal64' => 18, 'Decimal128' => 38),
|
||||
lang('Date and time') => array("Date" => 13, "DateTime" => 20),
|
||||
lang('Strings') => array("String" => 0),
|
||||
lang('Binary') => array("FixedString" => 0),
|
||||
) as $key => $val
|
||||
) {
|
||||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
|
@@ -559,12 +559,14 @@ if (isset($_GET["elastic"])) {
|
||||
$types = array();
|
||||
$structured_types = array();
|
||||
|
||||
foreach (array(
|
||||
lang('Numbers') => array("long" => 3, "integer" => 5, "short" => 8, "byte" => 10, "double" => 20, "float" => 66, "half_float" => 12, "scaled_float" => 21),
|
||||
lang('Date and time') => array("date" => 10),
|
||||
lang('Strings') => array("string" => 65535, "text" => 65535),
|
||||
lang('Binary') => array("binary" => 255),
|
||||
) as $key => $val) {
|
||||
foreach (
|
||||
array(
|
||||
lang('Numbers') => array("long" => 3, "integer" => 5, "short" => 8, "byte" => 10, "double" => 20, "float" => 66, "half_float" => 12, "scaled_float" => 21),
|
||||
lang('Date and time') => array("date" => 10),
|
||||
lang('Strings') => array("string" => 65535, "text" => 65535),
|
||||
lang('Binary') => array("binary" => 255),
|
||||
) as $key => $val
|
||||
) {
|
||||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
|
@@ -523,12 +523,14 @@ if (isset($_GET["elastic5"])) {
|
||||
$types = array();
|
||||
$structured_types = array();
|
||||
|
||||
foreach (array(
|
||||
lang('Numbers') => array("long" => 3, "integer" => 5, "short" => 8, "byte" => 10, "double" => 20, "float" => 66, "half_float" => 12, "scaled_float" => 21),
|
||||
lang('Date and time') => array("date" => 10),
|
||||
lang('Strings') => array("string" => 65535, "text" => 65535),
|
||||
lang('Binary') => array("binary" => 255),
|
||||
) as $key => $val) {
|
||||
foreach (
|
||||
array(
|
||||
lang('Numbers') => array("long" => 3, "integer" => 5, "short" => 8, "byte" => 10, "double" => 20, "float" => 66, "half_float" => 12, "scaled_float" => 21),
|
||||
lang('Date and time') => array("date" => 10),
|
||||
lang('Strings') => array("string" => 65535, "text" => 65535),
|
||||
lang('Binary') => array("binary" => 255),
|
||||
) as $key => $val
|
||||
) {
|
||||
$types += $val;
|
||||
$structured_types[$key] = array_keys($val);
|
||||
}
|
||||
|
@@ -297,12 +297,14 @@ if (isset($_GET["simpledb"])) {
|
||||
if (!$fast) {
|
||||
$meta = sdb_request('DomainMetadata', array('DomainName' => $table));
|
||||
if ($meta) {
|
||||
foreach (array(
|
||||
"Rows" => "ItemCount",
|
||||
"Data_length" => "ItemNamesSizeBytes",
|
||||
"Index_length" => "AttributeValuesSizeBytes",
|
||||
"Data_free" => "AttributeNamesSizeBytes",
|
||||
) as $key => $val) {
|
||||
foreach (
|
||||
array(
|
||||
"Rows" => "ItemCount",
|
||||
"Data_length" => "ItemNamesSizeBytes",
|
||||
"Index_length" => "AttributeValuesSizeBytes",
|
||||
"Data_free" => "AttributeNamesSizeBytes",
|
||||
) as $key => $val
|
||||
) {
|
||||
$row[$key] = (string) $meta->$val;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user