Toad World® Forums

[MySQL] Template editor & delimiter


#1
  1. Trigger defined for entity generates DDL which will case parsing error by MySQL. It’s because it requires delimeter changes. For example:

– Create triggers for table t_softlicences
DELIMITER $$
CREATE TRIGGER trg_softlicences_concat AFTER INSERT
ON t_softlicences
FOR EACH ROW
BEGIN
DECLARE a VARCHAR(150);

SELECT  .... **;**

END $$
DELIMITER ;

PLease note that DELIMETER command is not ended by regular delimeter character. Curent behaviour of DDL generator would add additional delimeter like this:

DELIMETER;
;

Such syntaxt will cause SQL syntax error (empty command)

Probably you can say, that I can define/change template etc. Maybe yes. But it should be defined by default, because there is no other way to create trigger with any code inside. I guess there is the same issue with functions and stored procedures.

BTW: I know I can enter full trigger def into SQL window and mark ‘Generate SQL Only’.

  1. I have problems with template editor. basicly I cannot get SAVE button. I saw it once and no one more. Just there is no option to save changes into new or edited template.
    There are also some minor problems with rescaling child windows under Win7 Aero (probably related to issue similar to reported resizing workspace one)

best regards

Edited by: Michal.K - added note about potential empty command issue after delimeter


#2

Hello Michal,

Write the DELIMITER $$ command to the Before Script section in Model | Model Properties | Before Script tab.

Then open the DDL Script Generation dialog | tab What to Generate - select the Before Script item | tab Detail Settings - write the $$ into the Terminator field.

Do you mean the Commit and Save button in Template Editor? Maybe it is connected with Windows 7 (see the http://modeling.inside.quest.com/thread.jspa?messageID=100800&tstart=0#100800 where I suggested to delete the TDM.txe file).
In any case, you can try to undock the Template Editor (press Shift and double-click the Templates tab name) and dock it back (Shift + drag and drop the dialog to the required position - on the Application Window - this is the area with all WS, all open models…)
Does it help?

Thanks.

Regards,

Vladka + TDM Team


#3

ad1. thank you. it may be a trick. However I found it quite complicated or at least not straightforward.

Please cosider adding it into TDM code. Encapsing whole procedures/functions into DELIMETER allows to write transparent code relaxing developer from thinking about technical issues.

Note that adding DELIMETER $$ before procedure and DELIMETER ; after one changes nothing to other parts of DDL. So it is safe. This aproach has been proposed by MySQL Query Browser (native MySQL application).

Best regards