borland Packages Class Hierarchy sql.dataset Package Index
java.lang.Object +----borland.jbcl.dataset.ReadRow +----borland.jbcl.dataset.ReadWriteRow +----borland.jbcl.dataset.DataSet +----borland.jbcl.dataset.StorageDataSet +----borland.sql.dataset.QueryDataSet
Constructors Properties Methods Event Listeners
Implements AccessListener, ColumnDesigner, MasterNavigateListener, StatusListener, Serializable, EventListener
The QueryDataSet component is an extension of its superclass (StorageDataSet) and provides functionality to run a query statement (with or without parameters) against a table in a SQL database.
In any application that uses the QueryDataSet, the following components are also required:
The data contained in a QueryDataSet is the result of the most recent query. The "result set" from the execution of the query is stored in the QueryDataSet, which allows for much greater flexibility in navigation of the resulting data. The QueryDataSet inherits the maxRows property which allows you to set the maximum number of rows that can be initially stored in the QueryDataSet from a query execution.
Once the data is stored in the QueryDataSet, you manipulate it and connect it to UI controls in exactly the same way as you would other StorageDataSet components, without regard to which JBCL component is storing the data.
The QueryDataSet component uses the QueryProvider and QueryResolver to perform the data providing and resolving functions.
By default, a QueryDataSet automatically attempts to make itself updatable so that changes made to the data it contains can be resolved back to its data source. It analyzes the query and looks for row identifiers: one or more columns that uniquely identify each row. This is required to save any changed data back to the correct row of the original data. If you have not included these columns in your query's SELECT statement, JBuilder automatically adds them but sets the visibilty of such columns as "default". This hides them from any data aware controls that this QueryDataSet is connected to. You may change the column's visibility to true if desired.
To prevent the addition of row ID columns and various metadata related properties on DataSet and Column components, set this component's metaDataUpdate property to MetaDataUpdate.NONE.
If the rowId analysis fails, you can make any QueryDataSet updatable by setting one or more of these properties (as applicable):
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.
Note: Queries run against SQL views are supported, however, they may not be resolvable depending on what actions the SQL view performed. For example, if the view simply filters out rows, the server may be able to handle resolving the edits. You should be aware that you risk making edits that cannot later be resolved back to the data source. More likely, you will need to write your own resolver logic to handle this situation.
In a master-detail relationship, if you set the fetchAsNeeded property to true, you must include a WHERE clause in the detail query that matches the detail link column values to the master link column values. For more information on master-detail relationships, see MasterLinkDescriptor. For examples on setting up a master-detail relationship, see Establishing a master-detail relationship in the Database Application Developer's Guide.
For examples on using a QueryDataSet, see Querying a database in the Database Application Developer's Guide.
For more information on resolving changes to a QueryDataSet, see the QueryResolver component.
public QueryDataSet()Constructs a QueryDataSet component.
public final boolean isAccumulateResults() public final void setAccumulateResults(boolean accumulate)Returns the state of accumulateResults property. If enabled, the provided data is accumulated over consecutive calls to the executeQuery() method. If this property is disabled, subsequent executeQuery() calls overwrite the existing DataSet.
public final Database getDatabase()The Database object that holds the connection to the SQL server.
public final String getOriginalQueryString()Returns the original query string, as specified in the Query String field of the Query property editor dialog.
public ReadWriteRow getParameterRow()The ReadWriteRow object that contains the parameters for the query.
Note: If the query contains parameters, you need to call DataSet.close() before providing for another QueryDataSet.
public Provider getProvider() public void setProvider(borland.jbcl.dataset.Provider provider)Stores the QueryProvider associated with this QueryDataSet component. When setting this property, only a QueryProvider is acceptable. If This property generates a DataSetException of NEED_QUERY_PROVIDER if this property is not set.
public final QueryDescriptor getQuery() public final void setQuery(borland.sql.dataset.QueryDescriptor queryDescriptor)Specifies the QueryDescriptor object that stores query properties which make the QueryDataSet usable.
public final void executeQuery()Given that the database and query properties have been set, executes the query and populates the DataSet.
public final String getQueryString(borland.jbcl.dataset.StorageDataSet sds)
public void refetchRow(borland.jbcl.dataset.ReadWriteRow row)This method fetches the original row from the data source based on the key field of the row you pass in. For example, if the key field of the row is "foobar", this method fetches the row in the DataSet with that key field.
Overrides: borland.jbcl.dataset.DataSet.refetchRow(ReadWriteRow)
public void refresh()
Overrides: borland.jbcl.dataset.StorageDataSet.refresh()
public boolean refreshSupported()Returns true.
Overrides: borland.jbcl.dataset.StorageDataSet.refreshSupported()
public void saveChanges(borland.jbcl.dataset.DataSet dataSet)This method calls Database.saveChanges() with the DataSet object specified in its parameter.
Overrides: borland.jbcl.dataset.StorageDataSet.saveChanges(borland.jbcl.dataset.DataSet)
public boolean saveChangesSupported()Used internally by data-aware controls to determine if a saveChanges() type operation is supported.
Overrides: borland.jbcl.dataset.StorageDataSet.saveChangesSupported()
public final void addAccessListener(borland.jbcl.dataset.AccessListener listener) public final void removeAccessListener(borland.jbcl.dataset.AccessListener listener)
public synchronized void addCalcAggFieldsListener(borland.jbcl.dataset.CalcAggFieldsListener listener) public synchronized void removeCalcAggFieldsListener(borland.jbcl.dataset.CalcAggFieldsListener listener)
public synchronized void addCalcFieldsListener(borland.jbcl.dataset.CalcFieldsListener listener) public synchronized void removeCalcFieldsListener(borland.jbcl.dataset.CalcFieldsListener listener)
public final void addDataChangeListener(borland.jbcl.dataset.DataChangeListener listener) public final void removeDataChangeListener(borland.jbcl.dataset.DataChangeListener listener)
public void addEditListener(borland.jbcl.dataset.EditListener listener) public synchronized void removeEditListener(borland.jbcl.dataset.EditListener listener)
public final synchronized void addLoadListener(borland.jbcl.dataset.LoadListener listener) public final synchronized void removeLoadListener(borland.jbcl.dataset.LoadListener listener)
public final void addMasterNavigateListener(borland.jbcl.dataset.MasterNavigateListener listener) public final void removeMasterNavigateListener(borland.jbcl.dataset.MasterNavigateListener listener)
public final void addNavigationListener(borland.jbcl.dataset.NavigationListener listener) public final void removeNavigationListener(borland.jbcl.dataset.NavigationListener listener)
public final void addOpenListener(borland.jbcl.dataset.OpenListener listener) public final void removeOpenListener(borland.jbcl.dataset.OpenListener listener)
public final void addRowFilterListener(borland.jbcl.dataset.RowFilterListener listener) public final void removeRowFilterListener(borland.jbcl.dataset.RowFilterListener listener)
public final void addStatusListener(borland.jbcl.dataset.StatusListener listener) public final void removeStatusListener(borland.jbcl.dataset.StatusListener listener)