|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.db.Statement
Statement is an abstract super class that represents an SQL statement.
SelectStatement
,
SQLStatement
,
CallableStatement
, Serialized FormField Summary | |
protected StatementAfterListener |
aStatementAfterListener
|
protected StatementBeforeListener |
aStatementBeforeListener
|
private static java.lang.String |
copyright
|
protected boolean |
executingSQL
|
protected DatabaseConnection |
fieldConnection
|
protected boolean |
fieldDistinctTypesEnabled
|
protected boolean |
fieldExecuted
|
protected StatementMetaData |
fieldMetaData
|
protected boolean |
fieldReadOnly
|
protected int |
fieldTimeout
|
protected boolean |
fieldValidateLOBs
|
protected DatabaseRow |
parameters
|
protected java.beans.PropertyChangeSupport |
propertyChange
|
protected DatabaseResultTable |
rt
|
(package private) static long |
serialVersionUID
|
Constructor Summary | |
Statement()
Constructs a new Statement. |
Method Summary | |
void |
addStatementAfterListener(StatementAfterListener listener)
Adds a listener to the StatementAfter event set. |
void |
addStatementBeforeListener(StatementBeforeListener listener)
Adds a listener to the StatementBefore event set. |
protected void |
applyTimeout()
This method calls setTimeout on the com.ibm.db.DatabaseResultTable using the value currently set for this Statement bean. |
abstract void |
cancelExecution()
Cancels execution (in another thread) of the SQL statement associated with this Statement. |
protected boolean |
connect()
Connects to the database if you are not already connected. |
protected void |
copyParameters(DatabaseRow newParms)
This method was created by a SmartGuide. |
abstract void |
execute()
Executes the SQL statement. |
protected void |
finalize()
Code to perform when this object is garbage collected. |
protected void |
fireAboutToExecute(DataEvent event)
Method to support listener events. |
protected void |
fireExecuted(DataEvent event)
Method to support listener events. |
DatabaseConnection |
getConnection()
Returns the DatabaseConnection associated with this Statement. |
StatementMetaData |
getMetaData()
Returns the StatementMetaData associated with the Statement. |
java.lang.Object |
getParameter(int parameterNumber)
Returns the value of the parameter at the specified index. |
java.lang.Object |
getParameter(java.lang.String parameterName)
Returns the value of the parameter with the specified name. |
protected DatabaseRow |
getParameters()
Returns a DatabaseRow object that contains the names and values of all of the parameters that have been defined for this statement. |
java.lang.String |
getParameterToString(int parameterNumber)
Returns the value of the parameter at the specified index as a String. |
java.lang.String |
getParameterToString(java.lang.String parameterName)
Returns the value of the parameter with the specified name as a String. |
int |
getTimeout()
Returns the number of seconds the JDBC driver will wait for this statement to execute. |
protected static void |
handleSQLException(java.sql.SQLException ex)
This method was created by a SmartGuide. |
boolean |
isExecuted()
Returns true if execute has been invoked for the Statement. |
boolean |
isReadOnly()
Returns true if updates are disallowed even when the database would permit them. |
boolean |
isValidateLOBs()
Returns true validates LOBs before they are returned from the cache. |
private void |
readObject(java.io.ObjectInputStream in)
This method was reads in the serialized object and restores the following static/transient fields: propertyChange - contains a reference to a PropertyChangeSupport instance. |
void |
removeStatementAfterListener(StatementAfterListener listener)
Removes a listener to the StatementAfter event set. |
void |
removeStatementBeforeListener(StatementBeforeListener listener)
Removes a listener to the StatementBefore event set. |
protected static java.lang.String |
replaceHostVars(java.lang.String statement)
This method was created by a SmartGuide. |
void |
setConnection(DatabaseConnection connection)
Associates a DatabaseConnection with the Statement. |
void |
setMetaData(StatementMetaData metaData)
Associates a StatementMetaData with the Statement. |
void |
setParameter(int parameterNumber,
java.lang.Object aValue)
Sets the parameter at the specified index to the specified value. |
void |
setParameter(java.lang.String parameterName,
java.lang.Object aValue)
Sets the parameter with the specified name to the specified value. |
void |
setParameterFromString(int parameterNumber,
java.lang.String stringValue)
Sets the parameter at the specified index to the specified value. |
void |
setParameterFromString(java.lang.String parameterName,
java.lang.String stringValue)
Sets the parameter with the specified name to the specified value. |
void |
setReadOnly(boolean aValue)
If true, updates are disallowed even when the database would permit them. |
void |
setTimeout(int seconds)
Sets the number of seconds the JDBC driver will wait for this statement to execute. |
void |
setValidateLOBs(boolean validateLOBs)
If true, validates LOBs before they are returned from the cache. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected DatabaseConnection fieldConnection
protected boolean fieldExecuted
protected StatementMetaData fieldMetaData
protected boolean fieldReadOnly
protected boolean fieldDistinctTypesEnabled
protected int fieldTimeout
protected boolean fieldValidateLOBs
protected DatabaseRow parameters
protected transient DatabaseResultTable rt
protected transient boolean executingSQL
protected transient java.beans.PropertyChangeSupport propertyChange
protected transient StatementBeforeListener aStatementBeforeListener
protected transient StatementAfterListener aStatementAfterListener
static final long serialVersionUID
private static final java.lang.String copyright
Constructor Detail |
public Statement()
Method Detail |
public void addStatementAfterListener(StatementAfterListener listener)
execute
and
refresh
.listener
- StatementAfterListenerStatementAfterListener
,
removeStatementAfterListener(com.ibm.db.StatementAfterListener)
public void addStatementBeforeListener(StatementBeforeListener listener)
listener
- StatementBeforeListenerStatementBeforeListener
,
removeStatementBeforeListener(com.ibm.db.StatementBeforeListener)
protected void applyTimeout() throws DataException
public abstract void cancelExecution() throws DataException
protected boolean connect() throws DataException
protected void copyParameters(DatabaseRow newParms)
public abstract void execute() throws DataException
protected void finalize() throws java.lang.Throwable
protected void fireAboutToExecute(DataEvent event)
event
- DataEventprotected void fireExecuted(DataEvent event)
event
- DataEventpublic DatabaseConnection getConnection()
setConnection(com.ibm.db.DatabaseConnection)
public StatementMetaData getMetaData()
setMetaData(com.ibm.db.StatementMetaData)
public java.lang.Object getParameter(int parameterNumber) throws DataException
parameterNumber
- index of the parametergetParameterToString(int)
,
setParameter(int, java.lang.Object)
public java.lang.Object getParameter(java.lang.String parameterName) throws DataException
parameterName
- name of the parametergetParameterToString(int)
,
setParameter(int, java.lang.Object)
protected DatabaseRow getParameters()
public java.lang.String getParameterToString(int parameterNumber) throws DataException
parameterNumber
- index of the parametergetParameter(int)
,
setParameterFromString(int, java.lang.String)
public java.lang.String getParameterToString(java.lang.String parameterName) throws DataException
parameterName
- name of the parametergetParameter(int)
,
setParameterFromString(int, java.lang.String)
public int getTimeout()
setTimeout(int)
protected static void handleSQLException(java.sql.SQLException ex) throws DataException
public boolean isExecuted()
execute
has been invoked for the Statement.execute
has been invoked for the Statement,
otherwise false.public boolean isReadOnly()
setReadOnly(boolean)
public boolean isValidateLOBs()
setValidateLOBs(boolean)
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- ObjectInputStreampublic void removeStatementAfterListener(StatementAfterListener listener)
execute
and
refresh
.listener
- StatementAfterListenerStatementAfterListener
,
addStatementAfterListener(com.ibm.db.StatementAfterListener)
public void removeStatementBeforeListener(StatementBeforeListener listener)
execute
and refresh
.listener
- StatementBeforeListenerStatementBeforeListener
,
addStatementBeforeListener(com.ibm.db.StatementBeforeListener)
protected static java.lang.String replaceHostVars(java.lang.String statement)
public void setConnection(DatabaseConnection connection)
connection
- the associated DatabaseConnectiongetConnection()
public void setMetaData(StatementMetaData metaData)
metaData
- the associated StatementMetaDatagetMetaData()
public void setParameter(int parameterNumber, java.lang.Object aValue) throws DataException
parameterNumber
- index of the parameteraValue
- parameter valuesetParameterFromString(int, java.lang.String)
,
getParameter(int)
public void setParameter(java.lang.String parameterName, java.lang.Object aValue) throws DataException
parameterName
- name of the parameteraValue
- parameter valuesetParameterFromString(int, java.lang.String)
,
getParameter(int)
public void setParameterFromString(int parameterNumber, java.lang.String stringValue) throws DataException
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.
parameterNumber
- index of the parameterstringValue
- parameter value as a StringsetParameter(int, java.lang.Object)
,
getParameterToString(int)
public void setParameterFromString(java.lang.String parameterName, java.lang.String stringValue) throws DataException
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.
parameterName
- name of the parameterstringValue
- parameter value as a StringsetParameter(int, java.lang.Object)
,
getParameterToString(int)
public void setReadOnly(boolean aValue)
aValue
- true if updates are disallowed;
false if updates are allowed.isReadOnly()
public void setTimeout(int seconds)
seconds
- the new timeout limit in seconds; zero means unlimitedgetTimeout()
public void setValidateLOBs(boolean validateLOBs)
isValidateLOBs()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |