Speed up alter table form
This commit is contained in:
parent
f09003ea4b
commit
1bfffbf26b
|
@ -180,6 +180,7 @@ foreach ($engines as $engine) {
|
||||||
edit_fields($row["fields"], $collations, "TABLE", $foreign_keys);
|
edit_fields($row["fields"], $collations, "TABLE", $foreign_keys);
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
|
<?php echo script("editFields();"); ?>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
<?php echo lang('Auto Increment'); ?>: <input type="number" name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
|
<?php echo lang('Auto Increment'); ?>: <input type="number" name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
|
||||||
|
|
|
@ -177,9 +177,7 @@ 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><?php echo on_help("getTarget(event).value", 1); ?>
|
?></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
|
||||||
<?php echo script("mixin(qsl('select'), {onfocus: function () { lastType = selectValue(this); }, onchange: editingTypeChange});", ""); ?>
|
|
||||||
<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"><?php echo script("mixin(qsl('input'), {onfocus: editingLengthFocus, oninput: editingLengthChange});", ""); ?><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>' : '');
|
||||||
|
@ -296,7 +294,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
|
||||||
?>
|
?>
|
||||||
<tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
|
<tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
|
||||||
<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
|
<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
|
||||||
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name"><?php echo script("qsl('input').oninput = function () { editingNameChange.call(this);" . ($field["field"] != "" || count($fields) > 1 ? "" : " editingAddRow.call(this);") . " };", ""); ?><?php } ?>
|
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" data-maxlength="64" autocapitalize="off" aria-labelledby="label-name"><?php } ?>
|
||||||
<input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>"><?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
|
<input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>"><?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
|
||||||
<?php if ($type == "TABLE") { ?>
|
<?php if ($type == "TABLE") { ?>
|
||||||
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null"); ?>
|
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null"); ?>
|
||||||
|
|
|
@ -48,6 +48,7 @@ if (isset($_GET["function"])) {
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
|
<?php echo script("editFields();"); ?>
|
||||||
</div>
|
</div>
|
||||||
<p><?php textarea("definition", $row["definition"]); ?>
|
<p><?php textarea("definition", $row["definition"]); ?>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -207,6 +207,33 @@ function idfEscape(s) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Set up event handlers for edit_fields().
|
||||||
|
*/
|
||||||
|
function editFields() {
|
||||||
|
var els = qsa('[name$="[field]"]');
|
||||||
|
for (var i = 0; i < els.length; i++) {
|
||||||
|
els[i].oninput = function () {
|
||||||
|
editingNameChange.call(this);
|
||||||
|
if (!this.defaultValue) {
|
||||||
|
editingAddRow.call(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
els = qsa('[name$="[length]"]');
|
||||||
|
for (var i = 0; i < els.length; i++) {
|
||||||
|
mixin(els[i], {onfocus: editingLengthFocus, oninput: editingLengthChange});
|
||||||
|
}
|
||||||
|
els = qsa('[name$="[type]"]');
|
||||||
|
for (var i = 0; i < els.length; i++) {
|
||||||
|
mixin(els[i], {
|
||||||
|
onfocus: function () { lastType = selectValue(this); },
|
||||||
|
onchange: editingTypeChange,
|
||||||
|
onmouseover: function (event) { helpMouseover.call(this, event, getTarget(event).value, 1) },
|
||||||
|
onmouseout: helpMouseout
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Handle clicks on fields editing
|
/** Handle clicks on fields editing
|
||||||
* @param MouseEvent
|
* @param MouseEvent
|
||||||
* @return boolean false to cancel action
|
* @return boolean false to cancel action
|
||||||
|
@ -289,7 +316,7 @@ function editingNameChange() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add table row for next field
|
/** Add table row for next field
|
||||||
* @param boolean
|
* @param [boolean]
|
||||||
* @return boolean false
|
* @return boolean false
|
||||||
* @this HTMLInputElement
|
* @this HTMLInputElement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
Adminer 4.7.6-dev:
|
Adminer 4.7.6-dev:
|
||||||
|
Speed up alter table form (regression from 4.4.0)
|
||||||
Fix clicking on non-input fields in alter table (regression from 4.6.2)
|
Fix clicking on non-input fields in alter table (regression from 4.6.2)
|
||||||
MySQL: Always set foreign_key_checks in export
|
MySQL: Always set foreign_key_checks in export
|
||||||
Editor: Fix focusing foreign key search in select
|
Editor: Fix focusing foreign key search in select
|
||||||
|
@ -686,7 +687,7 @@ Print ALTER export instead of executing it
|
||||||
Click on row selects it
|
Click on row selects it
|
||||||
Fix Editor date format
|
Fix Editor date format
|
||||||
Fix long SQL query crash (bug #2839231)
|
Fix long SQL query crash (bug #2839231)
|
||||||
Speedup of simple alter table
|
Speed up simple alter table
|
||||||
Traditional Chinese translation
|
Traditional Chinese translation
|
||||||
|
|
||||||
Adminer 2.0.0 (released 2009-08-06):
|
Adminer 2.0.0 (released 2009-08-06):
|
||||||
|
|
Loading…
Reference in a new issue