mirror of
https://github.com/vrana/adminer.git
synced 2025-08-29 01:00:07 +02:00
Driver specific trigger export
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1519 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -770,6 +770,24 @@ if (!defined("DRIVER")) {
|
||||
return "USE " . idf_escape($database);
|
||||
}
|
||||
|
||||
/** Get SQL commands to create triggers
|
||||
* @param string
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
function trigger_sql($table, $style) {
|
||||
global $connection;
|
||||
$result = $connection->query("SHOW TRIGGERS LIKE " . $connection->quote(addcslashes($table, "%_")));
|
||||
$return = "";
|
||||
if ($result->num_rows) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$return .= "\n" . ($style == 'CREATE+ALTER' ? "DROP TRIGGER IF EXISTS " . idf_escape($row["Trigger"]) . ";;\n" : "")
|
||||
. "CREATE TRIGGER " . idf_escape($row["Trigger"]) . " $row[Timing] $row[Event] ON " . idf_escape($row["Table"]) . " FOR EACH ROW\n$row[Statement];;\n";
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/** Get server variables
|
||||
* @return array ($name => $value)
|
||||
*/
|
||||
|
Reference in New Issue
Block a user