@@ -57,7 +57,7 @@ TfrmEventEditor = class(TFrame)
5757 AlterCodeValid, CreateCodeValid: Boolean;
5858 function ComposeCreateStatement : String;
5959 function ComposeAlterStatement : String;
60- function ComposeBaseStatement : String;
60+ function ComposeStatement (CreateOrAlter, ObjName: String) : String;
6161 procedure UpdateSQLcode ;
6262 public
6363 { Public declarations }
@@ -258,26 +258,26 @@ function TfrmEventEditor.ApplyModifications: TModalResult;
258258
259259function TfrmEventEditor.ComposeCreateStatement : String;
260260begin
261- Result := Format(ComposeBaseStatement, [ ' CREATE' , DBObject.Connection.QuoteIdent( editName.Text)] );
261+ Result := ComposeStatement( ' CREATE' , editName.Text);
262262end ;
263263
264264
265265function TfrmEventEditor.ComposeAlterStatement : String;
266266begin
267- Result := Format(ComposeBaseStatement, [ ' ALTER' , DBObject.Connection.QuoteIdent(DBObject. Name )] );
267+ Result := ComposeStatement( ' ALTER' , DBObject.Name );
268268end ;
269269
270270
271- function TfrmEventEditor.ComposeBaseStatement : String;
271+ function TfrmEventEditor.ComposeStatement (CreateOrAlter, ObjName: String) : String;
272272var
273273 d: TDateTime;
274274 Quantity: String;
275275begin
276276 // Return CREATE EVENT statement
277- Result := ' %s ' ;
277+ Result := CreateOrAlter + ' ' ;
278278 if comboDefiner.Text <> ' ' then
279279 Result := Result + ' DEFINER=' +DBObject.Connection.QuoteIdent(comboDefiner.Text, True, ' @' )+' ' ;
280- Result := Result + ' EVENT %s ' + CRLF + #9 + ' ON SCHEDULE' + CRLF + #9 #9 ;
280+ Result := Result + ' EVENT ' + DBObject.Connection.QuoteIdent(ObjName) + CRLF + #9 + ' ON SCHEDULE' + CRLF + #9 #9 ;
281281 if radioOnce.Checked then begin
282282 d := dateOnce.DateTime;
283283 ReplaceTime(d, timeOnce.DateTime);
0 commit comments