borland Packages Class Hierarchy dx.sql.dataset Package
java.lang.Object +----com.borland.dx.sql.dataset.QueryDescriptor +----com.borland.dx.sql.dataset.ProcedureDescriptor
Constructors Properties Methods
Implements Serializable
The QueryDescriptor stores properties that set a query statement to run against a SQL database. To access SQL table data using a QueryDataSet, the Database component and QueryDescriptor object are also required. The properties of the QueryDescriptor object are:
To work with this component programmatically, you set its properties when instantiating the QueryDescriptor object, or individually by its write accessor methods. For properties that do not have a corresponding setter method, use a constructor that takes that property as a parameter.
Data can be loaded all in one fetch, as needed, asynchronously or one at a time (as specified by the loadOption property). When working with asynchronous queries, opening the QueryDataSet then immediately calling methods such as rowCount() typically returns a row count lower than expected. To avoid this, either set the query to synchronous, listen for the LoadingEvent, perform other actions while the QueryDataSet completes loading, or listen for updates to the row count.
As an asynchronous query fetches rows of data, they are appended to the end of the DataSet. When working with a sorted view of the DataSet, the new rows appear in the specified sort order. Also, be careful to not make assumptions about the current row position since rows are inserted into the sorted view as they are fetched, thereby changing row positions automatically.
When executing queries, you have several options from which to choose, depending on your query statement. If your statement returns a ResultSet, use a QueryDataSet component with a QueryDescriptor. For example, the statement
select * from customer
If you also require the addition of parameter passing (all named or all unnamed), assign these values to an object derived from ReadWriteRow (for example, a ParameterRow) in conjunction with the QueryDataSet.
Do not use a QueryDataSet if your SQL statement doesn't yield a ResultSet. Instead, use one of the following:
If a query is run against a synonym on an Oracle server, it is dependent on the support of synonyms in the JDBC driver to determine whether the query is updatable.
public QueryDescriptor(Database database, String query)Constructs a QueryDescriptor object with the following properties:
public QueryDescriptor(Database database, String query, boolean executeOnOpen)Constructs a QueryDescriptor object with the following properties:
public QueryDescriptor(Database database, String query, ReadWriteRow parameters)Constructs a QueryDescriptor object with the following properties:
public QueryDescriptor(Database database, String query, ReadWriteRow parameters, boolean executeOnOpen)Constructs a QueryDescriptor object with the following properties:
public QueryDescriptor(Database database, String query, ReadWriteRow parameters, boolean executeOnOpen, boolean asynchronousExecution)This constructor has been deprecated. Use a constructor that takes a loadOption parameter, or set the loadOption property directly.
public QueryDescriptor(Database database, String query, ReadWriteRow parameters, boolean executeOnOpen, int loadOption)Constructs a QueryDescriptor object with the following properties:
public final boolean isAsynchronousExecution() public final void setAsynchronousExecution(boolean async)This property has been deprecated. Use a constructor that takes a loadOption parameter, or set the loadOption property directly.
public Database getDatabase()
Read-only property that returns the instantiated Database that the query is associated with.
To set this property, use any QueryDescriptor constructor that takes this property as a parameter.
public boolean isExecuteOnOpen() public void setExecuteOnOpen(boolean executeOnOpen)
If the QueryDataSet is empty, this property specifies whether the query is executed automatically when the QueryDataSet is opened. ("Empty" refers to a DataSet not having any visible or non-visible rows.) When true (the default value), the query is executed automatically and allows for live data to display in UI controls. To prevent the query from automatically executing when the QueryDataSet is opened, set this property to false.
This property does not apply to the ProcedureDescriptor subclass of the QueryDescriptor when used with a ProcedureResolver component.
public final int getLoadOption() public final void setLoadOption(int loadOption)Returns the options specified for loading the QueryDataSet with data. Valid values for this property are defined in Load variables.
public ReadWriteRow getParameterRow()Specifies the ReadWriteRow implementation that stores the parameters for the query statement.
public String getQueryString()Read-only property that returns the query string to run against the Database.
To set this property, use any QueryDescriptor constructor that takes this property as a parameter.
public String toString()Returns a String equivalent of the property values stored in the QueryDescriptor.