|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mckoi.database.interpret.Statement
public abstract class Statement
Provides a set of useful utility functions to use by all the interpretted statements.
Field Summary | |
---|---|
protected StatementTree |
cmd
The StatementTree object that is the container for the query. |
protected DatabaseConnection |
database
The Database context. |
protected SQLQuery |
query
The SQLQuery object that was used to produce this statement. |
protected java.util.Vector |
table_list
The list of all FromTableInterface objects of resources referenced in this query. |
protected User |
user
The user context. |
Constructor Summary | |
---|---|
Statement()
|
Method Summary | |
---|---|
protected void |
addTable(FromTableInterface table)
Add an FromTableInterface that is used within this query. |
DebugLogger |
Debug()
Returns a DebugLogger object used to log debug commands. |
abstract Table |
evaluate()
Evaluates the statement and returns a table that represents the result set. |
void |
init(DatabaseConnection db,
StatementTree stree,
SQLQuery query)
Sets up internal variables for this statement for derived classes to use. |
abstract void |
prepare()
Prepares the statement with the given Database object. |
void |
resolveTree()
Performs initial preparation on the contents of the StatementTree by resolving all sub queries and mapping functions to their executable forms. |
Variable |
resolveVariableName(Variable v)
Given a Variable object, this will resolve the name into a column name the database understands (substitutes aliases, etc). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DatabaseConnection database
protected User user
protected StatementTree cmd
protected SQLQuery query
protected java.util.Vector table_list
Constructor Detail |
---|
public Statement()
Method Detail |
---|
public final DebugLogger Debug()
public final void resolveTree() throws DatabaseException
Given a StatementTree and a Database context, this method will convert all sub-queries found in the StatementTree to a Queriable object. In other words, all StatementTree are converted to Select objects. The given 'database' object is used as the session to prepare the sub-queries against.
This is called after 'init' and before 'prepare'.
DatabaseException
public Variable resolveVariableName(Variable v)
protected void addTable(FromTableInterface table)
public final void init(DatabaseConnection db, StatementTree stree, SQLQuery query)
It is assumed that any ? style parameters in the StatementTree will have been resolved previous to a call to this method.
db
- the DatabaseConnection that will execute this statement.stree
- the StatementTree that contains the parsed content of the
statement being executed.public abstract void prepare() throws DatabaseException
NOTE: Care must be taken to ensure that all methods called here are safe in as far as modifications to the data occuring. The rules for safety should be as follows. If the database is in EXCLUSIVE mode, then we need to wait until it's switched back to SHARED mode before this method is called. All collection of information done here should not involve any table state info. except for column count, column names, column types, etc. Queries such as obtaining the row count, selectable scheme information, and certainly 'getCellContents' must never be called during prepare. When prepare finishes, the affected tables are locked and the query is safe to 'evaluate' at which time table state is safe to inspect.
DatabaseException
public abstract Table evaluate() throws DatabaseException, TransactionException
DatabaseException
TransactionException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |