File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,8 @@ procedure TfrmTriggerEditor.comboDefinerDropDown(Sender: TObject);
228228
229229
230230function TfrmTriggerEditor.ApplyModifications : TModalResult;
231+ var
232+ OldCreateCode: String;
231233begin
232234 // Edit mode means we drop the trigger and recreate it, as there is no ALTER TRIGGER.
233235 Result := mrOk;
@@ -237,7 +239,9 @@ function TfrmTriggerEditor.ApplyModifications: TModalResult;
237239 // So, we take the risk of loosing the trigger for cases in which the user has SQL errors in
238240 // his statement. The user must fix such errors and re-press "Save" while we have them in memory,
239241 // otherwise the trigger attributes are lost forever.
242+ OldCreateCode := ' ' ;
240243 if ObjectExists then try
244+ OldCreateCode := DBObject.CreateCode;
241245 DBObject.Connection.Query(' DROP TRIGGER ' +DBObject.Connection.QuoteIdent(DBObject.Name ));
242246 except
243247 end ;
@@ -253,6 +257,8 @@ function TfrmTriggerEditor.ApplyModifications: TModalResult;
253257 on E:EDbError do begin
254258 ErrorDialog(E.Message);
255259 Result := mrAbort;
260+ if not OldCreateCode.IsEmpty then
261+ DBObject.Connection.Query(OldCreateCode);
256262 end ;
257263 end ;
258264end ;
You can’t perform that action at this time.
0 commit comments