Class com.ibm.ivj.db.uibeans.ProcedureCall
java.lang.Object
|
+----com.ibm.ivj.db.uibeans.Statement
|
+----com.ibm.ivj.db.uibeans.Select
|
+----com.ibm.ivj.db.uibeans.ProcedureCall
- public class ProcedureCall
- implements Serializable, DatabaseConnectionAfterListener, DatabaseConnectionBeforeListener, StatementAfterListener, StatementBeforeListener, PropertyChangeListener, StatementResultAfterListener, StatementResultBeforeListener, StatementResultValueChangeListener, TableModel
- extends Select
ProcedureCall allows you to execute a stored procedure in a relational database using
JDBC. You can pass input parameters and receive output parameters. If the stored
procedure returns one or more result sets, you can access and change the data.
Constructor Index
- ProcedureCall()
- Constructs a new ProcedureCall and initializes properties to the default values.
Method Index
- cancelAction()
- Cancels execution of the SQL statement which is associated with
this ProcedureCall.
- columnNames()
- Returns the names of the columns of the current result set.
- columnValueSet(PropertyChangeEvent)
- Invoked when the underlying com.ibm.db.StatementResultValueChange event
columnValueSet
fires, and fires the corresponding PropertyChange
event propertyChange
and TableModel event TableChanged
.
- deleteRow()
- Deletes the current row from the current result set and from the database.
- execute()
- Executes the SQL CALL statement and, if any result sets were produced, positions to the
first row in the first result set.
- executed(DataEvent)
- Invoked when the underlying com.ibm.db.StatementAfter event
executed
fires, and fires the corresponding DataAfter event
executed
.
- firstResult()
- Applies any changes in the current row of the current result set to the database,
and then positions to the first result set (if any result sets were returned).
- firstRow()
- Applies any changes in the current row of the current result set to the database,
and then positions to the first row in the result set.
- getCallableStatement()
- Returns the underlying com.ibm.db.CallableStatement.
- getColumnClass(int)
- Returns the java class that is used for the values of the column in the current result set.
- getColumnClass(String)
- Returns the java class that is used for the values of the column in the current result set.
- getColumnCount()
- Returns the number of columns in the current result set.
- getColumnIndex(String)
- Returns the index of the column in the current result set based on its name.
- getColumnName(int)
- Returns the name of the specified column in the current result set.
- getColumnValue(int)
- Returns the value of the column at the specified index in the current row
of the current result set.
- getColumnValue(String)
- Returns the value of the column with the specified name in the current row
of the current result set.
- getColumnValueToString(int)
- Returns the value of the column at the specified index in the current row
of the current result set as a String.
- getColumnValueToString(String)
- Returns the value of the column with the specified name in the current row
of the current result set as a String.
- getCurrentResult()
- Returns the index of the current result set.
- getCurrentResultInCache()
- Returns the index in the cache of the current result set.
- getCurrentRow()
- Returns the index of the current row in the current result set.
- getCurrentRowInCache()
- Returns the index in the cache of the current row in the current result set.
- getInstanceBeanInfo()
- Returns the BeanInfo that contains information about the instance properties of
this ProcedureCall.
- getMaximumResultsInCache()
- Returns the maximum number of result sets the cache can contain at one time.
- getNumPacketsInCache()
- Returns the number of packets currently in the cache for the current result set.
- getNumResults()
- Returns the number of result sets fetched so far.
- getNumResultsInCache()
- Returns the number of result sets currently in the cache.
- getNumRows()
- Returns the number of rows in the current result set.
- getNumRowsInCache()
- Returns the number of rows currently in the cache for the current result set.
- getProcedure()
- Returns a new Query object that contains references to the connection alias and
the SQL specification for this ProcedureCall.
- getResult()
- Returns the current underlying com.ibm.db.SelectResult for the current result set.
- getRowCount()
- Returns the number of rows currently in the cache for the current result set.
- getValueAt(int, int)
- Returns the value of the specified cell in the cache for the current result set.
- isEnd()
- Returns true if there is a current result set, the currentRow is its last
row, and no more rows can be fetched.
- isFillResultCacheOnExecute()
- Returns true if as many result sets as allowed are fetched into the cache
when
execute
is invoked.
- isLastResult()
- Returns true if the currentResult is the last result processed and either
there are known to be no more results or the statement has been closed.
- isMaxRowsReached()
- Returns true if the number of rows in the current result set is equal to the
maximum size of the result set.
- lastResult()
- Applies any changes in the current row of the current result set to the database,
and then positions to the last result set.
- lastRow()
- Applies any changes in the current row of the current result set to the database,
and then positions to the last row in the current result set.
- lockRow()
- Locks the current row of the current result set in the database.
- newRow(boolean)
- Applies any changes in the current row of the current result set to the database,
inserts a new empty row into the result set, and positions to the new row.
- nextPacket()
- Fetches the next packet from the database into the current result set.
- nextResult()
- Applies any changes in the current row of the current result set to the database,
and then positions to the next result set.
- nextRow()
- Applies any changes in the current row of the current result set to the database,
and then positions to the next row in the result set.
- previousResult()
- Applies any changes in the current row of the current result set to the database,
and then positions to the previous result set.
- previousRow()
- Applies any changes in the current row of the current result set to the database,
and then positions to the previous row in the result set.
- propertyChange(PropertyChangeEvent)
- Method to handle events for the PropertyChangeListener interface.
- refresh()
- Refreshes the result set from the database by re-executing the SQL CALL statement.
- restoreRow()
- Restores a row's column values to those last known to be in the database.
- setColumnValue(int, Object)
- Sets (in the current result set) the value of the column at the specified index in the
current row.
- setColumnValue(String, Object)
- Sets (in the current result set) the value of the column with the specified name in the
current row.
- setColumnValueFromString(int, String)
- Sets (in the current result set) the value of the column at the specified index in the
current row.
- setColumnValueFromString(String, String)
- Sets (in the current result set) the value of the column with the specified name in the
current row.
- setCurrentResult(int)
- Applies any changes in the current row of the current result set to the database,
and then positions to the specified result set.
- setCurrentResultInCache(int)
- Makes the specified result set in the cache the current result set.
- setCurrentRow(int)
- Applies any changes in the current row of the current result set to the database,
and then positions to the specified row in the result set.
- setCurrentRowInCache(int)
- Makes the specified row in the cache the currentRow in the current result set.
- setFillResultCacheOnExecute(boolean)
- If true, as many result sets as allowed are fetched into the cache when
execute
is invoked.
- setMaximumResultsInCache(int)
- Sets the maximum number of result sets the cache can contain at one time.
- setParameter(int, Object)
- Sets the parameter at the specified index to the specified value.
- setParameter(String, Object)
- Sets the parameter with the specified name to the specified value.
- setParameterFromString(int, String)
- Sets the parameter at the specified index to the specified value.
- setParameterFromString(String, String)
- Sets the parameter with the specified name to the specified value.
- setProcedure(Query)
- Sets the connection alias and the SQL specification for this ProcedureCall to the
values contained in the specified Query object.
- unlockRow()
- Unlocks the current row in the current result set.
- updateRow()
- Updates the database with the values of the current row in the current result set.
Constructors
ProcedureCall
public ProcedureCall()
- Constructs a new ProcedureCall and initializes properties to the default values.
Methods
cancelAction
public void cancelAction() throws DataException
- Cancels execution of the SQL statement which is associated with
this ProcedureCall. In order to use this method, it must be invoked
from a thread different from the one in which the SQL statement is running.
The SQL statement is either the one that executes the stored procedure, or
the one associated with a subsequent request to insert, update, or delete
a row in the current result set.
- Throws: DataException
- noConnection
- if no associated DatabaseConnection
- Throws: DataException
- notExecuting
- if the statement is not currently being executed
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- cancelAction in class Select
columnNames
public Enumeration columnNames() throws DataException
- Returns the names of the columns of the current result set.
- Returns:
- enumeration containing column names
- Throws: DataException
- noStatement
- if there is no StatementMetaData associated with this ProcedureCall
- Overrides:
- columnNames in class Select
columnValueSet
public void columnValueSet(PropertyChangeEvent event)
- Invoked when the underlying com.ibm.db.StatementResultValueChange event
columnValueSet
fires, and fires the corresponding PropertyChange
event propertyChange
and TableModel event TableChanged
.
- Parameters:
- event - a java.beans.PropertyChangeEvent
- Overrides:
- columnValueSet in class Select
deleteRow
public void deleteRow() throws DataException
- Deletes the current row from the current result set and from the database. (If the current row
is a new one that has not yet been inserted into the database, it is just removed from
the result set.)
When you delete any row except the last in the result set, you are positioned to the
next row, and the index returned by the
getCurrentRow
method does not change.
When you delete the last row, you are positioned to the previous row,
and the index returned by the getCurrentRow
method decreases by 1.
If the current row should be locked ( isLockRows
returns true),
the new current row is locked in the database.
We generate and execute the SQL necessary to delete the current row from the database.
To insure that your delete affects the intended row in the database, make sure that
the query used to produce the result set includes columns that uniquely identify
a row. Also make sure to use the addTable()
method of the associated
StatementMetaData object to identify the table from which the row is to be deleted.
Otherwise we will attempt to parse your query for this information, with no guarantee
of success.
If no row can be found in the database exactly matching the current row, an exception
is thrown. Failure to find a matching row may occur if the row was changed in the
database by means other than this ProcedureCall after being fetched.
If more than one row is found in the database, no exception is thrown. The number of
rows deleted depends on whether we perform a positioned or searched delete.
Whenever possible, we perform a positioned delete, which deletes the first matching
row. Otherwise, we perform a searched delete, which deletes all matching rows and
logs a message. You can avoid having multiple matching rows by includine enough columns
in the result set to uniquely identify a row.
For more information on when we perform positioned or searched deletes, see the
setForceSearchedUpdate()
method.
The events aboutToDeleteRow
, deletedRow
, and
propertyChange
(for the currentRow and the currentRowInCache properties)
are triggered by this method.
The event cacheRowsChanged
may also be triggered.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noActiveConnection
- if no active connection exists
- Throws: DataException
- readOnly
- if the result set is read only
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- rowChanged
- if the current row cannot be deleted because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property is true and
the new current row cannot be locked
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- deleteRow in class Select
- See Also:
- isLockRows
- setForceSearchedUpdate
execute
public void execute() throws DataException
- Executes the SQL CALL statement and, if any result sets were produced, positions to the
first row in the first result set.
If needed, a connection is made to the database prior to executing the SQL statement.
The events aboutToExecute
and executed
are
triggered by this method.
The events cacheResultsChanged
and cacheRowsChanged
are
triggered by this method.
The event propertyChange
is triggered by this method for the
bound properties currentRow and currentRowInCache as well as for the generated bound
properties for each output parameter.
- Throws: DataException
- noGui
- if no GUI available and logon prompt requested
- Throws: DataException
- badUidPwd
- if incorrect Userid or password specified
- Throws: DataException
- noSQL
- if SQL statement is null
- Throws: DataException
- notCall
- if SQL statement is not a CALL statement
- Throws: DataException
- noTransactions
- if database does not support transactions and autoCommit set to false
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- execute in class Select
executed
public void executed(DataEvent event)
- Invoked when the underlying com.ibm.db.StatementAfter event
executed
fires, and fires the corresponding DataAfter event
executed
.
- Parameters:
- event - DataEvent
- Overrides:
- executed in class Statement
firstResult
public void firstResult() throws DataException
- Applies any changes in the current row of the current result set to the database,
and then positions to the first result set (if any result sets were returned).
If the first result set has been displaced from the cache, you are positioned to
the first result set still in the cache, and an exception is thrown to indicate
that the request could not be satisfied.
If the current row should be locked ( isLockRows
returns true),
the current row of the new current result set is locked in the database.
The event propertyChange
is triggered by this method for the
bound properties currentResultSet and currentResultSetInCache as well as for the
generated bound properties for each result column in the new current result.
- Throws: DataException
- notExecuted
- if statement has not been executed
- Throws: DataException
- noResultSets
- if no result sets were produced
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property is true and the new current row cannot be locked
- Throws: DataException
- beforeResultCacheStart
- if the requested result set is before the start of the cache
- Throws: DataException
- sqlException
- if an SQLException occurred
- See Also:
- setCurrentResult
firstRow
public void firstRow() throws DataException
- Applies any changes in the current row of the current result set to the database,
and then positions to the first row in the result set.
If the first row in the result set has been displaced from the cache, you are
positioned to the first row still in the cache, and an exception is thrown to
indicate that the request could not be satisfied.
If the current row should be locked ( isLockRows
returns true),
the new current row is locked in the database.
The event propertyChange
is triggered by this method for the
bound properties currentRow and currentRowInCache as well as for the
generated bound properties for each result column.
The event cacheRowsChanged
may be triggered by this method.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property is true and
the new current row cannot be locked
- Throws: DataException
- beforeCacheStart
- if the requested row is before the start of the cache
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- firstRow in class Select
- See Also:
- setCurrentRow
getCallableStatement
public CallableStatement getCallableStatement()
- Returns the underlying com.ibm.db.CallableStatement.
- Returns:
- the associated CallableStatement.
getColumnClass
public Class getColumnClass(int columnIndex)
- Returns the java class that is used for the values of the column in the current result set.
If the stored procedure has not yet been executed, and the stored procedure returns only
one result set, whose columns have been defined by addColumn
,
this method returns the java class used in that definition. Otherwise, it cannot be
called until the stored procedure has been executed.
The index of the first column is 0.
- Parameters:
- columnNumber - the index of the column
- Returns:
- the java class for the column
- Throws: IndexOutOfBoundsException
- if the column index is not defined
- Overrides:
- getColumnClass in class Select
getColumnClass
public Class getColumnClass(String columnName)
- Returns the java class that is used for the values of the column in the current result set.
If the stored procedure has not yet been executed, and the stored procedure returns only
one result set, whose columns have been defined by addColumn
,
this method returns the java class used in that definition. Otherwise, it cannot be
called until the stored procedure has been executed.
- Parameters:
- columnName - the name of the column
- Returns:
- the java class for the column
- Throws: IndexOutOfBoundsException
- if the column name is not defined
- Overrides:
- getColumnClass in class Select
getColumnCount
public int getColumnCount()
- Returns the number of columns in the current result set.
If the stored procedure has not yet been executed, and the stored procedure returns only
one result set, whose columns have been defined by addColumn
,
this method returns the number of columns defined for that result set.
Otherwise it returns 0.
- Returns:
- the number of columns
- Overrides:
- getColumnCount in class Select
getColumnIndex
public int getColumnIndex(String columnName)
- Returns the index of the column in the current result set based on its name.
If the stored procedure has not yet been executed, and the stored procedure returns only
one result set, whose columns have been defined by addColumn
,
this method returns column index in that definition. Otherwise, it cannot be
called until the stored procedure has been executed.
The first defined column has an index of 0.
- Parameters:
- columnName - the name of the column
- Returns:
- the column index
- Overrides:
- getColumnIndex in class Select
getColumnName
public String getColumnName(int columnIndex)
- Returns the name of the specified column in the current result set.
If the stored procedure has not yet been executed, and the stored procedure returns only
one result set, whose columns have been defined by addColumn
,
this method returns the name of the column in that result set. Otherwise, it cannot be
called until the stored procedure has been executed.
The index of the first column is 0.
- Parameters:
- columnNumber - the index of the column
- Returns:
- the column name
- Throws: IndexOutOfBoundsException
- if the column index is not defined
- Overrides:
- getColumnName in class Select
getColumnValue
public Object getColumnValue(int columnNumber)
- Returns the value of the column at the specified index in the current row
of the current result set.
The index of the first column is 0.
If the statement has not been executed, a null value is returned.
If a DataException is raised attempting to get the column value because
the result set is empty, the error is logged and a null value is returned.
- Parameters:
- columnNumber - index of the column
- Returns:
- value of the column
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column index is not defined
- Throws: DataRuntimeException
- - if the SQL has been executed and no result sets.
- Overrides:
- getColumnValue in class Select
- See Also:
- setColumnValue
getColumnValue
public Object getColumnValue(String columnName)
- Returns the value of the column with the specified name in the current row
of the current result set.
If the statement has not been executed, a null value is returned.
If a DataException is raised attempting to get the column value because
the result set is empty, the error is logged and a null value is returned.
- Parameters:
- columnName - name of the column
- Returns:
- value of the column
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column name is not defined
- Throws: DataRuntimeException
- - if the SQL has been executed and no result sets.
- Overrides:
- getColumnValue in class Select
- See Also:
- setColumnValue
getColumnValueToString
public String getColumnValueToString(int columnNumber)
- Returns the value of the column at the specified index in the current row
of the current result set as a String. The value of the column is converted to
a String before it is returned.
If the column value is null, a null is returned.
The index of the first column is 0.
If the statement has not been executed, a null value is returned.
If a DataException is raised attempting to get the column value because
the result set is empty, the error is logged and a null value is returned.
- Parameters:
- columnNumber - index of the column
- Returns:
- value of the column as a String.
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column index is not defined
- Throws: DataRuntimeException
- - if the SQL has been executed and no result sets.
- Overrides:
- getColumnValueToString in class Select
- See Also:
- setColumnValueFromString
getColumnValueToString
public String getColumnValueToString(String columnName)
- Returns the value of the column with the specified name in the current row
of the current result set as a String. The value of the column is converted
to a String before it is returned.
If the column value is null, a null is returned.
If the statement has not been executed, a null value is returned.
If a DataException is raised attempting to get the column value because
the result set is empty, the error is logged and a null value is returned.
- Parameters:
- columnName - name of the column
- Returns:
- value of the column as a String.
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column name is not defined
- Throws: DataRuntimeException
- - if the SQL has been executed and no result sets.
- Overrides:
- getColumnValueToString in class Select
- See Also:
- setColumnValueFromString
getCurrentResult
public int getCurrentResult()
- Returns the index of the current result set.
The index of the first result set is 1.
Many methods on ProcedureCall operate on the current row in the current result.
- Returns:
- index of the current result set
- See Also:
- setCurrentResult
getCurrentResultInCache
public int getCurrentResultInCache()
- Returns the index in the cache of the current result set.
Returns 0 if there is no current result set.
The index of the first result set in the cache is 1.
The values of currentResultInCache and currentResult will be the same unless
you have set maximumResultsInCache to a value other than 0, and a result set has been
displaced from the cache.
For example, if one result set has been displaced from the cache and
currentResult is 2, currentResultInCache would be 1.
- Returns:
- index in the cache of the current result set
getCurrentRow
public int getCurrentRow()
- Returns the index of the current row in the current result set. The index of the first
row is 0. If there are no result sets, a value of -1 is returned.
Many methods on ProcedureCall operate on the current row of the current result set.
- Returns:
- index of the current row
- Overrides:
- getCurrentRow in class Select
- See Also:
- setCurrentRow
getCurrentRowInCache
public int getCurrentRowInCache()
- Returns the index in the cache of the current row in the current result set.
The index of the first row in the cache is 0. If there are no result sets, a value
of -1 is returned.
The value of currentRowInCache and currentRow will be the same unless
you are using the large result set support and a packet has been displaced from the
cache. For example, if a packet of 10 rows has been displaced from the cache and the
currentRow is 10, the currentRowInCache would be 0.
- Returns:
- index of the current row
- Overrides:
- getCurrentRowInCache in class Select
getInstanceBeanInfo
public BeanInfo getInstanceBeanInfo()
- Returns the BeanInfo that contains information about the instance properties of
this ProcedureCall. This method is called by the VisualAge for Java IDE to display
the parameters for the call and possibly the columns in a result set on the
connection dialog.
- Returns:
- beanInfo of instance properties
- Overrides:
- getInstanceBeanInfo in class Select
getMaximumResultsInCache
public int getMaximumResultsInCache()
- Returns the maximum number of result sets the cache can contain at one time.
If there is no limit to the number of result sets, the value is 0.
- Returns:
- the maximum number of result sets in the cache
- See Also:
- setMaximumResultsInCache
getNumPacketsInCache
public int getNumPacketsInCache()
- Returns the number of packets currently in the cache for the current result set.
- Returns:
- the number of packets in the cache
- Overrides:
- getNumPacketsInCache in class Select
getNumResults
public int getNumResults()
- Returns the number of result sets fetched so far. (This may be less than the number of
result sets returned by the stored procedure.)
- Returns:
- number of result sets fetched
getNumResultsInCache
public int getNumResultsInCache()
- Returns the number of result sets currently in the cache.
- Returns:
- the number of result sets in cache
getNumRows
public int getNumRows()
- Returns the number of rows in the current result set. This number changes as rows are
fetched from the database, deleted, or added via the
newRow
method.
- Returns:
- number of rows in the current result set
- Overrides:
- getNumRows in class Select
- See Also:
- getRowCount
- getNumRowsInCache
getNumRowsInCache
public int getNumRowsInCache()
- Returns the number of rows currently in the cache for the current result set.
To obtain the number of rows in the entire result set, not just rows in the cache,
use
getNumRows
.
Another method that returns the number of rows currently in the cache is
getRowCount
. That method is required to implement the TableModel interface.
- Returns:
- the number of rows in cache
- Overrides:
- getNumRowsInCache in class Select
- See Also:
- getRowCount
- getNumRows
getProcedure
public Query getProcedure()
- Returns a new Query object that contains references to the connection alias and
the SQL specification for this ProcedureCall.
- Returns:
- a new Query
- See Also:
- setProcedure
getResult
public SelectResult getResult()
- Returns the current underlying com.ibm.db.SelectResult for the current result set.
A ProcedureCall can have no associated SelectResult, or can have one or
more associated SelectResults, one of which is considered the current result.
- Returns:
- the current SelectResult
- Overrides:
- getResult in class Select
getRowCount
public int getRowCount()
- Returns the number of rows currently in the cache for the current result set.
If there are no result sets, returns 0.
This method is part of the TableModel interface. To obtain the number of rows
in the entire result set, not just rows in the cache, use getNumRows
.
Another method that returns the number of rows currently in the cache is
getNumRowInCache
.
- Returns:
- the number of rows in the cache
- Overrides:
- getRowCount in class Select
- See Also:
- getNumRows
- getNumRowsInCache
getValueAt
public Object getValueAt(int rowIndex,
int columnIndex)
- Returns the value of the specified cell in the cache for the current result set.
The index of both the first row and the first column is 0.
If a DataException is raised attempting to get the cell value because the
result set is empty, a null value is returned.
If this method is called before the SQL statement has been executed, a null
is
returned.
- Returns:
- the value of the specified cell
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column index is not defined
- Throws: IndexOutOfBoundsException
- noSuchRow
- if the row index is not defined
- Overrides:
- getValueAt in class Select
isEnd
public boolean isEnd()
- Returns true if there is a current result set, the currentRow is its last
row, and no more rows can be fetched. No more rows can be fetched if any of the
following conditions is true: all rows have been fetched from the database, the
maxRows limit has been reached, or the result set has been closed.
- Returns:
- true if the currentRow is the last row in the result set and no
more rows can be fetched
- Overrides:
- isEnd in class Select
- See Also:
- isOpen
- isMaxRowsReached
isFillResultCacheOnExecute
public boolean isFillResultCacheOnExecute()
- Returns true if as many result sets as allowed are fetched into the cache
when
execute
is invoked.
Returns false if result sets are fetched into the cache only as needed to satisfy
a request to set the current result set position.
The number of result sets you are allowed to fetch into the cache is limited by the
maximumResultsInCache property.
If more than one result set is fetched on execute
, all result sets
before the last one fetched are closed. You will not be able to fetch any additional rows
into the closed result sets beyond what was initially fetched when
execute
was invoked. The number of rows initially fetched for each
result set is governed by the fillCacheOnExecute property.
- Returns:
- true if as many result sets as allowed are fetched into the cache on
execute
, else false.
- See Also:
- setFillResultCacheOnExecute
- getMaximumResultsInCache
- isFillCacheOnExecute
isLastResult
public boolean isLastResult()
- Returns true if the currentResult is the last result processed and either
there are known to be no more results or the statement has been closed. It cannot
be known that there are no more results until you have tried to go past the last
result. Therefore, if you are on the last result and have not tried to go past it,
this method will return false.
- Returns:
- true if the currentResult is the last result processed and no
more results can be processed.
isMaxRowsReached
public boolean isMaxRowsReached()
- Returns true if the number of rows in the current result set is equal to the
maximum size of the result set.
- Returns:
- true if the number of rows in the current result set is equal to the
maximum size of the result set, otherwise false.
- Overrides:
- isMaxRowsReached in class Select
- See Also:
- setMaximumRows
lastResult
public void lastResult() throws DataException
- Applies any changes in the current row of the current result set to the database,
and then positions to the last result set.
If more result sets can be fetched from the database
they are fetched before positioning to the last result set.
The database operation which tells us that there are no more result sets has the
effect of closing the last result set. Therefore, after you use the lastResult
method, no more rows can be fetched in any of the result sets. Because of this, you
should generally avoid the method unless you are not limiting the cache size for
each result set, and the fillCacheOnExecute property is set to true,
causing all rows in each result set to be fetched as soon as the result set is opened.
If the current row should be locked ( isLockRows
returns true),
the current row of the new current result set is locked in the database.
The event propertyChange
is triggered by this method for the
bound properties currentResultSet and currentResultSetInCache as well as for the
generated bound properties for each result column in the new current result.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResultSets
- if no result sets were produced
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property is true and the new current row cannot be locked
- Throws: DataException
- sqlException
- if an SQLException occurred
- See Also:
- setCurrentResult
- setFillCacheOnExecute
lastRow
public void lastRow() throws DataException
- Applies any changes in the current row of the current result set to the database,
and then positions to the last row in the current result set.
If more rows can be fetched from the database they
are fetched before positioning to the last row. For a discussion of when more
rows can be fetched, see the
isEnd
method.
If the current row should be locked ( isLockRows
returns true),
the new current row is locked in the database.
The event propertyChange
is triggered by this method for the
bound properties currentRow and currentRowInCache as well as for the
generated bound properties for each result column.
The event cacheRowsChanged
may be triggered by this method.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property of the associated SelectStatement is true and
the new current row cannot be locked
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- lastRow in class Select
- See Also:
- setCurrentRow
lockRow
public void lockRow() throws DataException
- Locks the current row of the current result set in the database.
No updates can be made to this row using another connection until the lock is released.
The lock is automatically released when you move to another row. You can release
the lock without moving to another row by invoking the
unlockRow
method.
To implement this method, we generate and execute an SQL query that opens a database
cursor locking the row.
If no row can be found in the database exactly matching the current row, an exception
is thrown. Failure to find a matching row may occur if the row was changed in the
database by means other than this ProcedureCall after being fetched.
If more than one row is found in the database, no exception is thrown.
All matching rows are locked.
To insure that only the intended row is locked, make sure that
the query used to produce the result set includes columns that uniquely identify
a row. Also make sure to use the addTable()
method of the associated
StatementMetaData object to identify the table in which the row is to be locked.
Otherwise we will attempt to parse your query for this information, with no guarantee
of success.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- noActiveConnection
- if no active connection exists
- Throws: DataException
- readOnly
- if the result set is read only
- Throws: DataException
- rowNotFound
- if the current row cannot be locked because it cannot be found in the database
- Throws: DataException
- rowNotInDatabase
- if the current row cannot be locked in the database because it has not
yet been written to the database
- Throws: DataException
- lockNotSupported
- if the current row cannot be locked because the database does not have
function required to do so
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- lockRow in class Select
- See Also:
- unlockRow
- setLockRows
newRow
public void newRow(boolean beforeCurrent) throws DataException
- Applies any changes in the current row of the current result set to the database,
inserts a new empty row into the result set, and positions to the new row.
Use the
setColumnValue
method to set values for its columns.
The new row is not inserted into the database until you set values and move to
another row or invoke the updateRow
method.
If you move to another row without setting any values in the new row, the new row
remains in the result set, but has not yet been inserted into the database. You can
return to it later, set values, and insert it into the database.
The event propertyChange
is triggered by this method for the
bound properties currentRow and currentRowInCache as well as for the
generated bound properties for each result column.
The events aboutToAddNewRow
, addedNewRow
, and
cacheRowsChanged
are triggered by this method.
- Parameters:
- beforeCurrent - true, insert the new row before the current row;
false insert the new row after the current row.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- readOnly
- if the result set is read only
- Throws: DataException
- maxSize
- if the maximum number of rows in the result set has been reached
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Overrides:
- newRow in class Select
nextPacket
public void nextPacket() throws DataException
- Fetches the next packet from the database into the current result set. If this causes
the current row to be displaced from the cache any changes in the current row
are first applied to the database, and then the first row in the cache becomes the
current row.
The event cacheRowsChanged
is triggered by this method.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResultSets
- if there are no result sets
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- notOpen
- if the result set is not open
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property is true and
the new current row cannot be locked
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- nextPacket in class Select
nextResult
public void nextResult() throws DataException
- Applies any changes in the current row of the current result set to the database,
and then positions to the next result set.
If the next result set has not already been fetched from the database, it is fetched.
If no more result sets can be fetched, your position does not change, and
no exception is thrown. Thus, if you are on the last result set, repeatedly invoking
this method has no effect. For a discussion of when no more result sets can be fetched,
see the isLastResult
method.
If the current row should be locked ( isLockRows
returns true),
the current row of the new current result set is locked in the database.
The event propertyChange
is triggered by this method for the
bound properties currentResultSet and currentResultSetInCache as well as for the
generated bound properties for each result column in the new current result.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResultSets
- if no result sets were produced
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property is true and the new current row cannot be locked
- Throws: DataException
- sqlException
- if an SQLException occurred
- See Also:
- setCurrentResult
nextRow
public void nextRow() throws DataException
- Applies any changes in the current row of the current result set to the database,
and then positions to the next row in the result set.
If the next row has not already been fetched from the database, it is fetched, along
with any other rows in the next packet. If no more rows can be fetched, your
position does not change, and no exception is thrown.
Thus, if you are at the end of the result set, repeatedly invoking this method has
no effect. For a discussion of when no more rows can be fetched, see the
isEnd
method.
If the current row should be locked ( isLockRows
returns true),
the new current row is locked in the database.
The event propertyChange
is triggered by this method for the
bound properties currentRow and currentRowInCache as well as for the
generated bound properties for each result column.
The event cacheRowsChanged
may be triggered by this method.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property is true and
the new current row cannot be locked
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- nextRow in class Select
- See Also:
- setCurrentRow
previousResult
public void previousResult() throws DataException
- Applies any changes in the current row of the current result set to the database,
and then positions to the previous result set.
If you are already on the first result set, your position does not change, and no exception
is thrown. Thus, if you are on the first result set, repeatedly invoking this method has
no effect.
If the previous result set has been displaced from the cache, your position does not change,
and an exception is thrown to indicate that the request could not be satisfied.
If the current row should be locked ( isLockRows
returns true),
the current row of the new current result set is locked in the database.
The event propertyChange
is triggered by this method for the
bound properties currentResultSet and currentResultSetInCache as well as for the
generated bound properties for each result column in the new current result.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResultSets
- if no result sets were produced
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property is true and the new current row cannot be locked
- Throws: DataException
- beforeResultCacheStart
- if the requested result set is before the start of the cache
- Throws: DataException
- sqlException
- if an SQLException occurred
- See Also:
- setCurrentResult
previousRow
public void previousRow() throws DataException
- Applies any changes in the current row of the current result set to the database,
and then positions to the previous row in the result set.
If you are already on the first row, your position does not change, and no exception
is thrown. Thus, if you are at the beginning of the result set, repeatedly invoking
this method has no effect.
If the previous row has been displaced from the cache, your position does not change,
and an exception is thrown to indicate that the request could not be satisfied.
If the current row should be locked ( isLockRows
returns true),
the new current row is locked in the database.
The event propertyChange
is triggered by this method for the
bound properties currentRow and currentRowInCache as well as for the
generated bound properties for each result column.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property is true and
the new current row cannot be locked
- Throws: DataException
- beforeCacheStart
- if the requested row is before the start of the cache
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- previousRow in class Select
- See Also:
- setCurrentRow
propertyChange
public void propertyChange(PropertyChangeEvent arg1)
- Method to handle events for the PropertyChangeListener interface.
- Parameters:
- arg1 - java.beans.PropertyChangeEvent
- Overrides:
- propertyChange in class Select
refresh
public void refresh() throws DataException
- Refreshes the result set from the database by re-executing the SQL CALL statement.
The statement must currently be open.
Any changes you have made to statement input parameters will take effect when the
statement is re-executed. If you have changed the SQL CALL statement itself in the
StatementMetaData, that change will not take effect. (To make the latter change take
effect, use the
execute
method.
The event cacheRowsChanged
is triggered
by this method.
The events aboutToExecute
and executed
are
triggered by this method.
The event propertyChange
is triggered by this method for the
bound properties currentRow and currentRowInCache as well as for the generated bound
properties for each output parameter.
- Throws: DataException
- notOpen
- if the statement is not open
- Throws: DataException
- noActiveConnection
- if no active connection exists
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- refresh in class Select
- See Also:
- execute
restoreRow
public void restoreRow() throws DataException
- Restores a row's column values to those last known to be in the database.
Use this method when an attempt to lock a row, insert or update a row in the database,
or delete a row from the database has failed. This can occur implicitly when
you try to move to another row. When one of these failures has occurred,
you cannot move to another row until you either correct the problem or
use this method.
If the current row was added via the newRow
method, and you
have not yet inserted it into the database, its column values are reset
to nulls. Otherwise, the current row's column values are reset
to the values originally fetched from the database or the values to
which it was last successfully updated.
If you believe the failure that occurred is correctable by changing one
or more of column values, as for example if the failure was due to
a duplicate key value in the database, you can just change the values
and try the operation again instead of using this method.
The events aboutToSetColumnValue
and columnValueSet
are
triggered by this method.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- readOnly
- if the result set is read only
- Overrides:
- restoreRow in class Select
setColumnValue
public void setColumnValue(int columnNumber,
Object aValue) throws DataException
- Sets (in the current result set) the value of the column at the specified index in the
current row. To set a column value to null, pass null as the value.
The index of the first column is 0.
The column value is not updated in the database until you move to another row,
call the updateRow
method, or close the result set.
The events aboutToSetColumnValue
and columnValueSet
are
triggered by this method.
- Parameters:
- columnNumber - index of the column
- aValue - value for the column
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- readOnly
- if the result set is read only
- Throws: DataException
- noResults
- if the result set is empty
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column index is not defined
- Throws: DataException
- wrongObjectType
- if the value does not match the object type of the column
- Throws: DataException
- truncated
- if data truncation occurred on retrieval.
- Overrides:
- setColumnValue in class Select
- See Also:
- setColumnValueFromString
- getColumnValue
setColumnValue
public void setColumnValue(String columnName,
Object aValue) throws DataException
- Sets (in the current result set) the value of the column with the specified name in the
current row. To set a column value to null, pass null as the value.
The column value is not updated in the database until you move to another row,
call the updateRow
method, or close the result set.
The events aboutToSetColumnValue
and columnValueSet
are
triggered by this method.
- Parameters:
- columnName - name of the column
- aValue - value for the column
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- readOnly
- if the result set is read only
- Throws: DataException
- noResults
- if the result set is empty
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column name is not defined
- Throws: DataException
- wrongObjectType
- if the value does not match the object type of the column
- Throws: DataException
- truncated
- if data truncation occurred on retrieval.
- Overrides:
- setColumnValue in class Select
- See Also:
- setColumnValueFromString
- getColumnValue
setColumnValueFromString
public void setColumnValueFromString(int columnNumber,
String stringValue) throws DataException
- Sets (in the current result set) the value of the column at the specified index in the
current row. The index of the first column is 0. If the ProcedureCall has not been executed
and the specified stringValue is null or has zero length, the method returns without setting
the column value.
The stringValue parameter is converted to the datatype associated
with the column before the value is set.
To set a column value to null, pass null as the value.
If the datatype is not String, you can also set a column value to null
by passing a zero-length String as the value.
The column value is not updated in the database until you move to another row,
call the updateRow
method, or close the result set.
The events aboutToSetColumnValue
and columnValueSet
are
triggered by this method.
- Parameters:
- columnNumber - index of the column
- stringValue - value for the column
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- readOnly
- if the result set is read only
- Throws: DataException
- noResults
- if the result set is empty
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column index is not defined
- Throws: DataException
- cannotConvert
- if cannot convert to object type of column
- Throws: DataException
- truncated
- if data truncation occurred on retrieval.
- Overrides:
- setColumnValueFromString in class Select
- See Also:
- setColumnValue
- getColumnValueToString
setColumnValueFromString
public void setColumnValueFromString(String columnName,
String stringValue) throws DataException
- Sets (in the current result set) the value of the column with the specified name in the
current row. The index of the first column is 0. If the ProcedureCall has not been executed
and the specified stringValue is null or has zero length, the method returns without setting
the column value.
The stringValue parameter is converted to the datatype associated
with the column before the value is set.
To set a column value to null, pass null as the value.
If the datatype is not String, you can also set a column value to null
by passing a zero-length String as the value.
The column value is not updated in the database until you move to another row,
call the updateRow
method, or close the result set.
The events aboutToSetColumnValue
and columnValueSet
are
triggered by this method.
- Parameters:
- columnName - name of the column
- stringValue - value for the column
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- readOnly
- if the result set is read only
- Throws: DataException
- noResults
- if the result set is empty
- Throws: IndexOutOfBoundsException
- noSuchColumn
- if the column name is not defined
- Throws: DataException
- cannotConvert
- if cannot convert to object type of column
- Throws: DataException
- truncated
- if data truncation occurred on retrieval.
- Overrides:
- setColumnValueFromString in class Select
- See Also:
- setColumnValue
- getColumnValueToString
setCurrentResult
public void setCurrentResult(int resultNumber) throws DataException
- Applies any changes in the current row of the current result set to the database,
and then positions to the specified result set. The index of the first result set is 1.
If the specified result set has not yet been fetched, result sets are fetched until the
specified result set is in the cache or no more result sets can be fetched.
If no more result sets can be fetched, and the specified result set was not reached,
you are positioned to the last result set, and an exception is thrown to indicate
that the request could not be satisfied.
If the specified result set has been displaced from the cache, you are positioned to
the first result set in the cache, and an exception is thrown to indicate
that the request could not be satisfied.
If the current row should be locked ( isLockRows
returns true),
the current row of the new current result set is locked in the database.
The event propertyChange
is triggered by this method for the
bound properties currentResultSet and currentResultSetInCache as well as for the
generated bound properties for each result column in the new current result.
- Parameters:
- resultNumber - index of the result set
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResultSets
- if no result sets were produced
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property is true and the new current row cannot be locked
- Throws: DataException
- beforeResultCacheStart
- if the requested result set is before the start of the cache
- Throws: DataException
- resultIndexTooLarge
- if the requested result set is after the last result set
- Throws: DataException
- sqlException
- if an SQLException occurred
- See Also:
- getCurrentResult
setCurrentResultInCache
public void setCurrentResultInCache(int result) throws DataException
- Makes the specified result set in the cache the current result set.
The index of the first result set is 1.
The values of currentResultInCache and currentResult will be the same unless you have
set maximumResultsInCache to a value other than 0 and a result set has been displaced
from the cache.
For example, if one result set has been displaced from the cache and
currentResult is 2, currentResultInCache would be 1.
- Parameters:
- result - the index of the result set in the cache
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResults
- if no result sets were produced
- Throws: DataException
- rowChanged
- if the current row cannot be updated in the database because it has been
modified by another user since it was fetched
- Throws: DataException
- rowNotFound
- if the lockRows property true and the new current row cannot be locked
- Throws: DataException
- beforeResultCacheStart
- if the requested result is before the start of the cache
- Throws: DataException
- indexTooLarge
- if the requested result is after the end of the cache
- Throws: DataException
- sqlException
- if an SQLException occurred
- See Also:
- setCurrentResult
setCurrentRow
public void setCurrentRow(int rowNumber) throws DataException
- Applies any changes in the current row of the current result set to the database,
and then positions to the specified row in the result set.
The index of the first row is 0.
If the specified row has not yet been fetched, packets are fetched until the
specified row is in the cache or no more rows can be fetched.
If no more rows can be fetched, and the specified row was not reached, you are
positioned to the last row, and an exception is thrown to indicate
that the request could not be satisfied. For a discussion of when no more
rows can be fetched, see the isEnd
method.
If the specified row has been displaced from the cache, you are positioned to
the first row in the cache, and an exception is thrown to indicate
that the request could not be satisfied.
If the current row should be locked ( isLockRows
returns true),
the new current row is locked in the database.
The event propertyChange
is triggered by this method for the
bound properties currentRow and currentRowInCache as well as for the
generated bound properties for each result column.
The event cacheRowsChanged
may be triggered by this method.
- Parameters:
- rowNumber - index in the result set of the row
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- rowNotFound
- if the lockRows property is true and
the new current row cannot be locked
- Throws: DataException
- beforeCacheStart
- if the requested row is before the start of the cache
- Throws: DataException
- indexTooLarge
- if the requested row is after the end of the result set
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- setCurrentRow in class Select
- See Also:
- getCurrentRow
setCurrentRowInCache
public void setCurrentRowInCache(int row) throws DataException
- Makes the specified row in the cache the currentRow in the current result set.
The index of the first row is 0.
The values of currentRowInCache and currentRow will be the same unless you have
set maximumPacketsInCache to a value other than 0 and a packet has been displaced
from the cache.
For example, if a packet of 10 rows has been displaced from the cache and the
currentRow is 10, the currentRowInCache would be 0.
- Parameters:
- row - the index of the row in the cache
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- rowChanged
- if the current row cannot be updated in the database because it has been
modified by another user since it was fetched
- Throws: DataException
- rowNotFound
- if the lockRows property true and
the new current row cannot be locked
- Throws: DataException
- beforeCacheStart
- if the requested row is before the start of the cache
- Throws: DataException
- indexTooLarge
- if the requested row is after the end of the result set
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- setCurrentRowInCache in class Select
- See Also:
- setCurrentRow
setFillResultCacheOnExecute
public void setFillResultCacheOnExecute(boolean fillCache)
- If true, as many result sets as allowed are fetched into the cache when
execute
is invoked.
Otherwise, result sets are fetched into the cache as needed to satisfy
a request to set the current result set position.
The number of result sets you are allowed to fetch into the cache is limited by the
maximumResultsInCache property.
If more than one result set is fetched on execute
, all result sets
before the last one fetched are closed. You will not be able to fetch any additional rows
into the closed result sets beyond what was initially fetched when
execute
was invoked.
Because of this, if you set this property to true you should generally
also set the fillCacheOnExecute property to true and not limit the cache size
for each result set,
causing all rows in each result set to be fetched as soon as the result set is opened.
If you never execute this method for a ProcedureCall, the value defaults to true.
- Parameters:
- fillResultCacheOnExecute - true, fetch as many result sets as allowed on
execute
; false fetch result sets only as needed
- See Also:
- isFillResultCacheOnExecute
- setMaximumResultsInCache
- setFillCacheOnExecute
setMaximumResultsInCache
public void setMaximumResultsInCache(int maximumResultsInCache)
- Sets the maximum number of result sets the cache can contain at one time. Set the value
to 0 if there is no limit on the number of result sets in the cache.
If you never execute this method, the value defaults to 0.
- Parameters:
- maximumResultsInCache - the maximum number of result sets in cache
- See Also:
- getMaximumResultsInCache
setParameter
public void setParameter(int parameterNumber,
Object aValue) throws DataException
- Sets the parameter at the specified index to the specified value.
To set a parameter value to null, pass null as the value.
The index of the first parameter is 1.
- Parameters:
- parameterNumber - index of the parameter
- aValue - parameter value
- Throws: IndexOutOfBoundsException
- if the parameter index is not
defined
- Throws: DataException
- wrongObjectType
- if the value does not match the object type of the parameter
- Overrides:
- setParameter in class Select
- See Also:
- setParameterFromString
- getParameter
setParameter
public void setParameter(String parameterName,
Object aValue) throws DataException
- Sets the parameter with the specified name to the specified value.
To set a parameter value to null, pass null as the value.
- Parameters:
- parameterName - name of the parameter
- aValue - parameter value
- Throws: IndexOutOfBoundsException
- if the parameter name is not
defined
- Throws: DataException
- wrongObjectType
- if the value does not match the object type of the parameter
- Overrides:
- setParameter in class Select
- See Also:
- setParameterFromString
- getParameter
setParameterFromString
public void setParameterFromString(int parameterNumber,
String stringValue) throws DataException
- Sets the parameter at the specified index to the specified value.
The index of the first parameter is 1.
The stringValue is converted to the datatype associated with the parameter before the
parameter is updated.
To set a parameter value to null, pass null as the value.
If the datatype is not String, you can also set a parameter value to null
by passing a zero-length String as the value.
- Parameters:
- parameterNumber - index of the parameter
- stringValue - parameter value as a String
- Throws: IndexOutOfBoundsException
- if the parameter index is not
defined
- Throws: DataException
- wrongObjectType
- if the value does not match the object type of the parameter
- Overrides:
- setParameterFromString in class Select
- See Also:
- setParameter
- getParameterToString
setParameterFromString
public void setParameterFromString(String parameterName,
String stringValue) throws DataException
- Sets the parameter with the specified name to the specified value.
The stringValue is converted to the datatype associated with the parameter before the
parameter is updated.
To set a parameter value to null, pass null as the value.
If the datatype is not String, you can also set a parameter value to null
by passing a zero-length String as the value.
- Parameters:
- parameterName - name of the parameter
- stringValue - parameter value as a String
- Throws: IndexOutOfBoundsException
- if the parameter name is not
defined
- Throws: DataException
- wrongObjectType
- if the value does not match the object type of the parameter
- Overrides:
- setParameterFromString in class Select
- See Also:
- setParameter
- getParameterToString
setProcedure
public void setProcedure(Query spec)
- Sets the connection alias and the SQL specification for this ProcedureCall to the
values contained in the specified Query object. The Query object itself is not saved.
- Parameters:
- spec - the Query object
- See Also:
- getProcedure
unlockRow
public void unlockRow() throws DataException
- Unlocks the current row in the current result set. The database lock on the current row
is released.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResultSets
- if there are no result sets
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- readOnly
- if the result set is read only
- Throws: DataException
- notOpen
- if the result set is not open
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- unlockRow in class Select
- See Also:
- lockRow
updateRow
public void updateRow() throws DataException
- Updates the database with the values of the current row in the current result set. If the
current row is a new row, it is inserted into the database. If it is an existing
row, it is updated in the database.
We generate and execute the SQL necessary to update the current row in the database.
To insure that your update affects the intended row in the database, make sure that
the query used to produce the result set includes columns that uniquely identify
a row. Also make sure to use the addTable()
method of the associated
StatementMetaData object to identify the table in which the row is to be updated.
Otherwise we will attempt to parse your query for this information, with no guarantee
of success.
If no row can be found in the database exactly matching the current row, an exception
is thrown. Failure to find a matching row may occur if the row was changed in the
database by means other than this ProcedureCall after being fetched.
If more than one row is found in the database, no exception is thrown. The number of
rows updated depends on whether we perform a positioned or searched update.
Whenever possible, we perform a positioned update, which updates the first matching
row. Otherwise, we perform a searched update, which updates all matching rows and
logs a message. You can avoid having multiple matching rows by including enough columns
in the result set to uniquely identify a row.
For more information on when we perform positioned or searched updates, see the
setForceSearchedUpdate
method.
The events aboutToUpdateRow
and updatedRow
are
triggered by this method.
- Throws: DataException
- notExecuted
- if the statement has not been executed
- Throws: DataException
- noResults
- if the result set is empty
- Throws: DataException
- noActiveConnection
- if no active connection exists
- Throws: DataException
- readOnly
- if the result set is read only
- Throws: DataException
- rowChanged
- if the current row cannot be updated because it cannot be found in the database
- Throws: DataException
- sqlException
- if an SQLException occurred
- Overrides:
- updateRow in class Select
- See Also:
- setForceSearchedUpdate
