All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.samples.daps.sql.Statement

java.lang.Object
   |
   +----com.ibm.beans.samples.daps.sql.Common
           |
           +----com.ibm.beans.samples.daps.sql.Statement

public abstract class Statement
extends Common
The Statement class is instantiated via subclasses to represent a single SQL statement. Added functionality includes support for the JDBCConnection and SQLText properties, and the general flow of the execute() and close() methods.

Multiple instances of subclasses of Statement are all related to a single instance of Connection.

This class is an abstract class used by the DDL and DML classes.

See Also:
Connection, DDL, DML, StatementBeanInfo

Variable Index

 o CLOSE
Background thread closing SQL statement.
 o EXECUTE
Background thread executing SQL statement.
 o JDBCConnection
The JDBC java.sql.connection provided by a Connection object.
 o LASTTASK
Last possible task value.
 o preparedStatement
The java.sql.PreparedStatement encapsulated by this Statement object.
 o SQLText
The SQL statement text for this statement.

Constructor Index

 o Statement()
Default constructor.

Method Index

 o close()
Close a statement and free the statement resources.
 o closeBackground()
The actual background thread code that executes the close operation.
 o execute()
Execute a statement.
 o executeBackground()
The actual background thread code that executes the statement.
 o executeStatement()
Method to execute an SQL statement.
 o finalize()
Finalize this object.
 o getJDBCConnection()
Returns the JDBC database JDBCConnection object from a Connection object.
 o getSQLText()
Get the SQL text.
 o handleInputValues()
Method to handle input values for an SQL statement.
 o handleResultMetaData()
Method to handle result meta data for an SQL statement.
 o performWork()
Call method based on the background task to be performed.
 o prepareStatement()
Method to prepare SQL statement and rethrow any exceptions.
 o setJDBCConnection(Connection)
Set the JDBC database connection object.
 o setSQLText(String)
Set the SQL text.

Variables

 o JDBCConnection
 protected transient Connection JDBCConnection
The JDBC java.sql.connection provided by a Connection object.

This value is used by the executeBackground() and prepareStatement() methods. It must be set prior to the execute() method.

See Also:
Connection, Connection
 o SQLText
 protected String SQLText
The SQL statement text for this statement.

This value is used by the prepareStatement() method. This property must be set prior to the execute() method.

 o preparedStatement
 protected transient PreparedStatement preparedStatement
The java.sql.PreparedStatement encapsulated by this Statement object.

See Also:
PreparedStatement
 o EXECUTE
 protected static final transient int EXECUTE
Background thread executing SQL statement.

 o CLOSE
 protected static final transient int CLOSE
Background thread closing SQL statement.

 o LASTTASK
 protected static final transient int LASTTASK
Last possible task value.

This is used by the Select class.

Constructors

 o Statement
 public Statement()
Default constructor.

Methods

 o finalize
 protected void finalize() throws Throwable
Finalize this object.

Throws: Throwable
Possibly thrown by the superclass.
Overrides:
finalize in class Common
 o getJDBCConnection
 public Connection getJDBCConnection()
Returns the JDBC database JDBCConnection object from a Connection object.

Returns:
The java.sql.Connection object; null if not connected.
 o setJDBCConnection
 public synchronized void setJDBCConnection(Connection JDBCConnection)
Set the JDBC database connection object.

This value is used by the execute() method.

This method will typically called via wiring or scripting to set the Connection object from a Connection.

Fire the property change event for the JDBCConnection object.

Parameters:
JDBCConnection - The JDBC database connection.
 o getSQLText
 public String getSQLText()
Get the SQL text.

Returns:
The SQL text specifying the SQL statement for this object.
 o setSQLText
 public synchronized void setSQLText(String SQLText)
Set the SQL text.

This value is used by the execute() method.

Fire the property change event for the SQLText string.

Parameters:
SQLText - The SQL text specifying the SQL statement for this object.
 o execute
 public synchronized void execute()
Execute a statement.

The JDBCConnection and SQLText properties are used by this method's background thread operation.

The exception and successful properties are indirectly set by this method.

This methods background thread operation invokes the prepareStatement(), handleInputValues(), executeStatement() and handleResultMetaData() methods that are overridden by the various Statement subclasses.

See Also:
executeBackground
 o executeBackground
 protected void executeBackground() throws SQLException, NullPointerException
The actual background thread code that executes the statement.

The JDBCConnection property is used by this method.

Throws: SQLException
SQL Exception
Throws: NullPointerException
Pointer not set
 o prepareStatement
 protected void prepareStatement() throws SQLException
Method to prepare SQL statement and rethrow any exceptions.

The JDBCConnection property is used by this method.

Throws: SQLException
Thrown by the JDBCConnection's prepareStatement method
 o handleInputValues
 protected void handleInputValues() throws SQLException
Method to handle input values for an SQL statement.

Throws: SQLException
Thrown by subclasses
 o executeStatement
 protected void executeStatement() throws SQLException
Method to execute an SQL statement.

Throws: SQLException
Thrown by the preparedStatement's execute() method.
 o handleResultMetaData
 protected void handleResultMetaData() throws SQLException
Method to handle result meta data for an SQL statement.

Throws: SQLException
Thrown by subclasses
 o close
 public synchronized void close()
Close a statement and free the statement resources.

The exception and successful properties are indirectly set by this method.

See Also:
closeBackground
 o closeBackground
 protected void closeBackground() throws SQLException, NullPointerException
The actual background thread code that executes the close operation.

Throws: SQLException
SQL Exception
Throws: NullPointerException
Pointer not set
 o performWork
 protected void performWork() throws SQLException, NullPointerException
Call method based on the background task to be performed. The caller has guaranteed this will NOT be called for the INITIAL task.

Throws: SQLException
SQL Exception
Throws: NullPointerException
Pointer not set
Overrides:
performWork in class Common

All Packages  Class Hierarchy  This Package  Previous  Next  Index