public abstract class SQLStatement extends Object
Constructor and Description |
---|
SQLStatement()
Default constructor, used in the constructors for subclasses
that represent statements that don't have any associated state
(i.e., begin, commit, and rollback).
|
SQLStatement(ArrayList<Table> tl,
ArrayList<Column> cl,
ConditionalExpression w)
Constructor used in the constructors for subclasses that
represent statements that specify table(s), column(s), and a
conditional expression (i.e., select, update, and delete
statements).
|
SQLStatement(Table t)
Constructor used in the constructors for subclasses that
represent statements that only specify a table (i.e., drop
table statements).
|
SQLStatement(Table t,
ArrayList<Column> cl)
Constructor used in the constructors for subclasses that
represent statements that only specify a table and some column
information (i.e., create table statements).
|
SQLStatement(Table t,
ArrayList<Column> cl,
ArrayList<Object> vl)
Constructor used in the constructors for subclasses that
represent statements that specify a single table, one or more
column(s), and values for those columns (i.e., insert statements).
|
SQLStatement(Table t,
ArrayList<Column> cl,
ConditionalExpression w)
Constructor used in the constructors for subclasses that
represent statements that specify a single table, one or more
column(s), and a conditional expression (i.e., update and delete
statements).
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(Column c)
Adds a column to the list of columns for this statement.
|
void |
addColumnVal(Object cv)
Adds a column value to the list of column values for this statement.
|
void |
addTable(Table t)
Adds a table to the list of tables for this statement.
|
abstract void |
execute()
Executes this SQL statement.
|
Column |
getColumn(int i)
Returns the column with the specified index in this statement.
|
Object |
getColumnVal(int i)
Returns the column value with the specified index in this statement.
|
Table |
getTable(int i)
Returns the table with the specified index in this statement.
|
ConditionalExpression |
getWhere() |
Column |
getWhereColumn(int i)
Returns the column with the specified index from the WHERE clause
of this statement.
|
int |
numColumns()
Returns the number of columns specified in this statement.
|
int |
numColumnVals()
Returns the number of column values specified in this statement.
|
int |
numTables()
Returns the number of tables specified in this statement.
|
int |
numWhereColumns()
Returns the number of columns in the WHERE clause of this statement,
or 0 if there is no WHERE clause.
|
String |
toString() |
public SQLStatement()
public SQLStatement(Table t)
public SQLStatement(Table t, ArrayList<Column> cl)
public SQLStatement(ArrayList<Table> tl, ArrayList<Column> cl, ConditionalExpression w)
public SQLStatement(Table t, ArrayList<Column> cl, ConditionalExpression w)
public abstract void execute() throws DatabaseException, DeadlockException
DeadlockException
- if deadlock occurs while accessing
an underlying database.DatabaseException
- if Berkeley DB encounters another problem
accessing an underlying database.public void addTable(Table t)
t
- the tablepublic void addColumn(Column c)
c
- the columnpublic void addColumnVal(Object cv)
cv
- the column valuepublic Table getTable(int i)
RuntimeException
- if the statement does not specify any tablesIndexOutOfBoundsException
- if the specified index is invalidpublic Column getColumn(int i)
getWhereColumn()
instead.RuntimeException
- if the statement does not specify any columnsIndexOutOfBoundsException
- if the specified index is invalidpublic Object getColumnVal(int i)
getColumn()
and then use its
getUpdateVal()
method.RuntimeException
- if the statement does not specify any column
valuesIndexOutOfBoundsException
- if the specified index is invalidpublic Column getWhereColumn(int i)
RuntimeException
- if the statement does not have a WHERE clauseIndexOutOfBoundsException
- if the specified index is invalidpublic ConditionalExpression getWhere()
public int numTables()
public int numColumns()
numWhereColumns()
to get that value.public int numWhereColumns()
public int numColumnVals()
numColumns()
method.