borland.jbcl Packages borland.jbcl Class Hierarchy borland.jbcl.dataset
java.lang.Object +----borland.jbcl.dataset.ReadRow +----borland.jbcl.dataset.ReadWriteRow +----borland.jbcl.dataset.DataSet +----borland.jbcl.dataset.StorageDataSet +----borland.jbcl.dataset.QueryDataSet
Variables Constructors Properties Methods Event Listeners
Implements AccessListener, MasterNavigateListener, StatusListener, 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.
By default, a QueryDataSet automatically attemps 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. If this 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.
public QueryDataSet()
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 custom property editor dialog.
public ParameterRow getParameterRow()The ParameterRow 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 final QueryDescriptor getQuery() public final void setQuery(borland.jbcl.dataset.QueryDescriptor queryDescriptor)Specifies the QueryDescriptor object that stores query properties which make the QueryDataSet usable.
public final String getQueryString()The query string that is executed against the server. This may or may not be the same as the query specified in originalQuery. JBuilder automatically adds additional columns to the query statement to allow updates to the DataSet to be resolvable back to the data source.
public void checkMasterDetail(borland.jbcl.dataset.MasterLinkDescriptor masterDetail)This method parses the query statement to ensure that a WHERE clause is specified if needed. A WHERE clause is required if the fetchAsNeeded parameter of the MasterLinkDescriptor is set to true. A DataSetException of NO_WHERE_CLAUSE is generated if this method determines that the WHERE clause is missing but needed. A DataSetException of QUERY_FAILED is generated if this method determines that the WHERE clause is not needed but is specified in the query string.
Overrides: borland.jbcl.dataset.StorageDataSet.checkMasterDetail(MasterLinkDescriptor)
public final void executeQuery()Given that the database and query properties have been set, executes the query and populates the dataset.
public final void loadDetailRows(borland.jbcl.dataset.DataSet detailDataSet, borland.jbcl.dataset.DataSet masterDataSet)
Overrides: borland.jbcl.dataset.StorageDataSet.loadDetailRows(DataSet, DataSet)
protected final boolean openStorage(borland.jbcl.dataset.DataSet dataSet, borland.jbcl.dataset.AccessEvent event)
Overrides: borland.jbcl.dataset.StorageDataSet.openStorage(DataSet, AccessEvent)
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()This method overrides its superclass implementation by calling the executeQuery() method.
Overrides: borland.jbcl.dataset.StorageDataSet.refresh()
public boolean refreshSupported()
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 synchronized void startResolution()This method is used internally by other classes in the JBCL. You should never use this method directly.
Overrides: borland.jbcl.dataset.StorageDataSet.startResolution()
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 void addLoadListener(borland.jbcl.dataset.LoadListener listener) public final 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)
public final void removeStorageAccessListener(borland.jbcl.dataset.AccessListener listener)