MySQL Workbench Manual  /  ...  /  SQL Query Window Toolbar

8.1.2 SQL Query Window Toolbar

The toolbar features buttons in two locations, in the main toolbar and within the SQL Editor itself. The SQL Editor buttons are described below.

Figure 8.3 SQL Editor - Toolbar

SQL Editor - Toolbar

From left to right, these buttons are:

  • Open an SQL Script File: Loads contents from a saved SQL script into the SQL editor.

  • Save SQL Script to File: Saves contents from the SQL editor into a file.

  • Execute SQL Script: Executes the selected portion of the query, or the entire query if nothing is selected.

  • Execute Current SQL script: Execute the statement under the keyboard cursor.

  • Explain (All or Selection): Execute the EXPLAIN command on the query under the keyboard cursor.

    A "Results Grid" tab is also displayed when executing an EXPLAIN statement. Clicking it will execute the same query, as if Execute SQL Script was selected.

    Alternatively, the Visual Explain plan is already available for all executed queries. Select Execution Plan from the results tab to view it.

  • Stop the query being executed: Halts execution of the currently executing SQL script.

    Note

    The database connection will not be restarted, and open transactions will remain open.

  • Toggle whether execution of SQL script should continue after failed statements: If the red breakpoint circle is displayed, the script terminates on a statement that fails. If the button is depressed so that the green arrow is displayed, execution continues past the failed code, possibly generating additional result sets. In either case, any error generated from attempting to execute the faulty statement is recorded in the Output tabsheet.

    This behavior can also be set from the SQL Execution user preferences panel.

  • Commit: Commits the current transaction.

    Note

    All query tabs in the same connection share the same transactions. To have independent transactions, a new connection must be opened.

  • Rollback: Rolls back the current transaction.

    Note

    All query tabs in the same connection share the same transactions. To have independent transactions, a new connection must be opened.

  • Toggle Auto-Commit Mode: If selected, each statement will be committed independently.

    Note

    All query tabs in the same connection share the same transactions. To have independent transactions, a new connection must be opened.

    Auto-commit is enabled by default, and this default behavior can be modified (disabled) under the SQL Execution user preferences panel.

  • Set Limit for Executed Queries: The default value is 1000, which appends "LIMIT 0, 1000" to SELECT queries.

    The default (1000) can be changed from the SQL Execution user preferences panel.

  • Save Snippet: Save the current statement or selection to the active snippet list.

  • Beautify SQL: Beautify/reformat the SQL script.

    By default, SQL keywords are changed to UPPER CASE. This functionality can be changed from the SQL Editor user preferences panel.

  • Find panel: Show the Find panel for the editor.

  • Invisible characters: Toggle display of invisible characters, such as newlines, tabs, spaces.

    A new line is represented as [LF], a space as a single dot (.), and a tab as a right arrow.

  • Wrapping: Toggles the wrapping of long lines in the SQL editor window.


User Comments
Sign Up Login You must be logged in to post a comment.