Skip to content

Commit

Permalink
fixed export of triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTvrdik authored and dg committed Feb 3, 2014
1 parent db4f275 commit 10672d6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions MySQLDump.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,12 @@ public function dumpTable($handle, $table)

if ($mode & self::TRIGGERS) {
$res = $this->connection->query("SHOW TRIGGERS LIKE '" . $this->connection->real_escape_string($table) . "'");
while ($row = $res->fetch_assoc()) {
fwrite($handle, "CREATE TRIGGER {$this->delimite($row['Trigger'])} $row[Timing] $row[Event] ON $delTable FOR EACH ROW\n$row[Statement];\n\n");
if ($res->num_rows) {
fwrite($handle, "DELIMITER ;;\n\n");
while ($row = $res->fetch_assoc()) {
fwrite($handle, "CREATE TRIGGER {$this->delimite($row['Trigger'])} $row[Timing] $row[Event] ON $delTable FOR EACH ROW\n$row[Statement];;\n\n");
}
fwrite($handle, "DELIMITER ;\n\n");
}
$res->close();
}
Expand Down

0 comments on commit 10672d6

Please sign in to comment.