[RSS]

Invoking Visual SQL Editor from DB Explorer

Summary

This document proposes a UI for invoking the Visual SQL Editor (aka Query Editor) from nodes in the DB Explorer.

Background

There are currently two context menu items available for executing database commands from DB Explorer nodes:

  • Execute Command...
    • Opens a blank SQL Editor, from which commands can be executed
    • Present on Connection, Table, Concrete Table, Column
  • View Data...
    • Opens a SQL Editor, filled in with a default query, and a pane showing results of the query
    • Present on Concrete Table and Column

The proposed change would add a new item, "Design Query..." to some nodes, as outlined below.

Discussion

The VSE was developed as part of Creator / VisualWeb, to enable visual development of queries. It is still used in VisualWeb, for customizing the queries that define RowSets for databinding.

Nothing in the VSE is specific to VisualWeb, so it can be useful to Netbeans users who may want an easy way of constructing queries. The DB Explorer is a natural way to access the functionality.

The current proposal is to make the VSE accessible from Concrete Table and Column nodes, which are tied to database contents. For simplicity, "Execute Command...", which is more generic would be removed from these nodes, but retained on the higher level nodes like Connection and Table.

The VSE is described elsewhere

This document only discusses the means of accessing it from the DB Explorer.

Use Cases and Scenarios

  1. Visually explore the contents of a database

User navigates within the DB Explorer to a specific table or column and opens the Visual SQL Editor (VSE) to examine the associated data.

VSE opens with a context-dependent default query. User can modify either visually or textually, and re-run as necessary.

Specification

A new menu item, "Design Query..." would be added to the contextual menu of the DB Explorer nodes for Concrete Table and Column. This would replace "Execute Command...", which would be dropped from those nodes.

  • Design Query...
    • Opens a Visual SQL Editor (VSE), filled in with a default query
    • To be added to the Concrete Table and Column nodes.

"Design Query..." would invoke the VSE, with a context-dependent default query, which is the same as the one used by "View Data...". However, the query would not be executed by default.

Concrete Table node:

Contextual Menu:

    Create Table...
    Add Column...
    Refresh
    --------
    Grab Structure...
    Recreate Table...
    --------
    View Data...
    Design Query...
    --------
    Delete      
    Properties

Default query is 'SELECT * FROM <table>'.

Column node:

Contextual Menu:

    Add Column...
    --------
    View Data...
    Design Query...
    --------
    Delete      
    Properties

Default query is 'SELECT <column> FROM <table>'.

Option

The "Design Query..." item could also be added to the higher-level nodes in the DB Explorer (Connection, Table, View). In that case it would not open with a default query.