Using WinMySQL Professional


New/Open SQL query





This menu, only enabled when connected to a database, invokes the same window for submenus «New>SQL query» and «Open>SQL query». It permits users who haven't read this manual to find any of these two features in a logic place even it is the same unit launched by WinMySQL Professional. You either can access to these features using the following shortcut : «Ctrl-S».


This menu displays the SQL query editor. It seems to be the same as WinMySQL Regular 1.1 but it is really different because it includes a script parser which allows to perform a block of queries, for instance, a script which inserts several lines in a table. So, with it, it is easy to reuse work done by someone else.


The SQL editor consists in a facsimile of terminal window with a panel including six buttons and a checkbox.



How to submit queries ?


The pseudo-terminal window is designed to enter SQL queries such as you could enter it on server with the command line client. So, it recognizes all syntaxes accepted by the server : in fact, it only sends the queries to the server without any semantic parsing. The queries are parsed by the server, not by WinMySQL Professional.


In WinMySQL Professional, queries can be written with any indentation but mustn't have any trailing semicolon characters (;).


The pseudo-terminal window synopsis is simple : you enter your SQL query and send it with the «Submit SQL» button. Then the pseudo-terminal disapears. If the submitted query generates a result, it is displayed in the output grid (then you can process it with some WinMySQL Professional features such as report, export, etc) and a returned line counter replaces the copyright bar, otherwise the number of affected lines replaces the copyright bar. If an error occurs, you receive an explicit notification.



Script support


If you want to execute several queries in one button strike, make sure that the «Script parser enabled» option is checked. Then, between each query, add a semicolon (;). When you submit, WinMySQL Professional ask if you want a pause between each query (to see the query results, for instance).


Note if any query is rejected by the server during the script execution, it aborts but queries already performed can't be canceled because MySQL® doesn't support database transactions yet. For example : you execute a script with 3 queries, the first creates a table, the two others insert a line, the second query has a syntax error, but not the third ; the real result is a table created but without any line inserted.


If you don't use the script feature, you can uncheck the «Script parser enabled» option, it will speed up complex unique queries.



Load a SQL query/Script


You can load queries (or scripts) directly clicking on the «Load SQL» button. This action clears the pseudo-terminal before inserting the query (or the script).


Default files are «*.sql » and are plain text files. Then, you can write your queries (or scripts adding a semicolon between queries) with any text editor (or word processor if you save as a text file).


With this feature, you can organize a real library of useful SQL scripts.



Save a SQL query/Script


You can save any query (or script) held in the pseudo-terminal clicking on the «Save SQL» button. This acts exactly as a plain text editor, with the following standard shortcuts : «Ctrl-C» to copy, «Ctrl-X» to cut and «Ctrl-V» to paste.


Note the WinMySQL Professional clipboard is public, then you can cut and paste from any Microsoft® Windows® active application using the shared clipboard.



Explain SQL queries


When you are writing a complex query with a lot of joins, you may want to know how MySQL® will process it and in which order it will evaluate the clauses. To do this, write your query into the pseudo-terminal (or load it from a file), then click on the «Explain SQL» button. To analyze the answer, please refer to the «MySQL® user's manual».


You can also just put a table name at the place of the query in the pseudo-terminal, then, the «Explain» button will act exactly as you have entered the query «desc table_name».


This feature doesn't work properly on the oldest versions of MySQL® servers and doesn't accept scripts.



Quit pseudo terminal


To quit the pseudo terminal, click on the «Cancel» button. This closes the pseudo-terminal, but without resetting it. When you open it again, the previous query is still there and the script parser option is still set as you have leave it.


If you want to delete the pseudo-terminal content, just click on the «Clear SQL» button.



Documentation : WinMySQL Professional 1.16 - © 1999-2003 by Alexandre GOUVERNEUR