Support triggers on views

This commit is contained in:
Jakub Vrana 2013-12-20 16:30:22 -08:00
parent 7d330a2d4b
commit 64af68a30b
6 changed files with 17 additions and 16 deletions

View file

@ -607,7 +607,7 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)
} }
function support($feature) { function support($feature) {
return preg_match('~^(database|table|columns|sql|indexes|scheme|trigger|view|drop_col)$~', $feature); //! routine| return preg_match('~^(columns|database|drop_col|indexes|scheme|sql|table|trigger|view|view_trigger)$~', $feature); //! routine|
} }
$jush = "mssql"; $jush = "mssql";

View file

@ -992,12 +992,12 @@ if (!defined("DRIVER")) {
} }
/** Check whether a feature is supported /** Check whether a feature is supported
* @param string "comment", "copy", "database", "drop_col", "dump", "event", "kill", "partitioning", "privileges", "procedure", "processlist", "routine", "scheme", "sequence", "status", "table", "trigger", "type", "variables", "view" * @param string "comment", "copy", "database", "drop_col", "dump", "event", "kill", "partitioning", "privileges", "procedure", "processlist", "routine", "scheme", "sequence", "status", "table", "trigger", "type", "variables", "view", "view_trigger"
* @return bool * @return bool
*/ */
function support($feature) { function support($feature) {
global $connection; global $connection;
return !preg_match("~scheme|sequence|type" . ($connection->server_info < 5.1 ? "|event|partitioning" . ($connection->server_info < 5 ? "|view|routine|trigger" : "") : "") . "~", $feature); return !preg_match("~scheme|sequence|type|view_trigger" . ($connection->server_info < 5.1 ? "|event|partitioning" . ($connection->server_info < 5 ? "|routine|trigger|view" : "") : "") . "~", $feature);
} }
$jush = "sql"; ///< @var string JUSH identifier $jush = "sql"; ///< @var string JUSH identifier

View file

@ -376,7 +376,7 @@ ORDER BY PROCESS
} }
function support($feature) { function support($feature) {
return preg_match('~^(database|table|columns|sql|indexes|view|scheme|processlist|drop_col|variables|status)$~', $feature); //! return preg_match('~^(columns|database|drop_col|indexes|processlist|scheme|sql|status|table|variables|view|view_trigger)$~', $feature); //!
} }
$jush = "oracle"; $jush = "oracle";

View file

@ -746,7 +746,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
} }
function support($feature) { function support($feature) {
return preg_match('~^(database|table|columns|sql|indexes|view|trigger|variables|status|dump|move_col|drop_col)$~', $feature); return preg_match('~^(columns|database|drop_col|dump|indexes|move_col|sql|status|table|trigger|variables|view|view_trigger)$~', $feature);
} }
$jush = "sqlite"; $jush = "sqlite";

View file

@ -71,18 +71,18 @@ if ($fields) {
echo '<p class="links"><a href="' . h(ME) . 'foreign=' . urlencode($TABLE) . '">' . lang('Add foreign key') . "</a>\n"; echo '<p class="links"><a href="' . h(ME) . 'foreign=' . urlencode($TABLE) . '">' . lang('Add foreign key') . "</a>\n";
} }
if (support("trigger")) { }
echo "<h3 id='triggers'>" . lang('Triggers') . "</h3>\n";
$triggers = triggers($TABLE); if (support(is_view($table_status) ? "view_trigger" : "trigger")) {
if ($triggers) { echo "<h3 id='triggers'>" . lang('Triggers') . "</h3>\n";
echo "<table cellspacing='0'>\n"; $triggers = triggers($TABLE);
foreach ($triggers as $key => $val) { if ($triggers) {
echo "<tr valign='top'><td>$val[0]<td>$val[1]<th>" . h($key) . "<td><a href='" . h(ME . 'trigger=' . urlencode($TABLE) . '&name=' . urlencode($key)) . "'>" . lang('Alter') . "</a>\n"; echo "<table cellspacing='0'>\n";
} foreach ($triggers as $key => $val) {
echo "</table>\n"; echo "<tr valign='top'><td>$val[0]<td>$val[1]<th>" . h($key) . "<td><a href='" . h(ME . 'trigger=' . urlencode($TABLE) . '&name=' . urlencode($key)) . "'>" . lang('Alter') . "</a>\n";
} }
echo '<p class="links"><a href="' . h(ME) . 'trigger=' . urlencode($TABLE) . '">' . lang('Add trigger') . "</a>\n"; echo "</table>\n";
} }
echo '<p class="links"><a href="' . h(ME) . 'trigger=' . urlencode($TABLE) . '">' . lang('Add trigger') . "</a>\n";
} }
} }

View file

@ -19,6 +19,7 @@ Use MD5 for editing long keys only in supported drivers, bug since Adminer 3.6.4
Don't execute external JavaScript when verifying version Don't execute external JavaScript when verifying version
Include JUSH in the compiled version Include JUSH in the compiled version
Protect CSRF token against BREACH Protect CSRF token against BREACH
Non-MySQL: View triggers
SQLite: Allow editing primary key SQLite: Allow editing primary key
SQLite: Allow editing foreign keys SQLite: Allow editing foreign keys
PostgreSQL: Fix handling of nextval() default values PostgreSQL: Fix handling of nextval() default values