Query property editor

This is a feature of JBuilder Professional and Enterprise.

Use the Query property editor to set the properties of a query when using the QueryDataSet or QueryProvider component.

This property editor contains two pages:

To display this property editor, choose the query property from the Inspector when a QueryDataSet component is highlighted in the structure pane. For more information on this dialog, see "Understanding the query property dialog" in the Database Application Developer's Guide.



Query page

Use the Query page to set query properties and associate the query with a particular Database. The properties referenced on this page of the property editor are stored in the QueryDescriptor object.

Database

Displays the names of all instantiated Database objects to which this QueryDataSet can be bound. This property must be set for the query to run.

Selecting a Database object enables the Browse Tables and SQL Builder buttons.

SQL Builder

This button is a feature of JBuilder Enterprise.

Click this button to display the SQL Builder dialog. The SQL Builder helps you set up your query statement. When you develop your query statement using the SQL Builder dialog, the query statement is displayed in the SQL Statement field.

This button is dimmed and unavailable while the Database field displays the value "<none>".

Browse Tables

Displays the Available Tables and Columns dialog. The Available Tables and Columns dialog displays a list of tables in the specified Database, and the columns in the selected table. The Paste Table and Paste Column buttons allow you to quickly create your query statement by pasting the name of the selected table (by clicking the Paste Table button) or selected column (by clicking the Paste Column) button into your query statement at the cursor's current (insertion) point.

You must enter the SQL syntax, Browse Tables only enables you to select table and column names from a list to avoid typing errors. For example,

  1. Enter SELECT in the SQL Statement box.
  2. Select Browse Tables, select a column value and paste it into the SQL Statement.
  3. Enter FROM in the SQL Statement box.
  4. Select Browse Tables, select a table value and paste it into the SQL Statement.

The SQL Statement will read something like SELECT FIRST_NAME FROM EMPLOYEE.

This button is dimmed and unavailable while the Database field displays the value "<none>". Select a database object in the Database field to enable this button.

SQL Statement

The query statement to run against the Database specified in the Database drop-down list.

Use the SQL Builder button to have JBuilder help create the SQL statement or use the Browse Tables button to quickly paste the selected table and column names into the query statement. The SQL Builder button is a feature of JBuilder Enterprise.

This is a required property; you must specify a valid SQL statement. If the SQL statement does not return a result set, an exception is generated.

Execute Query Immediately When Opened

Specifies that the query should be executed automatically when the QueryDataSet is opened. When selected (the default value), the query is executed immediately and allows for live data to display in UI controls (such as the JdbTable component) in the JBuilder UI Designer.

Place SQL Text In Resource Bundle

Select this option to move the SQL statement to a ResourceBundle file. Separating the code which uses the SQL statement and the contents of that statement allows a developer to change the SQL statement inside the resourced file without needing to recompile the code which uses the SQL.

Once a SQL statement has been resourced, any future changes to it in the JBuilder design tools will modify the resource file, not the source file referring to that SQL string.

For new queries, this option defaults to the preferred value stored in the jbuilder.properties file (in the key jbuilder.preference.queryDescriptorEditor.Resource). Changing the state of this checkbox (by deliberately checking or unchecking this option) will update this preference in the jbuilder.properties file accordingly. The preferred setting is preserved across JBuilder sessions.

For existing queries, the state of the checkbox depends on whether the query was previously resourced or not.

If this option is selected for a new query and you close this dialog using the OK button, the Create ResourceBundle dialog box displays to prompt you for the name of the Resource Bundle.

Load Options

Specifies how the data is loaded into the QueryDataSet. The data can be loaded:

For more information on these options, see com.borland.dx.sql.dataset.Load.

Test Query

Tests the SQL statement and other properties on this dialog against the specified Database. The result ("Success" or "Fail") is displayed below the Test Query button.



Parameters page

Use the Parameters page to specify parameters for your query statement.

Parameter values are specified through an instantiated ReadWriteRow object (or an instance of any of its subclasses), for example, a DataSet object.

Select the ReadWriteRow object (or the ReadWriteRow subclass) that contains the values for your query parameters from the drop-down list.

Any ReadWriteRow, such as ParameterRow, DataSet, and DataRow may be used as query or procedure parameters. In a ParameterRow, columns can simply be set up with the addColumns and setColumns methods. DataSet and DataRow should only be used if they already contain the columns with the wanted data. For more information on creating parameters, see "Tutorial: Parameterizing a query" in the Database Application Developer's Guide.