planetj.database.sql
Class SQLStatement

java.lang.Object
  |
  +--planetj.database.sql.SQLStatement
All Implemented Interfaces:
Serializable, TableStatement
Direct Known Subclasses:
CallStatement, CreateAliasStatement, DeleteStatement, InsertStatement, SelectStatement, UpdateStatement

public abstract class SQLStatement
extends Object
implements TableStatement, Serializable

Author:
PlanetJ Corporation
See Also:
Serialized Form

Field Summary
static int CALL_STATEMENT
           
static String className
          Class name.
static int CREATE_ALIAS_STATEMENT
           
static int DELETE_STATEMENT
           
static int INSERT_STATEMENT
           
static int SELECT_STATEMENT
           
static int UPDATE_STATEMENT
           
 
Constructor Summary
SQLStatement()
          SQLStatement constructor comment.
SQLStatement(String pOriginalSQLString, SQLContext context)
          SQLStatement constructor comment.
 
Method Summary
static SQLStatement createStatement(String sql, SQLContext context)
           
static Table getAlteredTable(String pSQL, String pSystemAlias)
          Gets the table that will be altered by this SQL statement.
 SQLContext getContext()
          Gets the SQLContext from which this statement was created
 AbstractExpressionToken getExpressionToken()
          Gets the "first" expression token for this Statement.
 List getExpressionTokens()
          Gets the List of expression tokens for this Statement.
 Class getExpressTokenClass()
          Deprecated.  
 byte getLibrarySupportLevel()
          Gets the library support level required by this statement
 String getOriginalSQLString()
          Gets the original sql string this SQLStatement is based upon.
abstract  int getType()
          Subclasses need to return their statement type.
 boolean hasExpression()
           
static boolean isAlterTableStatement(String sql)
          Tests if the SQL is an alter table statement
static boolean isCallStatement(String sql)
          Tests if the SQL is a call to a stored proceedure
static boolean isCreateAliasStatement(String sql)
          Tests if the SQL is a CREATE ALIAS
 boolean isDeleteStatement()
          Tests if this statement is a delete statement
static boolean isDeleteStatement(String sql)
          Tests if the SQL is a delete statement
static boolean isGroupByStatement(String sql)
          Check if the sql contains a group by
 boolean isInsertStatement()
          Tests if this statement is an insert statement
static boolean isInsertStatement(String sql)
          Tests if the SQL is an insert statement
 boolean isSelectStatement()
          Tests if this statement is a select statement
static boolean isSelectStatement(String sql)
          Tests if the SQL is a select statement
static boolean isUnionStatement(String sql)
          Check if the sql contains a union.
 boolean isUpdateStatement()
          Tests if this statement is an update statement
static boolean isUpdateStatement(String sql)
          Tests if the SQL is a update statement
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface planetj.database.sql.TableStatement
getTableTokens
 

Field Detail

className

public static final String className
Class name.


SELECT_STATEMENT

public static final int SELECT_STATEMENT
See Also:
Constant Field Values

INSERT_STATEMENT

public static final int INSERT_STATEMENT
See Also:
Constant Field Values

UPDATE_STATEMENT

public static final int UPDATE_STATEMENT
See Also:
Constant Field Values

DELETE_STATEMENT

public static final int DELETE_STATEMENT
See Also:
Constant Field Values

CALL_STATEMENT

public static final int CALL_STATEMENT
See Also:
Constant Field Values

CREATE_ALIAS_STATEMENT

public static final int CREATE_ALIAS_STATEMENT
See Also:
Constant Field Values
Constructor Detail

SQLStatement

public SQLStatement()
SQLStatement constructor comment.


SQLStatement

public SQLStatement(String pOriginalSQLString,
                    SQLContext context)
SQLStatement constructor comment.

Parameters:
pOriginalSQLString - String the SQLStatement is based upon.
Method Detail

createStatement

public static SQLStatement createStatement(String sql,
                                           SQLContext context)

getAlteredTable

public static Table getAlteredTable(String pSQL,
                                    String pSystemAlias)
                             throws CMException
Gets the table that will be altered by this SQL statement. If the statement is a SELECT statement, no tables will be altered, so null is returned. If the statement is a CALL statement, then null is returned (even if the stored proceedure may alter tables).

CMException

getContext

public SQLContext getContext()
Gets the SQLContext from which this statement was created


getExpressionToken

public AbstractExpressionToken getExpressionToken()
Gets the "first" expression token for this Statement. This statement may contain additional expression tokens


getExpressionTokens

public List getExpressionTokens()
Gets the List of expression tokens for this Statement. This List will not be null, althought it may be empty. It will contain AbstractExpressionToken objects


getExpressTokenClass

public Class getExpressTokenClass()
Deprecated.  


getLibrarySupportLevel

public byte getLibrarySupportLevel()
Gets the library support level required by this statement


getOriginalSQLString

public String getOriginalSQLString()
Gets the original sql string this SQLStatement is based upon.

Returns:
sql string the SQLStatement is based upon.

getType

public abstract int getType()
Subclasses need to return their statement type.

SELECT_STATEMENT INSERT_STATEMENT UPDATE_STATEMENT DELETE_STATEMENT


hasExpression

public boolean hasExpression()

isAlterTableStatement

public static boolean isAlterTableStatement(String sql)
Tests if the SQL is an alter table statement


isCallStatement

public static boolean isCallStatement(String sql)
Tests if the SQL is a call to a stored proceedure


isCreateAliasStatement

public static boolean isCreateAliasStatement(String sql)
Tests if the SQL is a CREATE ALIAS


isDeleteStatement

public boolean isDeleteStatement()
Tests if this statement is a delete statement


isDeleteStatement

public static boolean isDeleteStatement(String sql)
Tests if the SQL is a delete statement


isGroupByStatement

public static boolean isGroupByStatement(String sql)
Check if the sql contains a group by


isInsertStatement

public boolean isInsertStatement()
Tests if this statement is an insert statement


isInsertStatement

public static boolean isInsertStatement(String sql)
Tests if the SQL is an insert statement


isSelectStatement

public boolean isSelectStatement()
Tests if this statement is a select statement


isSelectStatement

public static boolean isSelectStatement(String sql)
Tests if the SQL is a select statement


isUnionStatement

public static boolean isUnionStatement(String sql)
Check if the sql contains a union.


isUpdateStatement

public boolean isUpdateStatement()
Tests if this statement is an update statement


isUpdateStatement

public static boolean isUpdateStatement(String sql)
Tests if the SQL is a update statement


toString

public String toString()
Overrides:
toString in class Object