@Module public abstract class Query extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected Expr |
_whereExpr |
Modifier | Constructor and Description |
---|---|
protected |
Query(Database db,
java.lang.String sql) |
protected |
Query(Database db,
java.lang.String sql,
FromItem[] fromItems) |
Modifier and Type | Method and Description |
---|---|
protected void |
bind()
Binds the query.
|
protected Expr |
bind(java.lang.String tableName,
java.lang.String columnName)
Returns a bound expression for the specified table.column.
|
abstract void |
execute(QueryContext queryCtx,
DbTransaction xa)
Executes the query.
|
SelectCursor |
executeCursor(QueryContext queryCtx,
DbTransaction xa)
Executes the query.
|
protected void |
freeRows(TableIterator[] rows,
int rowLength)
Frees any blocks for the rows.
|
protected void |
generateWhere(Expr whereExpr)
Optimize the where and order the from items.
|
Database |
getDatabase()
Returns the owning database.
|
int |
getDataFields()
Returns the number of temporary data fields.
|
FromItem[] |
getFromItems()
Returns any from items.
|
java.util.ArrayList<SubSelectParamExpr> |
getParamExprs()
Returns the param exprs.
|
Query |
getParent()
Gets the parent query
|
SubSelectExpr |
getSubSelect()
Gets the parent sub-select.
|
Expr[] |
getWhereExprs()
Returns the where exprs
|
boolean |
isGroup()
Sets true for group operations
|
boolean |
isReadOnly() |
boolean |
isSelect()
Returns true for select queries.
|
protected boolean |
isSelect(QueryContext queryContext) |
protected boolean |
nextTuple(TableIterator[] rows,
int rowLength,
QueryContext queryContext,
DbTransaction xa)
Returns the next tuple from the query.
|
void |
setDataFields(int fieldCount)
Sets the number of temporary data fields.
|
protected void |
setFromItems(java.util.ArrayList<FromItem> fromItems)
Sets from items.
|
protected void |
setFromItems(FromItem[] fromItems)
Sets from items.
|
void |
setGroup(boolean isGroup)
Sets the current number of group fields.
|
void |
setLimit(int limit)
Sets the maximum entires
|
void |
setParams(com.caucho.db.sql.ParamExpr[] params)
Sets the params.
|
void |
setParent(Query query)
Sets the parent query
|
void |
setSubSelect(SubSelectExpr subSelect)
Sets the parent sub-select.
|
void |
setWhereExpr(Expr expr)
Sets the where expr.
|
protected void |
setWhereExprs(Expr[] whereExprs)
Sets the where exprs.
|
protected boolean |
start(TableIterator[] rows,
int rowLength,
QueryContext queryContext,
DbTransaction xa)
Starts the query.
|
protected Expr _whereExpr
protected Query(Database db, java.lang.String sql)
public Database getDatabase()
public void setParent(Query query)
public Query getParent()
public void setSubSelect(SubSelectExpr subSelect)
public SubSelectExpr getSubSelect()
public int getDataFields()
public void setDataFields(int fieldCount)
public void setLimit(int limit)
public final FromItem[] getFromItems()
protected void setFromItems(FromItem[] fromItems)
protected void setFromItems(java.util.ArrayList<FromItem> fromItems)
public void setWhereExpr(Expr expr)
public Expr[] getWhereExprs()
protected void setWhereExprs(Expr[] whereExprs)
public void setParams(com.caucho.db.sql.ParamExpr[] params)
public java.util.ArrayList<SubSelectParamExpr> getParamExprs()
public boolean isSelect()
public boolean isReadOnly()
public void setGroup(boolean isGroup)
public boolean isGroup()
protected void bind() throws java.sql.SQLException
java.sql.SQLException
protected void generateWhere(Expr whereExpr) throws java.sql.SQLException
java.sql.SQLException
protected Expr bind(java.lang.String tableName, java.lang.String columnName) throws java.sql.SQLException
java.sql.SQLException
public abstract void execute(QueryContext queryCtx, DbTransaction xa) throws java.sql.SQLException
java.sql.SQLException
public SelectCursor executeCursor(QueryContext queryCtx, DbTransaction xa) throws java.sql.SQLException
java.sql.SQLException
protected boolean start(TableIterator[] rows, int rowLength, QueryContext queryContext, DbTransaction xa) throws java.sql.SQLException
java.sql.SQLException
protected boolean nextTuple(TableIterator[] rows, int rowLength, QueryContext queryContext, DbTransaction xa) throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
protected boolean isSelect(QueryContext queryContext) throws java.sql.SQLException
java.sql.SQLException
protected void freeRows(TableIterator[] rows, int rowLength)