|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ModSQL.ColumnValue
This object is used to retrieve the value of specific of a database table.
| Field Summary | |
protected int |
column
Index of column within table. |
private boolean |
index_checked
Set to true if an index was searched for. |
private boolean |
indexed
Set to true if this column is indexed. |
private TableReader |
reader
TableReader managing the table we get data from. |
protected int |
table
Index of table in TableReader. |
private int |
type
Column type (one of java.sql.Types values). |
private Object |
value
Value of column (valid if value_valid==true). |
private boolean |
value_valid
Set to true if the value is valid. |
| Fields inherited from interface ModSQL.Function |
MATCH_BEGINS, MATCH_EQU, MATCH_GT, MATCH_GTE, MATCH_LT, MATCH_LTE, MATCH_NE |
| Constructor Summary | |
ColumnValue(TableReader reader,
int table,
int column)
Constructor. |
|
| Method Summary | |
void |
addParameter(Function item)
Adds a parameter to the list of parameters. |
Object |
evaluate(boolean aggregate)
Return the value of the column in the current row. |
Object |
evaluate(int match_op,
Object match_value)
Return the value of the column in the current row. |
void |
evaluateOrder(int index,
int order)
Specify the order in which the parameters should be evaluated. |
int |
getMaxResultSize()
Return the maximum number of characters that this function expects to return in a String object. |
Function |
getParameter(int index)
Get a particular parameter. |
int |
getParameterCount()
Number of parameters. |
int |
getSQLType()
Return the SQL type of the value that this function expects to return. |
void |
invalidate()
Invalidate cached value. |
boolean |
isAggregate()
Determine if this function will return a value that is an aggregate of many database rows. |
boolean |
isConstant()
Determine if this function returns a constant value. |
void |
optimize()
This implementation only sets the type variable. |
void |
registerWith(Object o)
This method is used by the TableReader object when ordering parameters. |
void |
reset()
Reset aggregate function. |
void |
setValue(Object v)
Set cached value and mark the value as valid. |
String |
toString()
Returns "table_alias.column_name". |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private TableReader reader
protected int table
protected int column
private boolean index_checked
private boolean indexed
private boolean value_valid
private Object value
private int type
| Constructor Detail |
public ColumnValue(TableReader reader,
int table,
int column)
reader - TableReader managing tabletable - index of table in readercolumn - index of column in table| Method Detail |
public int getParameterCount()
getParameterCount in interface Functionpublic Function getParameter(int index)
getParameter in interface Functionindex - index of parameter to getIndexOutOfBoundsException - in all cases
public void addParameter(Function item)
throws SQLException
addParameter in interface Functionitem - function to addSQLException - in all cases
public void evaluateOrder(int index,
int order)
evaluateOrder in interface Functionindex - index of parameterorder - number indicating order in which parameter is evaluatedIndexOutOfBoundsException - in all cases
public void registerWith(Object o)
throws SQLException
This method is used by the TableReader object when ordering parameters. The TableReader object will call this method with a TableReader.TableAccess object to find out which columns are accessed by each parameter and whether those columns are indexed or not.
Objects of any other type are ignored.
registerWith in interface Functiono - object to register withSQLException - if an error occurs
public void optimize()
throws SQLException
optimize in interface FunctionSQLException - if an error occurspublic boolean isConstant()
isConstant in interface Functionpublic boolean isAggregate()
isAggregate in interface Function
public int getSQLType()
throws SQLException
getSQLType in interface FunctionSQLException - if an error occurs
public int getMaxResultSize()
throws SQLException
getMaxResultSize in interface FunctionSQLException - if an error occurspublic String toString()
toString in class Objectpublic void invalidate()
public void setValue(Object v)
v - value to setpublic void reset()
reset in interface FunctionModSQL.FunctionSQLException - if an error occurs
public Object evaluate(boolean aggregate)
throws SQLException,
EndOfTable
Return the value of the column in the current row. If the value of the column has been cached and is valid, that value is returned. Otherwise, a value is read from the TableReader, and if the TableReader is forced to advance to the next row in the database, EndOfTable may be thrown.
If aggregate is true, an exception is thrown.
evaluate in interface Functionaggregate - true to return final aggregate valueSQLException - if an error occursEndOfTable - if the end of the table is reached
public Object evaluate(int match_op,
Object match_value)
throws SQLException,
EndOfTable
Return the value of the column in the current row. If the value of the column has been cached and is valid, that value is returned. Otherwise, a value is read from the TableReader, and if the TableReader is forced to advance to the next row in the database, EndOfTable may be thrown.
If the TableReader is read from and match_op is MATCH_EQU, an attempt is made to find a row in the database where the column constains match_value. An index may be used to speed up this search. This method makes no guarantee that such a value can be found and may return some other value (even in cases where the desired row exists).
evaluate in interface Functionmatch_op - how desired value is matchedmatch_value - value to match toSQLException - if an error occursEndOfTable - if the end of the table is reached
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||