borland Packages Class Hierarchy sql.dataset Package Index
java.lang.Object +----borland.sql.dataset.QueryDescriptor +----borland.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 corresponding setter methods, use a constructor that takes that property as a parameter.
Through the user-interface, the information stored in the QueryDescriptor can be accessed by inspecting the query property of a QueryDataSet object. This displays the Query custom property editor. The Query property editor also provides the additional functionality of
Data can be loaded all in one fetch, as needed, asynchronously or one at a time. 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.
Through the Query property editor, the SQL statement entered may be optionally resourced into a separate file. This provides a logical separation between the code which uses the SQL statement and the contents of that statement so that a developer can 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 examples on using a QueryDataSet and its associated QueryDescriptor, see Querying a database in the Database Application Developer's Guide. If your query uses parameters, see Using parameterized queries to obtain data from your database in the Database Application Developer's Guide.
Note: 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(borland.sql.dataset.Database database, java.lang.String query)Constructs a QueryDescriptor object with the following properties:
Parameters:
public QueryDescriptor(borland.sql.dataset.Database database, java.lang.String query, boolean executeOnOpen)Constructs a QueryDescriptor object with the following properties:
Parameters:
public QueryDescriptor(borland.sql.dataset.Database database, java.lang.String query, borland.jbcl.dataset.ReadWriteRow parameters)Constructs a QueryDescriptor object with the following properties:
Parameters:
public QueryDescriptor(borland.sql.dataset.Database database, java.lang.String query, borland.jbcl.dataset.ReadWriteRow parameters, boolean executeOnOpen)Constructs a QueryDescriptor object with the following properties:
Parameters:
public QueryDescriptor(borland.sql.dataset.Database database, java.lang.String query, borland.jbcl.dataset.ReadWriteRow parameters, boolean executeOnOpen, boolean asynchronousExecution)
public QueryDescriptor(borland.sql.dataset.Database database, java.lang.String query, borland.jbcl.dataset.ReadWriteRow parameters, boolean executeOnOpen, int loadOption)Constructs a QueryDescriptor object with the following properties:
Parameters:
public final boolean isAsynchronousExecution() public final void setAsynchronousExecution(boolean async)
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 (such as the GridControl) in the JBuilder UI Designer. 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. This String representation appears in the JBuilder Inspector as the value of the query property.
Overrides: java.lang.Object.toString()