Prepare for routines edit
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@196 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
e4d5bbd1fb
commit
1e750c4813
|
@ -135,6 +135,7 @@ function routine($name, $type) {
|
||||||
"unsigned" => strtolower(preg_replace('~\\s+~', ' ', trim("$match[7] $match[6]"))),
|
"unsigned" => strtolower(preg_replace('~\\s+~', ' ', trim("$match[7] $match[6]"))),
|
||||||
"null" => true,
|
"null" => true,
|
||||||
"inout" => strtoupper($match[1]),
|
"inout" => strtoupper($match[1]),
|
||||||
|
//! detect character set
|
||||||
);
|
);
|
||||||
$params[$i] = $field;
|
$params[$i] = $field;
|
||||||
}
|
}
|
||||||
|
@ -360,16 +361,17 @@ function process_input($name, $field) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function edit_fields($fields, $collations, $type = "table") {
|
function edit_fields($fields, $collations, $type = "TABLE") {
|
||||||
global $types, $unsigned;
|
global $types, $unsigned, $inout;
|
||||||
?>
|
?>
|
||||||
<table border="0" cellspacing="0" cellpadding="2">
|
<table border="0" cellspacing="0" cellpadding="2">
|
||||||
<thead><tr>
|
<thead><tr>
|
||||||
|
<?php if ($type == "PROCEDURE") { ?><td><?php echo lang('In-Out'); ?></td><?php } ?>
|
||||||
<th><?php echo lang('Column name'); ?></th>
|
<th><?php echo lang('Column name'); ?></th>
|
||||||
<td><?php echo lang('Type'); ?></td>
|
<td><?php echo lang('Type'); ?></td>
|
||||||
<td><?php echo lang('Length'); ?></td>
|
<td><?php echo lang('Length'); ?></td>
|
||||||
<td><?php echo lang('Options'); ?></td>
|
<td><?php echo lang('Options'); ?></td>
|
||||||
<?php if ($type == "table") { ?>
|
<?php if ($type == "TABLE") { ?>
|
||||||
<td><?php echo lang('NULL'); ?></td>
|
<td><?php echo lang('NULL'); ?></td>
|
||||||
<td><input type="radio" name="auto_increment" value="" /><?php echo lang('Auto Increment'); ?></td>
|
<td><input type="radio" name="auto_increment" value="" /><?php echo lang('Auto Increment'); ?></td>
|
||||||
<td id="comment-0"><?php echo lang('Comment'); ?></td>
|
<td id="comment-0"><?php echo lang('Comment'); ?></td>
|
||||||
|
@ -382,11 +384,12 @@ foreach ($fields as $i => $field) {
|
||||||
$i++;
|
$i++;
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
|
<?php if ($type == "PROCEDURE") { ?><td><select name="inout"><?php echo optionlist($inout, $field["inout"]); ?></select></td><?php } ?>
|
||||||
<th><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo htmlspecialchars($field[($_POST ? "orig" : "field")]); ?>" /><input name="fields[<?php echo $i; ?>][field]" value="<?php echo htmlspecialchars($field["field"]); ?>" maxlength="64" /></th>
|
<th><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo htmlspecialchars($field[($_POST ? "orig" : "field")]); ?>" /><input name="fields[<?php echo $i; ?>][field]" value="<?php echo htmlspecialchars($field["field"]); ?>" maxlength="64" /></th>
|
||||||
<td><select name="fields[<?php echo $i; ?>][type]" onchange="type_change(this);"><?php echo optionlist(array_keys($types), $field["type"]); ?></select></td>
|
<td><select name="fields[<?php echo $i; ?>][type]" onchange="type_change(this);"><?php echo optionlist(array_keys($types), $field["type"]); ?></select></td>
|
||||||
<td><input name="fields[<?php echo $i; ?>][length]" value="<?php echo htmlspecialchars($field["length"]); ?>" size="3" /></td>
|
<td><input name="fields[<?php echo $i; ?>][length]" value="<?php echo htmlspecialchars($field["length"]); ?>" size="3" /></td>
|
||||||
<td><select name="fields[<?php echo $i; ?>][collation]"><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist($collations, $field["collation"]); ?></select> <select name="fields[<?php echo $i; ?>][unsigned]"><?php echo optionlist($unsigned, $field["unsigned"]); ?></select></td>
|
<td><select name="fields[<?php echo $i; ?>][collation]"><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist($collations, $field["collation"]); ?></select> <select name="fields[<?php echo $i; ?>][unsigned]"><?php echo optionlist($unsigned, $field["unsigned"]); ?></select></td>
|
||||||
<?php if ($type == "table") { ?>
|
<?php if ($type == "TABLE") { ?>
|
||||||
<td><input type="checkbox" name="fields[<?php echo $i; ?>][null]" value="1"<?php if ($field["null"]) { ?> checked="checked"<?php } ?> /></td>
|
<td><input type="checkbox" name="fields[<?php echo $i; ?>][null]" value="1"<?php if ($field["null"]) { ?> checked="checked"<?php } ?> /></td>
|
||||||
<td><input type="radio" name="auto_increment" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked="checked"<?php } ?> /></td>
|
<td><input type="radio" name="auto_increment" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked="checked"<?php } ?> /></td>
|
||||||
<td id="comment-<?php echo $i; ?>"><input name="fields[<?php echo $i; ?>][comment]" value="<?php echo htmlspecialchars($field["comment"]); ?>" maxlength="255" /></td>
|
<td id="comment-<?php echo $i; ?>"><input name="fields[<?php echo $i; ?>][comment]" value="<?php echo htmlspecialchars($field["comment"]); ?>" maxlength="255" /></td>
|
||||||
|
|
12
index.php
12
index.php
|
@ -49,6 +49,9 @@ if (isset($_GET["dump"])) {
|
||||||
if (isset($_GET["callf"])) {
|
if (isset($_GET["callf"])) {
|
||||||
$_GET["call"] = $_GET["callf"];
|
$_GET["call"] = $_GET["callf"];
|
||||||
}
|
}
|
||||||
|
if (isset($_GET["createf"])) {
|
||||||
|
$_GET["createp"] = $_GET["createf"];
|
||||||
|
}
|
||||||
if (isset($_GET["sql"])) {
|
if (isset($_GET["sql"])) {
|
||||||
include "./sql.inc.php";
|
include "./sql.inc.php";
|
||||||
} elseif (isset($_GET["edit"])) {
|
} elseif (isset($_GET["edit"])) {
|
||||||
|
@ -65,6 +68,8 @@ if (isset($_GET["dump"])) {
|
||||||
include "./foreign.inc.php";
|
include "./foreign.inc.php";
|
||||||
} elseif (isset($_GET["createv"])) {
|
} elseif (isset($_GET["createv"])) {
|
||||||
include "./createv.inc.php";
|
include "./createv.inc.php";
|
||||||
|
} elseif (isset($_GET["createp"])) {
|
||||||
|
include "./createp.inc.php";
|
||||||
} elseif (isset($_GET["processlist"])) {
|
} elseif (isset($_GET["processlist"])) {
|
||||||
include "./processlist.inc.php";
|
include "./processlist.inc.php";
|
||||||
} else {
|
} else {
|
||||||
|
@ -72,20 +77,21 @@ if (isset($_GET["dump"])) {
|
||||||
page_header(htmlspecialchars(lang('Database') . ": " . $_GET["db"]));
|
page_header(htmlspecialchars(lang('Database') . ": " . $_GET["db"]));
|
||||||
echo '<p><a href="' . htmlspecialchars($SELF) . 'database=">' . lang('Alter database') . "</a></p>\n";
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'database=">' . lang('Alter database') . "</a></p>\n";
|
||||||
if ($mysql->server_info >= 5) {
|
if ($mysql->server_info >= 5) {
|
||||||
|
echo "<h2>" . lang('Routines') . "</h2>\n";
|
||||||
$result = $mysql->query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '" . $mysql->escape_string($_GET["db"]) . "'");
|
$result = $mysql->query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '" . $mysql->escape_string($_GET["db"]) . "'");
|
||||||
if ($result->num_rows) {
|
if ($result->num_rows) {
|
||||||
echo "<h2>" . lang('Routines') . "</h2>\n";
|
|
||||||
echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
|
echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
echo "<tr valign='top'>";
|
echo "<tr>";
|
||||||
echo "<th>" . htmlspecialchars($row["ROUTINE_TYPE"]) . "</th>";
|
echo "<th>" . htmlspecialchars($row["ROUTINE_TYPE"]) . "</th>";
|
||||||
echo '<td><a href="' . htmlspecialchars($SELF) . ($row["ROUTINE_TYPE"] == "FUNCTION" ? 'callf' : 'call') . '=' . urlencode($row["ROUTINE_NAME"]) . '">' . htmlspecialchars($row["ROUTINE_NAME"]) . '</a></td>';
|
echo '<td><a href="' . htmlspecialchars($SELF) . ($row["ROUTINE_TYPE"] == "FUNCTION" ? 'callf' : 'call') . '=' . urlencode($row["ROUTINE_NAME"]) . '">' . htmlspecialchars($row["ROUTINE_NAME"]) . '</a></td>';
|
||||||
echo "<td><pre class='jush-sql'>" . htmlspecialchars($row["ROUTINE_DEFINITION"]) . "</pre></td>";
|
echo '<td><a href="' . htmlspecialchars($SELF) . ($row["ROUTINE_TYPE"] == "FUNCTION" ? 'createf' : 'createp') . '=' . urlencode($row["ROUTINE_NAME"]) . '">' . lang('Alter') . "</a></td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
}
|
}
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
}
|
}
|
||||||
$result->free();
|
$result->free();
|
||||||
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'createp=">' . lang('Create procedure') . '</a> <a href="' . htmlspecialchars($SELF) . 'createf=">' . lang('Create function') . "</a></p>\n";
|
||||||
echo '<p><a href="' . htmlspecialchars($SELF) . 'createv=">' . lang('Create view') . "</a></p>\n";
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'createv=">' . lang('Create view') . "</a></p>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue