EPUB | CHM | PDF

View Editor

Top Previous Next

The View Editor is provided for altering SQL views. To open the View Editor, simply double-click a view on the diagram or select the Properties item from the context menu.

editor-view-general

The View Editor contains several tabs, each of which will be described below.

General

This tab allows you to set the name of the view and write comments for it. There are the following fields on the tab:

View Name
Sets the name of the view. To check your diagram for the uniqueness of names use the Check Diagram tool.

View Definer
The DEFINER clause determines which MySQL account to use when checking access privileges for the view when an SQL-statement is executed that references the view.

Comments
A native comment for the view.

Generate
Set this option off to exclude the view from the default selection in the Database Generation and Database Modification tools.

 

editor-view-execution

Execution

The Execution tab provides control over options applied at view invocation time.

View Algorithm
It affects how MySQL processes the view. For MERGE, the text of a state        ment that refers to the view and the view definition are merged such that parts of the view definition replace corresponding parts of the statement. For TEMPTABLE, the results from the view are retrieved into a temporary table, which then is used to execute the statement. For UNDEFINED, MySQL chooses which algorithm to use. It prefers MERGE over TEMPTABLE if possible, because MERGE is usually more efficient and because a view cannot be updatable if a temporary table is used.

Check Option
For a view to be updatable, there must be a one-to-one relationship between the rows in the view and the rows in the underlying table. There are also certain other constructs that make a view nonupdatable. The CHECK OPTION clause can be given for an updatable view to prevent inserts or updates to rows except those for which the WHERE clause in the select_statement is true. In a CHECK OPTION clause for an updatable view, the LOCAL and CASCADED determine the scope of check testing when the view is defined in terms of another view. The LOCAL restricts the CHECK OPTION only to the view being defined. CASCADED causes the checks for underlying views to be evaluated as well. When neither keyword is given, the default is CASCADED.

Execute under INVOKER permissions
This option specifies the security context to be used when checking access privileges at view invocation time.

SQL Query

This tab allows to set the SELECT statement that provides the definition of the view.

A view can be created from many kinds of SELECT statements. For example, the SELECT can refer to a single table, a join of multiple tables, or a UNION. The SELECT need not even refer to any tables.

An example of SELECT statement, which could be used here:

SELECT product_id, product_name FROM Products

Script

This tab allows you to set SQL statements, which will be executed before (use Begin tab) and after (use End tab) generation of the view.

Preview

The Preview tab displays the SQL statement, which will be executed during the database generation. This statement is made up according to the changes you have made using previous tabs. Note, that the text within the editor is read-only. The content of this tab updates only then your press Apply button.

Notes

The Notes tab allows you to define a description and an annotation for the edited view. This properties will not affect the physical database, but they can be useful for your diagram development.

Format

These options allow you to set the view symbol line and fill color for displaying on the diagram, different from the default colors.

See also:
Diagram Objects: Views | Creating a View | View Manager