ID #1036

I want to execute one SQL-statement only but all queries in editor-tab are executed.


The explanation probably is that the the editor tab from where you execute SQL is a "power type" editor tab. From SQLyog version 4.2 two types of editor-tabs are available.

1: The "general type" editor tab.
It functions in every respect as did the editor-pane of previous versions of SQLyog. Here you have the option to execute ONE query only, or ALL queries in the tab. Queries are divided by the ";"-character (semicolon). The option is available from main menu or by choosing the "single green arrow"-icon or the "double green arrow"-icon. You can also highlight a subset of what is written on the tab with your mouse and execute the highlighted part only. Functions keys F5 and F8 function like the "single green arrow"-icon: they execute "current query" - that is the one that the cursor is positioned in (or the subset of queries highlighted). Since SQLyog version 4.05 data in RESULT pane are editable in the same way as data in the DATA pane. But we have kept both functions keys working. However they now function totally identically.

From SQLyog version 5.0 the "general type" editor tab ALSO supports DELIMITER command, that lets you change the standard delimiter ";" (semicolon) to any other character or sequence of characters. What is in between a change-delimiter and a change-delimiter-back command is here considered ONE statement. Have a look at this SQL (and try it for yourself in the two editor-tab-types of SQLyog):

Drop procedure if exists abc;
Delimiter $$;
Create procedure abc()
Select '123';
Select '456';
Set @myvar = 'SQLyog supports MySQL version 5 objects';
Delimiter ;$$
Call abc();
Select @myvar;

This is by the editor considered as being four statements: 1) drop procedure ... 2) all what is between delimiter/delimiter-back 3) call ...4) select.

2: The "power type" editor tab.
This editor tab type was created in particular to facilitate common operations on MySQL version 5 objects. With this tab-type the only option is to execute ALL queries. The reason for that is that when "power type" editor tab is opened it starts with Delimiter $$; and ends with Delimiter ;$$ , so (following the explanation above) there is only one statement in the tab. But even if you add statements yourself outside the change-delimiter and a change-delimiter-back it still is the only option to execute everything on the tab. We kept it that way to avoid ambiguities.

Also read this to understand the difference in using DELIMITER-change from command-line and from SQLyog editor.


Tags: -

Related entries:

You can comment this FAQ