Class com.ibm.db.Statement
java.lang.Object
|
+----com.ibm.db.Statement
- public abstract class Statement
- extends Object
- implements Serializable
Statement is an abstract super class that represents a SQL statement.
- Version:
- 1.0 06/30/98
- See Also:
- SelectStatement, SQLStatement
Constructor Index
- Statement()
- Constructs a new Statement.
Method Index
- addStatementAfterListener(StatementAfterListener)
- Adds the StatementAfterListener.
- addStatementBeforeListener(StatementBeforeListener)
- Adds the StatementBeforeListener.
- 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.
- 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)
-
- removeStatementBeforeListener(StatementBeforeListener)
-
- 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.
Constructors
Statement
public Statement()
- Constructs a new Statement.
Methods
addStatementAfterListener
public void addStatementAfterListener(StatementAfterListener newListener)
- Adds the StatementAfterListener. StatementAfter events occur after
statement scoped actions have completed such as execute and refresh.
- Parameters:
- newListener - StatementAfterListener
- See Also:
- StatementAfterListener, removeStatementAfterListener
addStatementBeforeListener
public void addStatementBeforeListener(StatementBeforeListener newListener)
- Adds the StatementBeforeListener. StatementAfter events occur before
statement scoped actions such as execute and refresh.
- Parameters:
- newListener - StatementBeforeListener
- See Also:
- StatementBeforeListener, removeStatementBeforeListener
execute
public abstract void execute() throws DataException
- Executes the SQL statement. See subclasses for implementation.
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)
- Returns the value of the parameter at the specified index.
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
- See Also:
- setParameter
getParameter
public Object getParameter(String parameterName)
- Returns the value of the parameter with the specified name.
- Parameters:
- parameterName - name of the parameter
- Returns:
- the parameter value
- Throws: IndexOutOfBoundsException
- if the parameter name is not
defined
- See Also:
- setParameter
getParameterToString
public String getParameterToString(int parameterNumber)
- 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
- See Also:
- setParameterFromString
getParameterToString
public String getParameterToString(String parameterName)
- 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
- See Also:
- setParameterFromString
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 newListener)
- Parameters:
- newListener - StatementAfterListener
removeStatementBeforeListener
public void removeStatementBeforeListener(StatementBeforeListener newListener)
- Parameters:
- newListener - StatementBeforeListener
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:
- meteData - 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.
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
- if the value does match the object type
of the parameter
- See Also:
- getParameter
setParameter
public void setParameter(String parameterName,
Object aValue) throws DataException
- Sets the parameter with the specified name to the specified value.
- Parameters:
- parameterName - name of the parameter
- aValue - parameter value
- Throws: IndexOutOfBoundsException
- if the parameter name is not
defined
- Throws: DataException
- if the value does match the object type
of the parameter
- See Also:
- getParameter
setParameterFromString
public void setParameterFromString(int parameterNumber,
String stringValue) throws DataException
- Sets the parameter at the specified index to the specified value. The stringValue
is converted to the datatype associated with the parameter before the
parameter is updated. The index of the first parameter is 1.
- Parameters:
- parameterNumber - index of the parameter
- stringValue - parameter value as a String
- Throws: IndexOutOfBoundsException
- if the parameter index is not
defined
- Throws: DataException
- if the value does match the object type
of the parameter
- See Also:
- 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.
- Parameters:
- parameterName - name of the parameter
- stringValue - parameter value as a String
- Throws: IndexOutOfBoundsException
- if the parameter name is not
defined
- Throws: DataException
- if the value does match the object type
of the parameter
- See Also:
- 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
