@@ -124,7 +124,7 @@ procedure TfrmTriggerEditor.Init(Obj: TDBObject);
124124 QuoteCharsRx := QuoteRegExprMetaChars(DBObject.Connection.QuoteChars);
125125 QuotedWordRx := ' [' +QuoteCharsRx+' ]?[^' +QuoteCharsRx+' ]+[' +QuoteCharsRx+' ]?' ;
126126 rx.Expression := ' (\sDEFINER=(' +QuotedWordRx+' @' +QuotedWordRx+' ))?' +
127- ' \s+TRIGGER\s+' +QuotedWordRx +
127+ ' \s+TRIGGER\s+(IF\s+NOT\s+EXISTS\s+)? ' +QuotedWordRx +
128128 ' \s+(' +Implode(' |' , comboTiming.Items)+' )' +
129129 ' \s+(' +Implode(' |' , comboEvent.Items)+' )' +
130130 ' \s+ON\s+(' +QuotedWordRx+' )' +
@@ -133,10 +133,10 @@ procedure TfrmTriggerEditor.Init(Obj: TDBObject);
133133 Body := DBObject.Connection.GetCreateCode(DBObject);
134134 if rx.Exec(Body) then begin
135135 comboDefiner.Text := DBObject.Connection.DeQuoteIdent(rx.Match[2 ], ' @' );
136- comboTiming.ItemIndex := comboTiming.Items.IndexOf(UpperCase(rx.Match[3 ]));
137- comboEvent.ItemIndex := comboEvent.Items.IndexOf(UpperCase(rx.Match[4 ]));
138- comboTable.ItemIndex := comboTable.Items.IndexOf(DBObject.Connection.DeQuoteIdent(rx.Match[5 ] ));
139- Body := rx.Match[6 ];
136+ comboTiming.ItemIndex := comboTiming.Items.IndexOf(UpperCase(rx.Match[4 ]));
137+ comboEvent.ItemIndex := comboEvent.Items.IndexOf(UpperCase(rx.Match[5 ]));
138+ comboTable.ItemIndex := comboTable.Items.IndexOf(DBObject.Connection.DeQuoteIdent(Trim( rx.Match[6 ]) ));
139+ Body := rx.Match[7 ];
140140 end
141141 else
142142 raise EDbError.CreateFmt(_(' Result from previous query does not contain expected pattern: %s' ), [rx.Expression]);
0 commit comments