borland Packages  Class Hierarchy  dx.sql.dataset Package 

ProcedureDataSet class

java.lang.Object
   +----com.borland.dx.dataset.ReadRow
           +----com.borland.dx.dataset.ReadWriteRow
                   +----com.borland.dx.dataset.DataSet
                           +----com.borland.dx.dataset.StorageDataSet
                                   +----com.borland.dx.sql.dataset.ProcedureDataSet

About the ProcedureDataSet class

Properties  Methods  Event Listeners

Implements AccessListener, ColumnDesigner, Designable, MasterNavigateListener, StatusListener, Serializable, EventListener

The ProcedureDataSet class is an extension of its superclass (StorageDataSet) and provides functionality to run a stored procedure against data stored in a SQL database, passing in parameters if the procedure expects them. The procedure call is expected to return a cursor.

In any application that uses the ProcedureDataSet, the following components are also required:

The data contained in a ProcedureDataSet is the result of the most recent execution of the stored procedure. Storing the "result set" from the execution of the stored procedure in a ProcedureDataSet allows for greater flexibility in navigation of the resulting data.

The ProcedureDataSet inherits the maxRows property which allows you to set the maximum number of rows stored initially in the ProcedureDataSet as a result of the stored procedure execution.

Once the data is stored in the ProcedureDataSet, you manipulate it and connect it to UI controls in exactly the same way as you would other StorageDataSet components, without regard to which component is storing the data.

This class is used with servers whose JDBC driver supports executing stored procedures that generate a result set. Not all JDBC drivers support this; some vendor libraries require special API calls to invoke stored procedures. Refer to your server documentation for more information on whether it meets this requirement.

Oracle stored procedures

Oracle stored procedures work only with Oracle's type-2 and type-4 drivers. Also, the Oracle server version must be 7.3.4 or 8.0.4 or newer.

Note: Stored "Functions" work with older versions of Oracle Servers as well.

The following example demonstrates a stored procedure in a package:

CREATE PACKAGE my_pack is
   type cust_cursor is ref cursor return CUSTOMER%rowtype;
   procedure sp_test ( rc1 in out cust_cursor );
end;

CREATE PACKAGE BODY my_pack IS
  PROCEDURE sp_test (rc1 in out cust_cursor) IS
  BEGIN
    open rc1 for select * from CUSTOMER;
  END sp_test;
END my_pack;

The call string for this procedure should be:

"{ call my_pack.sp_test(?) }"
No parameter row is needed. JDataStore uses the cursor to load the ProcedureDataSet.

The result set you need to load the data into the ProcedureDataSet with must be the first parameter in the stored procedure argument list. If additional parameters need to be sent or received, specify the ParameterRow in the Procedure property (or programmatically through the ProcedureDescriptor).

Sybase stored procedures

Stored procedures on Sybase servers are created in a "Chained" transaction mode. In order to call Sybase stored procedures as part of a ProcedureResolver, the procedures must be modified to run in an unchained transaction mode. Use the Sybase stored system procedure sp_procxmode to change the transaction mode to either "anymore" or "unchained". See your Sybase documentation for additional information.


ProcedureDataSet properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in com.borland.dx.dataset.DataSet

Properties implemented in com.borland.dx.dataset.ReadRow

Properties implemented in com.borland.dx.dataset.ReadWriteRow

Properties implemented in com.borland.dx.dataset.StorageDataSet

Properties implemented in java.lang.Object

ProcedureDataSet methods

Methods implemented in this class

Methods implemented in com.borland.dx.dataset.DataSet

Methods implemented in com.borland.dx.dataset.ReadRow

Methods implemented in com.borland.dx.dataset.ReadWriteRow

Methods implemented in com.borland.dx.dataset.StorageDataSet

Methods implemented in java.lang.Object

ProcedureDataSet event listeners


ProcedureDataSet properties

accumulateResults

 public final boolean isAccumulateResults()
 public final void setAccumulateResults(boolean accumulate)
If true, the provided data is accumulated over consecutive calls to executeQuery. If false, subsequent executeQuery calls overwrite the existing DataSet.

database

 public final Database getDatabase()
