mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 06:37:33 +02:00
Wrap long lines
This commit is contained in:
@@ -363,7 +363,9 @@ if (isset($_GET["mssql"])) {
|
|||||||
|
|
||||||
function table_status($name = "") {
|
function table_status($name = "") {
|
||||||
$return = array();
|
$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 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) {
|
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) {
|
||||||
if ($name != "") {
|
if ($name != "") {
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
@@ -333,7 +333,15 @@ ORDER BY 1";
|
|||||||
|
|
||||||
function table_status($name = "") {
|
function table_status($name = "") {
|
||||||
$return = array();
|
$return = array();
|
||||||
foreach (get_rows("SELECT c.relname AS \"Name\", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS \"Engine\", pg_table_size(c.oid) AS \"Data_length\", pg_indexes_size(c.oid) AS \"Index_length\", obj_description(c.oid, 'pg_class') AS \"Comment\", " . (min_version(12) ? "''" : "CASE WHEN c.relhasoids THEN 'oid' ELSE '' END") . " AS \"Oid\", c.reltuples as \"Rows\", n.nspname
|
foreach (get_rows("SELECT
|
||||||
|
c.relname AS \"Name\",
|
||||||
|
CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS \"Engine\",
|
||||||
|
pg_table_size(c.oid) AS \"Data_length\",
|
||||||
|
pg_indexes_size(c.oid) AS \"Index_length\",
|
||||||
|
obj_description(c.oid, 'pg_class') AS \"Comment\",
|
||||||
|
" . (min_version(12) ? "''" : "CASE WHEN c.relhasoids THEN 'oid' ELSE '' END") . " AS \"Oid\",
|
||||||
|
c.reltuples as \"Rows\",
|
||||||
|
n.nspname
|
||||||
FROM pg_class c
|
FROM pg_class c
|
||||||
JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace)
|
JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace)
|
||||||
WHERE relkind IN ('r', 'm', 'v', 'f', 'p')
|
WHERE relkind IN ('r', 'm', 'v', 'f', 'p')
|
||||||
|
@@ -219,10 +219,18 @@ if ($foreign_keys) {
|
|||||||
$structured_types[lang('Foreign keys')] = $foreign_keys;
|
$structured_types[lang('Foreign keys')] = $foreign_keys;
|
||||||
}
|
}
|
||||||
echo optionlist(array_merge($extra_types, $structured_types), $type);
|
echo optionlist(array_merge($extra_types, $structured_types), $type);
|
||||||
?></select><td><input name="<?php echo h($key); ?>[length]" value="<?php echo h($field["length"]); ?>" size="3"<?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); //! type="number" with enabled JavaScript ?> aria-labelledby="label-length"><td class="options"><?php
|
?></select><td><input
|
||||||
|
name="<?php echo h($key); ?>[length]"
|
||||||
|
value="<?php echo h($field["length"]); ?>"
|
||||||
|
size="3"
|
||||||
|
<?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); //! type="number" with enabled JavaScript ?>
|
||||||
|
aria-labelledby="label-length"><td class="options"><?php
|
||||||
echo "<select name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
|
echo "<select name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
|
||||||
echo ($unsigned ? "<select name='" . h($key) . "[unsigned]'" . (!$type || preg_match(number_type(), $type) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
|
echo ($unsigned ? "<select name='" . h($key) . "[unsigned]'" . (!$type || preg_match(number_type(), $type) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
|
||||||
echo (isset($field['on_update']) ? "<select name='" . h($key) . "[on_update]'" . (preg_match('~timestamp|datetime~', $type) ? "" : " class='hidden'") . '>' . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), (preg_match('~^CURRENT_TIMESTAMP~i', $field["on_update"]) ? "CURRENT_TIMESTAMP" : $field["on_update"])) . '</select>' : '');
|
echo (isset($field['on_update']) ? "<select name='" . h($key) . "[on_update]'" . (preg_match('~timestamp|datetime~', $type) ? "" : " class='hidden'") . '>'
|
||||||
|
. optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), (preg_match('~^CURRENT_TIMESTAMP~i', $field["on_update"]) ? "CURRENT_TIMESTAMP" : $field["on_update"]))
|
||||||
|
. '</select>' : ''
|
||||||
|
);
|
||||||
echo ($foreign_keys ? "<select name='" . h($key) . "[on_delete]'" . (preg_match("~`~", $type) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
|
echo ($foreign_keys ? "<select name='" . h($key) . "[on_delete]'" . (preg_match("~`~", $type) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -954,7 +954,10 @@ function input($field, $value, $function) {
|
|||||||
echo "<textarea$attrs cols='50' rows='12' class='jush-js'>" . h($value) . '</textarea>';
|
echo "<textarea$attrs cols='50' rows='12' class='jush-js'>" . h($value) . '</textarea>';
|
||||||
} else {
|
} else {
|
||||||
// int(3) is only a display hint
|
// int(3) is only a display hint
|
||||||
$maxlength = (!preg_match('~int~', $field["type"]) && preg_match('~^(\d+)(,(\d+))?$~', $field["length"], $match) ? ((preg_match("~binary~", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
|
$maxlength = (!preg_match('~int~', $field["type"]) && preg_match('~^(\d+)(,(\d+))?$~', $field["length"], $match)
|
||||||
|
? ((preg_match("~binary~", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0))
|
||||||
|
: ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0)
|
||||||
|
);
|
||||||
if ($jush == 'sql' && min_version(5.6) && preg_match('~time~', $field["type"])) {
|
if ($jush == 'sql' && min_version(5.6) && preg_match('~time~', $field["type"])) {
|
||||||
$maxlength += 7; // microtime
|
$maxlength += 7; // microtime
|
||||||
}
|
}
|
||||||
|
@@ -529,7 +529,9 @@ if (!$columns && support("table")) {
|
|||||||
echo "<fieldset>";
|
echo "<fieldset>";
|
||||||
echo "<legend>" . lang('Whole result') . "</legend>";
|
echo "<legend>" . lang('Whole result') . "</legend>";
|
||||||
$display_rows = ($exact_count ? "" : "~ ") . $found_rows;
|
$display_rows = ($exact_count ? "" : "~ ") . $found_rows;
|
||||||
echo checkbox("all", 1, 0, ($found_rows !== false ? ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) : ""), "var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$display_rows' : checked); selectCount('selected2', this.checked || !checked ? '$display_rows' : checked);") . "\n";
|
echo checkbox("all", 1, 0, ($found_rows !== false ? ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) : ""),
|
||||||
|
"var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$display_rows' : checked); selectCount('selected2', this.checked || !checked ? '$display_rows' : checked);"
|
||||||
|
) . "\n";
|
||||||
echo "</fieldset>\n";
|
echo "</fieldset>\n";
|
||||||
|
|
||||||
if ($adminer->selectCommandPrint()) {
|
if ($adminer->selectCommandPrint()) {
|
||||||
|
@@ -118,7 +118,13 @@ CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
|
|||||||
echo "
|
echo "
|
||||||
WHEN " . q($row["COLUMN_NAME"]) . " THEN
|
WHEN " . q($row["COLUMN_NAME"]) . " THEN
|
||||||
SET add_columns = REPLACE(add_columns, ', ADD $row[alter]', IF(
|
SET add_columns = REPLACE(add_columns, ', ADD $row[alter]', IF(
|
||||||
_column_default <=> $row[default] AND _is_nullable = '$row[IS_NULLABLE]' AND _collation_name <=> " . (isset($row["COLLATION_NAME"]) ? "'$row[COLLATION_NAME]'" : "NULL") . " AND _column_type = " . q($row["COLUMN_TYPE"]) . " AND _extra = '$row[EXTRA]' AND _column_comment = " . q($row["COLUMN_COMMENT"]) . " AND after = $row[after]
|
_column_default <=> $row[default]
|
||||||
|
AND _is_nullable = '$row[IS_NULLABLE]'
|
||||||
|
AND _collation_name <=> " . (isset($row["COLLATION_NAME"]) ? "'$row[COLLATION_NAME]'" : "NULL") . "
|
||||||
|
AND _column_type = " . q($row["COLUMN_TYPE"]) . "
|
||||||
|
AND _extra = '$row[EXTRA]'
|
||||||
|
AND _column_comment = " . q($row["COLUMN_COMMENT"]) . "
|
||||||
|
AND after = $row[after]
|
||||||
, '', ', MODIFY $row[alter]'));"; //! don't replace in comment
|
, '', ', MODIFY $row[alter]'));"; //! don't replace in comment
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
|
Reference in New Issue
Block a user