Where Am I? Class Hierarchy All Classes All Fields and Methods

Class com.ibm.db.Statement

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

public abstract class Statement
implements Serializable
extends Object

Statement is an abstract super class that represents an SQL statement.

See Also:
SelectStatement
SQLStatement
CallableStatement

Constructor Index

Statement()
Constructs a new Statement.

Method Index

addStatementAfterListener(StatementAfterListener)
Adds a listener to the StatementAfter event set.
addStatementBeforeListener(StatementBeforeListener)
Adds a listener to the StatementBefore event set.
cancelExecution()
Cancels execution (in another thread) of the SQL statement associated with this Statement.
execute()
Executes the SQL statement.
getConnection()
Returns the DatabaseConnection associated with this Statement.
getMetaData()
Returns the StatementMetaData associated with the Statement.
getParameter(int)
Returns the value of the parameter at the specified index.
getParameter(String)
Returns the value of the parameter with the specified name.
getParameterToString(int)
Returns the value of the parameter at the specified index as a String.
getParameterToString(String)
Returns the value of the parameter with the specified name as a String.
getTimeout()
Returns the number of seconds the JDBC driver will wait for this statement to execute.
isExecuted()
Returns true if execute has been invoked for the Statement.
isReadOnly()
Returns true if updates are disallowed even when the database would permit them.
removeStatementAfterListener(StatementAfterListener)
Removes a listener to the StatementAfter event set.
removeStatementBeforeListener(StatementBeforeListener)
Removes a listener to the StatementBefore event set.
setConnection(DatabaseConnection)
Associates a DatabaseConnection with the Statement.
setMetaData(StatementMetaData)
Associates a StatementMetaData with the Statement.
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.
setReadOnly(boolean)
If true, updates are disallowed even when the database would permit them.
setTimeout(int)
Sets the number of seconds the JDBC driver will wait for this statement to execute.

Constructors

Statement
 public Statement() 
Constructs a new Statement.


Methods

addStatementAfterListener
 public void addStatementAfterListener(StatementAfterListener listener) 
Adds a listener to the StatementAfter event set. StatementAfter events occur after statement-scoped actions have completed such as execute and refresh.

Parameters:
listener - StatementAfterListener
See Also:
StatementAfterListener
removeStatementAfterListener
addStatementBeforeListener
 public void addStatementBeforeListener(StatementBeforeListener listener) 
Adds a listener to the StatementBefore event set. StatementBefore events occur before statement-scoped actions such as execute and refresh.

Parameters:
listener - StatementBeforeListener
See Also:
StatementBeforeListener
removeStatementBeforeListener
cancelExecution
 public abstract void cancelExecution() throws DataException
Cancels execution (in another thread) of the SQL statement associated with this Statement. See subclasses for implementation details.

Throws: DataException
- if an error occurs
execute
 public abstract void execute() throws DataException
Executes the SQL statement. See subclasses for more detail.

Throws: DataException
- if an error occurs
getConnection
 public DatabaseConnection getConnection() 
Returns the DatabaseConnection associated with this Statement.

Returns:
the associated DatabaseConnection
See Also:
setConnection
getMetaData
 public StatementMetaData getMetaData() 
Returns the StatementMetaData associated with the Statement.

Returns:
the associated StatementMetaData
See Also:
setMetaData
getParameter
 public Object getParameter(int parameterNumber) throws DataException
Returns the value of the parameter at the specified index. If the parameter value is null, a null is returned. The index of the first parameter is 1.

Parameters:
parameterNumber - index of the parameter
Returns:
the parameter value
Throws: IndexOutOfBoundsException
if the parameter index is not defined
Throws: DataException
sqlException - if an SQL Exception is raised (only thrown by CallableStatement)
See Also:
getParameterToString
setParameter
getParameter
 public Object getParameter(String parameterName) throws DataException
Returns the value of the parameter with the specified name. If the parameter value is null, a null is returned.

Parameters:
parameterName - name of the parameter
Returns:
the parameter value
Throws: IndexOutOfBoundsException
if the parameter name is not defined
Throws: DataException
sqlException - if an SQL Exception is raised (only thrown by CallableStatement)
See Also:
getParameterToString
setParameter
getParameterToString
 public String getParameterToString(int parameterNumber) throws DataException
Returns the value of the parameter at the specified index as a String. The value of the parameter is converted to a String before the value is returned. If the parameter value is null, a null is returned. The index of the first parameter is 1.

Parameters:
parameterNumber - index of the parameter
Returns:
value of the parameter as a String
Throws: IndexOutOfBoundsException
if the parameter index is not defined
Throws: DataException
sqlException - if an SQL Exception is raised (only thrown by CallableStatement)
See Also:
getParameter
setParameterFromString
getParameterToString
 public String getParameterToString(String parameterName) throws DataException
Returns the value of the parameter with the specified name as a String. The value of the parameter is converted to a String before the value is returned. If the parameter value is null, a null is returned.

Parameters:
parameterName - name of the parameter
Returns:
value of the parameter as a String
Throws: IndexOutOfBoundsException
if the parameter name is not defined
Throws: DataException
sqlException - if an SQL Exception is raised (only thrown by CallableStatement)
See Also:
getParameter
setParameterFromString
getTimeout
 public int getTimeout() 
Returns the number of seconds the JDBC driver will wait for this statement to execute. If the limit is exceeded, a DataException is thrown by the execute method.

Returns:
the timeout limit in seconds; zero means unlimited
See Also:
setTimeout
isExecuted
 public boolean isExecuted() 
Returns true if execute has been invoked for the Statement.

Returns:
true if execute has been invoked for the Statement, otherwise false.
isReadOnly
 public boolean isReadOnly() 
Returns true if updates are disallowed even when the database would permit them. Returns false if updates are allowed as long as the database will permit them.

Returns:
true if updates are disallowed, otherwise false.
See Also:
setReadOnly
removeStatementAfterListener
 public void removeStatementAfterListener(StatementAfterListener listener) 
Removes a listener to the StatementAfter event set. StatementAfter events occur after statement-scoped actions have completed, such as execute and refresh.

Parameters:
listener - StatementAfterListener
See Also:
StatementAfterListener
addStatementAfterListener
removeStatementBeforeListener
 public void removeStatementBeforeListener(StatementBeforeListener listener) 
Removes a listener to the StatementBefore event set. StatementBefore events occur before statement-scoped actions such as execute and refresh.

Parameters:
listener - StatementBeforeListener
See Also:
StatementBeforeListener
addStatementBeforeListener
setConnection
 public void setConnection(DatabaseConnection connection) 
Associates a DatabaseConnection with the Statement.

Parameters:
connection - the associated DatabaseConnection
See Also:
getConnection
setMetaData
 public synchronized void setMetaData(StatementMetaData metaData) 
Associates a StatementMetaData with the Statement.

Parameters:
metaData - the associated StatementMetaData
See Also:
getMetaData
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
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
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
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
See Also:
setParameter
getParameterToString
setReadOnly
 public void setReadOnly(boolean aValue) 
If true, updates are disallowed even when the database would permit them. If false, updates are allowed as long as the database will permit them. The default value is false.

Parameters:
aValue - true if updates are disallowed; false if updates are allowed.
See Also:
isReadOnly
setTimeout
 public void setTimeout(int seconds) 
Sets the number of seconds the JDBC driver will wait for this statement to execute. If the limit is exceeded, a DataException is thrown by the execute method.

Parameters:
seconds - the new timeout limit in seconds; zero means unlimited
See Also:
getTimeout

Where Am I? Class Hierarchy All Classes All Fields and Methods