com.ibm.db
Class SQLStatement

java.lang.Object
  |
  +--com.ibm.db.Statement
        |
        +--com.ibm.db.SQLStatement

public class SQLStatement
extends Statement

SQLStatement represents an SQL statement that doesn't return a result set.

See Also:
Statement, Serialized Form

Field Summary
private static java.lang.String copyright
           
protected  int fieldNumAffectedRows
           
 
Fields inherited from class com.ibm.db.Statement
aStatementAfterListener, aStatementBeforeListener, copyright, executingSQL, fieldConnection, fieldDistinctTypesEnabled, fieldExecuted, fieldMetaData, fieldReadOnly, fieldTimeout, fieldValidateLOBs, parameters, propertyChange, rt, serialVersionUID
 
Constructor Summary
SQLStatement()
          Constructs a new SQLStatement.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a listener to the PropertyChange event set.
 void cancelExecution()
          Cancels execution of the SQL statement which is associated with this SQLStatement.
 void execute()
          Executes the SQL statement.
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Method to support listener events.
 int getNumAffectedRows()
          Returns the number of rows that were affected by executing the SQL statement.
protected  java.beans.PropertyChangeSupport getPropertyChange()
          Accessor for the propertyChange field.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a listener to the PropertyChange event set.
 
Methods inherited from class com.ibm.db.Statement
addStatementAfterListener, addStatementBeforeListener, applyTimeout, connect, copyParameters, finalize, fireAboutToExecute, fireExecuted, getConnection, getMetaData, getParameter, getParameter, getParameters, getParameterToString, getParameterToString, getTimeout, handleSQLException, isExecuted, isReadOnly, isValidateLOBs, readObject, removeStatementAfterListener, removeStatementBeforeListener, replaceHostVars, setConnection, setMetaData, setParameter, setParameter, setParameterFromString, setParameterFromString, setReadOnly, setTimeout, setValidateLOBs
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

fieldNumAffectedRows

protected int fieldNumAffectedRows

copyright

private static final java.lang.String copyright
Constructor Detail

SQLStatement

public SQLStatement()
Constructs a new SQLStatement.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a listener to the PropertyChange event set. PropertyChange events occur when the bound property numAffectedRows is changed.
Parameters:
listener - PropertyChangeListener

See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener)

cancelExecution

public void cancelExecution()
                     throws DataException
Cancels execution of the SQL statement which is associated with this SQLStatement. In order to use this method, it must be invoked from a thread different from the one in which the SQL statement is running.
Overrides:
cancelExecution in class Statement
Throws:
DataException - noConnection - if no associated DatabaseConnection
DataException - notExecuting - if the statement is not currently being executed
DataException - sqlException - if an SQLException occurred

execute

public void execute()
             throws DataException
Executes the SQL statement. If needed, a connection is made to the database prior to executing the SQL statement, using the associated DatabaseConnection. The SQL statement is obtained from the StatementMetaData associated with this SQLStatement.

The events aboutExecute and executed are triggered by this method.

Overrides:
execute in class Statement
Throws:
DataException - noConnection - if no associated DatabaseConnection
DataException - noSQL - if the SQL statement is null
See Also:
DatabaseConnection, StatementMetaData

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
Method to support listener events.

getNumAffectedRows

public int getNumAffectedRows()
Returns the number of rows that were affected by executing the SQL statement.
Returns:
the number of affected rows

getPropertyChange

protected java.beans.PropertyChangeSupport getPropertyChange()
Accessor for the propertyChange field.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a listener to the PropertyChange event set. PropertyChange events occur when the bound property numAffectedRows is changed.
Parameters:
listener - PropertyChangeListener

See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener)