2004.04.29


com.jdc.rdb.sql
Class SQL

java.lang.Object
  |
  +--com.jdc.lang.Object
        |
        +--com.jdc.rdb.sql.SQL
All Implemented Interfaces:
Serializable, Statement
Direct Known Subclasses:
DDL, DML

public class SQL
extends Object
implements Statement, Serializable

SQL represents a Structured Query Language (SQL) statement. This class is the superclass for all Data Definition Language (DDL) and Data Manipulation Language (DML) statement classes.

The following Structure Query Language statements are supported:

Refer to the DDL and DML statement classes for the specific SQL statements supported..
Reference:
SQL Standards Process
IBM® DB2 Universal Database™ References:
IBM® DB2 Universal Database™ SQL Reference Volume 1 Version 8
IBM® DB2 Universal Database™ SQL Reference Volume 2 Version 8
Oracle® Database Documentation
MySQL® Database Documentation

Version:
1.5
Author:
Jay Damon
See Also:
DDL, DML, Serialized Form

Field Summary
 
Fields inherited from class com.jdc.lang.Object
string
 
Constructor Summary
SQL(String statement)
          Constructs a new SQL statement object for the specified SQL statement.
 
Method Summary
protected  void addClause(int index, Clause clause)
          Adds the specified SQL Clause for this SQL Statement to the list of SQL statement clauses.
 SQLStatus execute(boolean displayMessages)
          Executes the requested SQL statement.
protected  void finalize()
          Ensures the SQL statement Database Connection is closed when called by the garbage collector.
protected  SQLClause getClause(Class clause)
          Returns the SQL statement clause for the specified SQL statement clause Class.
 String getCommand()
          Returns the SQL statement command.
 Connection getConnection()
          Returns the Database Connection to use to execute the SQL statement.
 String getStatement()
          Returns the SQL statement.
protected  boolean isValid()
          Returns true if the SQL statement is valid.
protected  SQL setCommand(String command)
          Sets the SQL statement command.
 SQL setConnection(Connection connection)
          Sets the Database Connection to use to execute the SQL statement.
protected  SQL setStatement(String statement)
          Sets the SQL statement.
 String toString()
          Returns a String representation of this SQL statement.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SQL

public SQL(String statement)
Constructs a new SQL statement object for the specified SQL statement.

Throws:
SQLInvalidException - No SQL statement or command is specified.
Method Detail

addClause

protected void addClause(int index,
                         Clause clause)
Adds the specified SQL Clause for this SQL Statement to the list of SQL statement clauses. Specify an SQL statement clause position from 1 to 15; otherwise, specify -1 to add the SQL statement clause to the end of the list.


finalize

protected void finalize()
Ensures the SQL statement Database Connection is closed when called by the garbage collector.

Overrides:
finalize in class Object

execute

public SQLStatus execute(boolean displayMessages)
Executes the requested SQL statement.

Returns:
Status The SQL statement execution status.

getClause

protected SQLClause getClause(Class clause)
Returns the SQL statement clause for the specified SQL statement clause Class.


getCommand

public String getCommand()
Returns the SQL statement command.

Returns:
The SQL statement command.

getConnection

public Connection getConnection()
Returns the Database Connection to use to execute the SQL statement.

Returns:
The Database Connection to use.

getStatement

public String getStatement()
Returns the SQL statement.

Returns:
The SQL statement.

isValid

protected boolean isValid()
Returns true if the SQL statement is valid.

Returns:
True if the SQL statement is valid.
False if the SQL statement is not valid

setConnection

public SQL setConnection(Connection connection)
Sets the Database Connection to use to execute the SQL statement.

Returns:
This SQL statement object.

setCommand

protected SQL setCommand(String command)
Sets the SQL statement command.

Returns:
This SQL statement object.
Throws:
SQLInvalidException - No SQL statement command is specified.

setStatement

protected SQL setStatement(String statement)
Sets the SQL statement.

Returns:
This SQL statement object.
Throws:
SQLInvalidException - No SQL statement is specified.

toString

public String toString()
Returns a String representation of this SQL statement.

Specified by:
toString in interface Statement
Overrides:
toString in class Object
Returns:
A String representation of this SQL statement.

2004.04.29



Copyright © 2004 J. Damon & Co.; All Rights Reserved WorldWide.