1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-14 10:34:01 +02:00

Show comments at routine call (bug #874)

This commit is contained in:
Jakub Vrana
2025-02-23 16:35:11 +01:00
parent 42de70d032
commit 3ad62d55c8
3 changed files with 27 additions and 4 deletions

View File

@@ -88,3 +88,22 @@ if ($in) {
<input type="submit" value="<?php echo lang('Call'); ?>"> <input type="submit" value="<?php echo lang('Call'); ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
</form> </form>
<pre>
<?php
function pre_tr($s) {
return preg_replace('~^~m', '<tr>', preg_replace('~\|~', '<td>', preg_replace('~\|$~m', "", rtrim($s))));
}
$table = '(?:\+--[-+]+\+\n)';
$row = '(?:\| .* \|\n)';
echo
preg_replace_callback("~^($table?)($row)$table?($row*)$table?~m", function ($match) {
$first_row = pre_tr($match[2]);
return "<table>\n" . ($match[1] ? "<thead>$first_row</thead>\n" : $first_row) . pre_tr($match[3]) . "\n</table>";
},
preg_replace('~(\n( -|mysql)&gt; )(.+)~', "\\1<code class='jush-sql'>\\3</code>",
preg_replace('~(.+)\n---+\n~', "<b>\\1</b>\n",
h($routine['comment'])
)));
?>
</pre>

View File

@@ -926,11 +926,14 @@ if (!defined("DRIVER")) {
"collation" => strtolower($param[9]), "collation" => strtolower($param[9]),
); );
} }
if ($type != "FUNCTION") { $return = array(
return array("fields" => $fields, "definition" => $match[11]);
}
return array(
"fields" => $fields, "fields" => $fields,
"comment" => $connection->result("SELECT ROUTINE_COMMENT FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . q(DB) . " AND ROUTINE_NAME = " . q($name)),
);
if ($type != "FUNCTION") {
return $return + array("definition" => $match[11]);
}
return $return + array(
"returns" => array("type" => $match[12], "length" => $match[13], "unsigned" => $match[15], "collation" => $match[16]), "returns" => array("type" => $match[12], "length" => $match[13], "unsigned" => $match[15], "collation" => $match[16]),
"definition" => $match[17], "definition" => $match[17],
"language" => "SQL", // available in information_schema.ROUTINES.PARAMETER_STYLE "language" => "SQL", // available in information_schema.ROUTINES.PARAMETER_STYLE

View File

@@ -2,6 +2,7 @@ Adminer 4.17.0-dev:
Hide index column options by default Hide index column options by default
Offer original values in multi-row editing (regression from 4.16.0) Offer original values in multi-row editing (regression from 4.16.0)
MySQL, PostgreSQL, MS SQL: Support CHECK constraint MySQL, PostgreSQL, MS SQL: Support CHECK constraint
MySQL: Show comments at routine call (bug #874)
MySQL: Don't offer empty enum value in edit MySQL: Don't offer empty enum value in edit
PostgreSQL: Link user defined types PostgreSQL: Link user defined types
PostgreSQL: Constraint enum values in editing (bug #270) PostgreSQL: Constraint enum values in editing (bug #270)