<?php
+// This file is not used in Adminer Editor.
+
/** Print select result
* @param Min_Result
* @param Min_DB connection to examine indexes
echo "</textarea>";
}
+/** Generate HTML <select> or <input> if $options are empty
+* @param string
+* @param array
+* @param string
+* @param string
+* @param string
+* @return string
+*/
+function select_input($attrs, $options, $value = "", $onchange = "", $placeholder = "") {
+ $tag = ($options ? "select" : "input");
+ return "<$tag$attrs" . ($options
+ ? "><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>"
+ : " size='10' value='" . h($value) . "' placeholder='$placeholder'>"
+ ) . ($onchange ? script("qsl('$tag').onchange = $onchange;", "") : ""); //! use oninput for input
+}
+
+/** Print one row in JSON object
+* @param string or "" to close the object
+* @param string
+* @return null
+*/
+function json_row($key, $val = null) {
+ static $first = true;
+ if ($first) {
+ echo "{";
+ }
+ if ($key != "") {
+ echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\t\"\\/") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : 'null');
+ $first = false;
+ } else {
+ echo "\n}\n";
+ $first = true;
+ }
+}
+
/** Print table columns for type edit
* @param string
* @param array
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
}
+/** Get partition info
+* @param string
+* @return array
+*/
+function get_partitions_info($table) {
+ global $connection;
+ $from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($table);
+ $result = $connection->query("SELECT PARTITION_METHOD, PARTITION_EXPRESSION, PARTITION_ORDINAL_POSITION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
+ $return = array();
+ list($return["partition_by"], $return["partition"], $return["partitions"]) = $result->fetch_row();
+ $partitions = get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");
+ $return["partition_names"] = array_keys($partitions);
+ $return["partition_values"] = array_values($partitions);
+ return $return;
+}
+
/** Filter length value including enums
* @param string
* @return string
if ($field["on_update"]) {
$field["on_update"] = str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", $field["on_update"]);
}
-
return array(
idf_escape(trim($field["field"])),
process_type($type_field),
<?php
+// This file is used both in Adminer and Adminer Editor.
+
/** Get database connection
* @return Min_DB
*/
return $return;
}
-/** Generate HTML <select> or <input> if $options are empty
-* @param string
-* @param array
-* @param string
-* @param string
-* @param string
-* @return string
-*/
-function select_input($attrs, $options, $value = "", $onchange = "", $placeholder = "") {
- $tag = ($options ? "select" : "input");
- return "<$tag$attrs" . ($options
- ? "><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>"
- : " size='10' value='" . h($value) . "' placeholder='$placeholder'>"
- ) . ($onchange ? script("qsl('$tag').onchange = $onchange;", "") : ""); //! use oninput for input
-}
-
/** Get onclick confirmation
* @param string
* @param string
return addcslashes($string, "\r\n'\\/"); // slash for <script>
}
-/** Print one row in JSON object
-* @param string or "" to close the object
-* @param string
-* @return null
-*/
-function json_row($key, $val = null) {
- static $first = true;
- if ($first) {
- echo "{";
- }
- if ($key != "") {
- echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\t\"\\/") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : 'null');
- $first = false;
- } else {
- echo "\n}\n";
- $first = true;
- }
-}
-
/** Get INI boolean value
* @param string
* @return bool
echo ($sep ? "<p class='message'>" . lang('No tables.') : "</ul>") . "\n";
}
-/**
-* @param string
-* @return array
-*/
-function get_partitions_info($table) {
- global $connection;
- $from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($table);
- $result = $connection->query("SELECT PARTITION_METHOD, PARTITION_EXPRESSION, PARTITION_ORDINAL_POSITION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
- $info = array();
- list($info["partition_by"], $info["partition"], $info["partitions"]) = $result->fetch_row();
- $partitions = get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");
- $info["partition_names"] = array_keys($partitions);
- $info["partition_values"] = array_values($partitions);
- return $info;
-}
-
/** Send headers for export
* @param string
* @param bool
echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
} else {
echo "<table cellspacing='0' class='layout'>" . script("qsl('table').onkeydown = editingKeydown;");
-
foreach ($fields as $name => $field) {
echo "<tr><th>" . $adminer->fieldName($field);
$default = $_GET["set"][bracket_escape($name)];