Bay Breeze Software, Inc.

Query perspective

Query perspective is the default perspective that is displayed when SQL Edge® first started. It has a “Database Explorer”, any number of SQL editor windows, and “Query Result” views. The following shows a screen shot of “Query Perspective”.

 

1. Database explorer

The “Database Explorer” shows all databases defined in “Settings” menu.

Expanding any database node will reveal the schemas node for databases supporting multiple schemas, or the tables, views and synonyms nodes for databases supporting one schema. A table node can be expanded further to show the columns and indexes of the table.

For Oracle, DB2, Microsoft SQL Server, Sybase, MySQL and PostgreSQL databases, additional database objects, such as sequences, stored procedures, triggers and packages will be displayed based on whether the database supports these objects.

Filters can be defined in the Database Explorer to control what schema objects should be displayed. The following shows the “Filter Settings” dialog box for a Schemas node. You can invoke the dialog box by right click on a Schemas node and choose the ‘Filter Settings” menu option.

Similarly, you can define filters on tables, views, synonyms, sequences, stored procedures and packages nodes.

 

2. SQL editor

The SQL editor allows users to enter any SQL statements, highlight a query and execute it by either clicking the “Execute” toolbar button, or press “Ctrl+R”.

If the query runs too long, you can click the “Cancel” toolbar button to stop it.

The query result will be displayed in the “Query Result” view.

If all columns of a selection query are from one table and the primary key of the table is also selected, the data grid in the “Query Result” view will be editable, and you can use the options menu to insert and delete records from the table.

To achieve the best performance, a selection query will only return enough rows to fill the query result grid. You can always scroll down the grid to retrieve more result rows. For long string or CLOB columns, the query will only return the first 255 characters as a preview. The “Relationship table view” perspective has a cell editor to allow you to browse and edit the full contents of these columns.

Each SQL editor window corresponds to an opened database connection. You can use the File menu to open more connections, close a connection, open file into a SQL editor window, or save modified files.

 

3. Execute SQL scripts

The SQL editor allows users to execute SQL scripts. For Transact-SQL scripts, you can use the word “GO” to separate the SQL statement. For other type of SQL scripts, such as PL/SQL, PL/pgSQL, DB2, and MySQL scripts, use “;” to separate the SQL statement.

You can highlight a list of statements and click the “Execute” toolbar button to run them as a script. Without highlighting anything, the “Execute” button will run the whole content in the SQL editor as a script.

If there are multiple select statements in a script, multiple query result windows will be opened to display the result.

The “Messages” view shows the result message for each SQL statement.

 

4. Support database specific script language

The SQL Editor supports Oracle PL/SQL, PostgreSQL PL/pgSQL, DB2, MySQL, SQL Anywhere Watcom SQL, and Transact-SQL scripts. This section uses Oracle PL/SQL script as an example to describe the SQL Editor’s script support.

For Oracle databases, the SQL Editor allows users to execute anonymous PL/SQL blocks and any statements to create triggers, stored procedures, and packages.

If there are any compilation errors in a trigger, stored procedure or package, after execute the create statement, the compilation errors will be displayed as error markers in the editor. Positioning the cursor on an error marker, the compilation error will be displayed as a popup tool tip.

The SQL Editor also allows users to execute anonymous PL/SQL blocks with calls to dbms_output package to print out debugging messages.

 

5. Create selection query wizard

Sometimes, developers prefer to specify a list of columns in a select statement. SQL Edge® provides a wizard to simplify the task. Just double-click any table, view, or synonym node in the “Database Explorer” will display the “Create Selection Query” wizard:

Choose the desired columns in the first page, and enter a query condition in the second page:

Click the “Finish” button to insert the query into the SQL editor:

You can make more modifications of the query, and then execute it.

 

6. Format SQL statement

SQL Edge® allows users to format a SQL statement. Just highlight a SQL statement in the SQL editor, right-click to invoke the options menu, and select “Format SQL” option.

The SQL statement will be formatted properly as shown below:

Note that the “Format SQL” option can only format a syntax correct statement. If there are syntax errors in the SQL statement, the “Format SQL” option will leave the SQL statement unchanged.