org.apache.beehive.controls.system.jdbc.parser
Class SqlStatement

Object
  extended by SqlFragment
      extended by SqlFragmentContainer
          extended by SqlStatement
All Implemented Interfaces:
Serializable

public final class SqlStatement
extends SqlFragmentContainer
implements Serializable

Represents a fully parsed SQL statement. SqlStatements can be used to generated a java.sql.PreparedStatement.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class SqlFragmentContainer
_children
 
Method Summary
 PreparedStatement createPreparedStatement(ControlBeanContext context, Connection connection, Calendar calendar, Method method, Object[] arguments)
          Generates the PreparedStatement the SQL statement.
 String createPreparedStatementString(ControlBeanContext context, Connection connection, Method method, Object[] arguments)
          Generates the PreparedStatement the SQL statement.
 boolean getsGeneratedKeys()
          Does this statement return generatedKeys?
 boolean isBatchUpdate()
          Does this statement do a batch update?
 boolean isCallableStatement()
          Does this statement generate a callable or prepared statement?
 
Methods inherited from class SqlFragmentContainer
toString
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

isCallableStatement

public boolean isCallableStatement()
Does this statement generate a callable or prepared statement?

Returns:
true if this statement generates callable statement.

isBatchUpdate

public boolean isBatchUpdate()
Does this statement do a batch update?

Returns:
true if this statement should be executed as a batch update.

getsGeneratedKeys

public boolean getsGeneratedKeys()
Does this statement return generatedKeys?

Returns:
true if getGeneratedKeys set to true.

createPreparedStatement

public PreparedStatement createPreparedStatement(ControlBeanContext context,
                                                 Connection connection,
                                                 Calendar calendar,
                                                 Method method,
                                                 Object[] arguments)
                                          throws SQLException
Generates the PreparedStatement the SQL statement.

Parameters:
context - ControlBeanContext instance.
connection - Connection to database.
calendar - Calendar instance which can be used to resolve date/time values.
method - Method the SQL is associated with.
arguments - Method parameters.
Returns:
The PreparedStatement generated by this statement.
Throws:
SQLException - If PreparedStatement cannot be created.

createPreparedStatementString

public String createPreparedStatementString(ControlBeanContext context,
                                            Connection connection,
                                            Method method,
                                            Object[] arguments)
Generates the PreparedStatement the SQL statement.

Parameters:
context - ControlBeanContext instance.
connection - Connection to database.
method - Method the SQL is associated with.
arguments - Method parameters.
Returns:
The PreparedStatement generated by this statement.