com.caucho.amber.query
Class AmberSelectQuery

java.lang.Object
  extended by com.caucho.amber.query.AbstractQuery
      extended by com.caucho.amber.query.AmberSelectQuery

public class AmberSelectQuery
extends AbstractQuery

Represents an Amber select query


Field Summary
 
Fields inherited from class com.caucho.amber.query.AbstractQuery
_embeddedAliases, _fromList
 
Method Summary
 boolean exists(FromItem item)
          Returns true if the item must have at least one entry in the database.
 java.lang.String generateLoadSQL()
           
 java.lang.String generateLoadSQL(boolean fullSelect)
          Generates the load SQL.
 long getCacheMaxAge()
          Returns the expire time.
 java.lang.Class getConstructorClass()
          Gets the constructor class for SELECT NEW.
 int getLimit()
          Gets the LIMIT value.
 int getOffset()
          Gets the OFFSET value.
 AbstractQuery getParentQuery()
          Gets the parent query.
 java.util.ArrayList<AmberExpr> getResultList()
          Returns the result list.
 java.lang.String getSQL()
          Returns the id load sql
 boolean invalidateTable(java.lang.String table)
          Returns true if modifying the given table modifies a cached query.
 boolean isCacheable()
          Returns true for cacheable queries.
 boolean isTableReadOnly()
          Are the tables read-only
 void setLimit(int limit)
          Sets the LIMIT value.
 void setOffset(int offset)
          Sets the OFFSET value.
 java.lang.String toString()
          Debug view.
 boolean usesFrom(FromItem item, int type)
          Returns true if the from item is used by the query.
 
Methods inherited from class com.caucho.amber.query.AbstractQuery
addEmbeddedAlias, complete, createDependentFromItem, createFromItem, createFromItem, getArgList, getEmbeddedAliases, getFromList, getPreparedMapping, getQueryString, hasSubQuery, prepare, setHasSubQuery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getConstructorClass

public java.lang.Class getConstructorClass()
Gets the constructor class for SELECT NEW.


getParentQuery

public AbstractQuery getParentQuery()
Gets the parent query.

Overrides:
getParentQuery in class AbstractQuery

getResultList

public java.util.ArrayList<AmberExpr> getResultList()
Returns the result list.


getSQL

public java.lang.String getSQL()
Returns the id load sql

Specified by:
getSQL in class AbstractQuery

getCacheMaxAge

public long getCacheMaxAge()
Returns the expire time.

Overrides:
getCacheMaxAge in class AbstractQuery

isCacheable

public boolean isCacheable()
Returns true for cacheable queries.


isTableReadOnly

public boolean isTableReadOnly()
Are the tables read-only


setOffset

public void setOffset(int offset)
Sets the OFFSET value.


getOffset

public int getOffset()
Gets the OFFSET value.


setLimit

public void setLimit(int limit)
Sets the LIMIT value.


getLimit

public int getLimit()
Gets the LIMIT value.


exists

public boolean exists(FromItem item)
Returns true if the item must have at least one entry in the database.

Overrides:
exists in class AbstractQuery

usesFrom

public boolean usesFrom(FromItem item,
                        int type)
Returns true if the from item is used by the query.

Overrides:
usesFrom in class AbstractQuery

generateLoadSQL

public java.lang.String generateLoadSQL()

generateLoadSQL

public java.lang.String generateLoadSQL(boolean fullSelect)
Generates the load SQL.

Parameters:
fullSelect - true if the load entity expressions should be fully loaded for all entity fields. Otherwise, only the entity id will be loaded: select o.id from ... It is implemented to optimize the SQL and allow for databases that only support single columns in subqueries. Derby is an example. An additional condition to generate only the o.id is the absence of group by. If there is a group by the full select will always be generated. See also com.caucho.amber.expr.ExistsExpr
Returns:
the load SQL.

invalidateTable

public boolean invalidateTable(java.lang.String table)
Returns true if modifying the given table modifies a cached query.


toString

public java.lang.String toString()
Debug view.

Overrides:
toString in class java.lang.Object