Read-only property that returns the Database object associated with this ProcedureDataSet. This property is a short cut to the database property of the ProcedureDescriptor object. Set this property using any ProcedureDescriptor constructor that takes a Database object as a parameter.

parameterRow

 public ReadWriteRow getParameterRow()
Read-only property that returns the ReadWriteRow object associated with this ProcedureDataSet. This property is a short cut to the parameterRow property of the ProcedureDescriptor object. Set this property using any ProcedureDescriptor constructor that takes a ReadWriteRow object as a parameter.

procedure

 public final ProcedureDescriptor getProcedure()
 public final void setProcedure(ProcedureDescriptor procedureDescriptor)
The ProcedureDescriptor that stores the properties for this ProcedureDataSet.

provider

 public void setProvider(Provider provider)
The provider for this ProcedureDataSet.

queryString

 public final String getQueryString()
Read-only property that returns the query String associated with this ProcedureDataSet. This property is a short cut to the queryString property of the ProcedureDescriptor object. Set this property using any ProcedureDescriptor constructor that takes a query string as a parameter.

ProcedureDataSet methods

closeStatement()

  public void closeStatement()
If Database.isUseStatementCaching() returns true, JDBC statements can be cached. By default these statements will be closed during garbage collection. If resources are scarce, the statment can be forced closed by calling this method.

executeQuery()

  public final void executeQuery()
Executes the procedure with the specified Database and procedure properties, and populates the DataSet.

refresh()

  public void refresh()
Executes the stored procedure and populates the ProcedureDataSet, using the settings for the database and query properties.

Overrides: com.borland.dx.dataset.StorageDataSet.refresh()

refreshSupported()

  public boolean refreshSupported()
Used internally to specify whether refresh() is always supported by the ProcedureDataSet.

Overrides: com.borland.dx.dataset.StorageDataSet.refreshSupported()

saveChanges(com.borland.dx.dataset.DataSet)

  public void saveChanges(DataSet dataSet)
Saves changes made to the data. If no resolver has been specified, a QueryResolver is used by default.

Overrides: com.borland.dx.dataset.StorageDataSet.saveChanges(com.borland.dx.dataset.DataSet)

saveChangesSupported()

  public boolean saveChangesSupported()
Used internally to specify whether saveChanges() is always supported by the ProcedureDataSet.

Overrides: com.borland.dx.dataset.StorageDataSet.saveChangesSupported()


ProcedureDataSet event listeners

This class is a source for the following event sets.

access

 public final void addAccessListener(AccessListener listener)
 public final void removeAccessListener(AccessListener listener)

calcAggFields

 public synchronized void addCalcAggFieldsListener(CalcAggFieldsListener listener)
 public synchronized void removeCalcAggFieldsListener(CalcAggFieldsListener listener)

calcFields

 public synchronized void addCalcFieldsListener(CalcFieldsListener listener)
 public synchronized void removeCalcFieldsListener(CalcFieldsListener listener)

columnChange

 public void addColumnChangeListener(ColumnChangeListener listener)
 public synchronized void removeColumnChangeListener(ColumnChangeListener listener)

dataChange

 public final void addDataChangeListener(DataChangeListener listener)
 public final void removeDataChangeListener(DataChangeListener listener)

edit

 public void addEditListener(EditListener listener)
 public synchronized void removeEditListener(EditListener listener)

load

 public final synchronized void addLoadListener(LoadListener listener)
 public final synchronized void removeLoadListener(LoadListener listener)

masterNavigate

 public final void addMasterNavigateListener(MasterNavigateListener listener)
 public final void removeMasterNavigateListener(MasterNavigateListener listener)

navigation

 public final void addNavigationListener(NavigationListener listener)
 public final void removeNavigationListener(NavigationListener listener)

open

 public final void addOpenListener(OpenListener listener)
 public final void removeOpenListener(OpenListener listener)

rowFilter

 public final void addRowFilterListener(RowFilterListener listener)
 public final void removeRowFilterListener(RowFilterListener listener)

status

 public final void addStatusListener(StatusListener listener)
 public final void removeStatusListener(StatusListener listener)