Select original value

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@767 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-06-30 10:27:12 +00:00
parent fb2ff691e7
commit 543bc030f9
2 changed files with 4 additions and 3 deletions

View file

@ -67,8 +67,9 @@ if ($fields) {
echo "<table cellspacing='0'>\n"; echo "<table cellspacing='0'>\n";
foreach ($fields as $name => $field) { foreach ($fields as $name => $field) {
echo "<tr><th>" . htmlspecialchars($name) . "</th>"; echo "<tr><th>" . htmlspecialchars($name) . "</th>";
$value = (!isset($row) ? ($_POST["clone"] && $field["auto_increment"] ? "" : ($where ? $field["default"] : null)) $value = (isset($row)
: (strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set") ? intval($row[$name]) : $row[$name]) ? (strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set") ? intval($row[$name]) : $row[$name])
: ($_POST["clone"] && $field["auto_increment"] ? "" : ($where ? $field["default"] : false))
); );
input($name, $field, $value); input($name, $field, $value);
if (isset($_GET["default"]) && $field["type"] == "timestamp") { if (isset($_GET["default"]) && $field["type"] == "timestamp") {

View file

@ -43,7 +43,7 @@ function input($name, $field, $value) {
if ($field["null"] || isset($_GET["default"])) { if ($field["null"] || isset($_GET["default"])) {
array_unshift($options, "NULL"); array_unshift($options, "NULL");
} }
echo (count($options) > 1 || isset($_GET["select"]) ? '<select name="function[' . $name . ']">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') . '</option>' : '') . optionlist($options, (isset($value) ? (string) $_POST["function"][$name] : null)) . '</select>' : "&nbsp;") . '</td><td>'; echo (count($options) > 1 || isset($_GET["select"]) ? '<select name="function[' . $name . ']">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') . '</option>' : '') . optionlist($options, ($value === false ? null : (isset($value) ? (string) $_POST["function"][$name] : 'NULL'))) . '</select>' : "&nbsp;") . '</td><td>';
if ($field["type"] == "set") { //! 64 bits if ($field["type"] == "set") { //! 64 bits
preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches); preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
foreach ($matches[1] as $i => $val) { foreach ($matches[1] as $i => $val) {