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

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.
 int getNumAffectedRows()
          Returns the number of rows that were affected by executing the SQL statement.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a listener to the PropertyChange event set.
 
Methods inherited from class com.ibm.db.Statement
addStatementAfterListener, addStatementBeforeListener, getConnection, getMetaData, getParameter, getParameter, getParameterToString, getParameterToString, getTimeout, isExecuted, isReadOnly, isValidateLOBs, removeStatementAfterListener, removeStatementBeforeListener, setConnection, setMetaData, setParameter, setParameter, setParameterFromString, setParameterFromString, setReadOnly, setTimeout, setValidateLOBs
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.
Throws:
DataException - noConnection - if no associated DatabaseConnection
DataException - notExecuting - if the statement is not currently being executed
DataException - sqlException - if an SQLException occurred
Overrides:
cancelExecution in class Statement

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.

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

getNumAffectedRows

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

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)