SQL Editor UI Specification

Author: Andrei Badea

$Revision: 1.1.1.1 $
$Date: 2009/10/29 16:49:53 $

Introduction

This document describes the editor for SQL commands, which will replace the Execute Command window the NetBeans 4.1 and older. The SQL editor behaves like an SQL console (it is not necessary to explicitly create a file on disk in order to test an SQL command).

Use Cases and Scenarios

Edit and Execute SQL Files

The user needs to edit SQL statements and test them by executing them against arbitrary SQL connections (among those defined in the Database Explorer).

Scenario:

  • The user invokes the SQL Editor. Currently the only two ways to open an SQL editor are the "Execute Command" and "View Data" actions on table nodes in the Database Explorer. These actions are not part of this specification.
  • After writing the statements the user selects the connection from the Connections combo box and clicks the Run button.
  • The result is displayed in the SQL Editor Result Table.

Syntax Highlighting

The editor offers syntax highlighting of the edited SQL statement.

Find the Current Connection

While writing the SQL statement the user might need to browse the database structure (displayed in the Database Explorer in the Runtime tab. An action to activate the Runtime tab and select the connection currently selected in the Connection combo box is provided.

Scenario:

  • The user clicks the Select in Explorer button. The connection selected in the Connection combo box is selected in the Runtime tab and the Runtime tab is activated and given focus.

Specification

SQL Editor Window

Figure: SQL Editor showing a statement and a result set returned by its execution.

  -----------
 / File1.sql \
+--------------------------------------------------------------------------------------------------+
| +----------------------------------------------------------------------------------------------+ |
| | Connection: |_test_on_localhost_|_v_| [ R ] [ S ] (standard toolbar buttons)                 | |
| +----------------------------------------------------------------------------------------------+ |
| +----------------------------------------------------------------------------------------------+ |
| | SELECT * FROM invoice INNER JOIN item ON invoice.id = item.invoice_id                        | |
| |                                                                                              | |
| |                                                                                              | |
| |                                                                                              | |
| |                                                                                              | |
| +----------------------------------------------------------------------------------------------+ |
| +------+---------+--------------+------+------------+---------+----------+---------------------+ |
| | id   | user_id | date         | id   | invoice_id | item_id | quantity |                     | |
| +------+---------+--------------+------+------------+---------+----------+                     | |
| | 1    | 23      | 10-JAN-05    | 3    | 1          | 45      | 1        |                     | |
| +------+---------+--------------+------+------------+---------+----------+                     | |
| | 1    | 23      | 10-JAN-05    | 4    | 1          | 50      | 3        |                     | |
| +------+---------+--------------+------+------------+---------+----------+                     | |
| | 3    | 50      | 11-JAN-05    | 3    | 3          | 20      | 2        |                     | |
| +------+---------+--------------+------+------------+---------+----------+                     | |
| |                                                                                              | |
| +----------------------------------------------------------------------------------------------+ |
+--------------------------------------------------------------------------------------------------+

Components:

  • Editor toolbar
  • Connection combo box - displays the list of connections from the Database Explorer. The last item of this combo box is "Add Connection", which displays the New Connection dialog (the one which appears when invoking the Connect Using action on a driver node in the Database Explorer).
  • R (Run) button - executes the SQL statement agains the connection selected in the Connection combo box. The button tooltip is Run file. Always enabled. This should be the Run - Run File - Run File menu action with the Shift+F6 shortcut.
  • S (Select in Explorer) button - selects the current connection in the Explorer. The button tooltip is Select Connection in Explorer. Always enabled.
  • Editor
  • Result table - displays the current result set.

Project Features

About this Project

DB was started in November 2009, is owned by Antonin Nebuzelsky, and has 162 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close