Prepare for call
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@78 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
430034c38a
commit
bf12723f5d
38
call.inc.php
Normal file
38
call.inc.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
mysql_result(mysql_query("SHOW CREATE " . ($_GET["type"] == "FUNCTION" ? "FUNCTION" : "PROCEDURE")), 0, 2);
|
||||
if ($_POST) {
|
||||
if (isset($_GET["function"])) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
$result = mysql_query("CALL " . idf_escape($_GET["call"])); //! params
|
||||
if ($result === true) {
|
||||
redirect(substr($SELF, 0, -1), lang('Routine has been called, %d row(s) affected.', mysql_affected_rows()));
|
||||
} elseif (!$result) {
|
||||
$error = mysql_error();
|
||||
}
|
||||
}
|
||||
|
||||
page_header(lang('Call') . ": " . htmlspecialchars($_GET["call"]));
|
||||
|
||||
if ($_POST) {
|
||||
if (!$result) {
|
||||
echo "<p class='error'>" . lang('Error during calling') . ": " . htmlspecialchars($error) . "</p>\n";
|
||||
} else {
|
||||
select($result);
|
||||
}
|
||||
}
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<?php
|
||||
if ($params) {
|
||||
echo "<table border='0' cellspacing='0' cellpadding='2'>\n";
|
||||
foreach ($params as $key => $val) {
|
||||
echo "<tr><th>" . htmlspecialchars($key) . "</th><td>" . input("param[]", $val["type"]) . "</td></tr>\n";
|
||||
}
|
||||
echo "</table>\n";
|
||||
}
|
||||
?>
|
||||
<p><input type="hidden" name="token" value="<?php echo $token; ?>" /><input type="submit" value="<?php echo lang('Call'); ?>" /></p>
|
||||
</form>
|
|
@ -37,6 +37,8 @@ if (isset($_GET["dump"])) {
|
|||
include "./indexes.inc.php";
|
||||
} elseif (isset($_GET["database"])) {
|
||||
include "./database.inc.php";
|
||||
} elseif (isset($_GET["call"])) {
|
||||
include "./call.inc.php";
|
||||
} else {
|
||||
$TOKENS = array();
|
||||
page_header(htmlspecialchars(lang('Database') . ": " . $_GET["db"]));
|
||||
|
@ -49,7 +51,7 @@ if (isset($_GET["dump"])) {
|
|||
while ($row = mysql_fetch_assoc($result)) {
|
||||
echo "<tr valign='top'>";
|
||||
echo "<th>" . htmlspecialchars($row["ROUTINE_TYPE"]) . "</th>";
|
||||
echo "<td>" . htmlspecialchars($row["ROUTINE_NAME"]) . "</td>"; //! parameters from SHOW CREATE {PROCEDURE|FUNCTION}
|
||||
echo '<td><a href="' . htmlspecialchars($SELF) . 'call=' . urlencode($row["ROUTINE_NAME"]) . ($row["ROUTINE_TYPE"] == "FUNCTION" ? '&type=FUNCTION' : '') . '">' . htmlspecialchars($row["ROUTINE_NAME"]) . '</a></td>';
|
||||
echo "<td><pre>" . htmlspecialchars($row["ROUTINE_DEFINITION"]) . "</pre></td>";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue