borland Packages Class Hierarchy dx.sql.dataset Package
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
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:
Database
component to handle the JDBC connection to the SQL database
ProcedureDescriptor
object to store the stored procedure's properties
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.
For an example on executing stored procedures, see "Obtaining data through a stored procedure" in the Database Application Developer's Guide.
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.
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. The cursor is used 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
).
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.
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
.
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.
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.
public final ProcedureDescriptor getProcedure() public final void setProcedure(ProcedureDescriptor procedureDescriptor)The
ProcedureDescriptor
that stores the properties for this ProcedureDataSet
.
public void setProvider(Provider provider)The provider for this
ProcedureDataSet
.
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.
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.
public final void executeQuery()Executes the procedure with the specified
Database
and procedure
properties, and populates the DataSet
.
public void refresh()Executes the stored procedure and populates the
ProcedureDataSet
, using the settings for the database
and query
properties.
public boolean refreshSupported()Used internally to specify whether
refresh()
is always supported by the ProcedureDataSet
.
public void saveChanges(DataSet dataSet)Saves changes made to the data. If no resolver has been specified, a
QueryResolver
is used by default.
public boolean saveChangesSupported()Used internally to specify whether
saveChanges()
is always supported by the ProcedureDataSet
.
public final void addAccessListener(AccessListener listener) public final void removeAccessListener(AccessListener listener)
public synchronized void addCalcAggFieldsListener(CalcAggFieldsListener listener) public synchronized void removeCalcAggFieldsListener(CalcAggFieldsListener listener)
public synchronized void addCalcFieldsListener(CalcFieldsListener listener) public synchronized void removeCalcFieldsListener(CalcFieldsListener listener)
public void addColumnChangeListener(ColumnChangeListener listener) public synchronized void removeColumnChangeListener(ColumnChangeListener listener)
public final void addDataChangeListener(DataChangeListener listener) public final void removeDataChangeListener(DataChangeListener listener)
public void addEditListener(EditListener listener) public synchronized void removeEditListener(EditListener listener)
public final synchronized void addLoadListener(LoadListener listener) public final synchronized void removeLoadListener(LoadListener listener)
public final void addMasterNavigateListener(MasterNavigateListener listener) public final void removeMasterNavigateListener(MasterNavigateListener listener)
public final void addNavigationListener(NavigationListener listener) public final void removeNavigationListener(NavigationListener listener)
public final void addOpenListener(OpenListener listener) public final void removeOpenListener(OpenListener listener)
public final void addRowFilterListener(RowFilterListener listener) public final void removeRowFilterListener(RowFilterListener listener)
public final void addStatusListener(StatusListener listener) public final void removeStatusListener(StatusListener listener)