com.caucho.amber.query
Class AbstractQuery

java.lang.Object
  extended by com.caucho.amber.query.AbstractQuery
Direct Known Subclasses:
AmberSelectQuery, DeleteQuery, UpdateQuery

public abstract class AbstractQuery
extends java.lang.Object

Represents an amber query


Field Summary
protected  java.util.HashMap<java.lang.String,EmbeddedExpr> _embeddedAliases
           
protected  java.util.ArrayList<FromItem> _fromList
           
 
Method Summary
 void addEmbeddedAlias(java.lang.String alias, EmbeddedExpr expr)
          Adds an embedded alias.
 void complete(UserQuery userQuery, AmberConnection aConn)
          Any post-sql completion
 FromItem createDependentFromItem(FromItem parent, LinkColumns link, java.lang.String name)
          Creates a dependent from item
 FromItem createFromItem(AmberTable table, java.lang.String name)
          Sets the from list.
 FromItem createFromItem(EntityType entityType, AmberTable table, java.lang.String name)
          Sets the from list.
 boolean exists(FromItem item)
          Returns true if the item must have at least one entry in the database.
 ArgExpr[] getArgList()
          Returns the arg list.
 long getCacheMaxAge()
          Returns the expire time.
 java.util.HashMap<java.lang.String,EmbeddedExpr> getEmbeddedAliases()
          Gets the embedded aliases.
 java.util.ArrayList<FromItem> getFromList()
          Returns the from list.
 AbstractQuery getParentQuery()
          Gets the parent query.
 java.util.ArrayList<java.lang.String> getPreparedMapping()
          Returns the prepared mapping.
 java.lang.String getQueryString()
          Returns the query string.
abstract  java.lang.String getSQL()
          Returns the SQL.
 boolean hasSubQuery()
          Returns true if this query has a subquery.
 void prepare(UserQuery userQuery, AmberConnection aConn)
          Prepares before any update.
 void setHasSubQuery(boolean hasSubQuery)
          Sets true if this query has a subquery.
 boolean usesFrom(FromItem item, int type)
          Returns true if the from item is used by the query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_fromList

protected java.util.ArrayList<FromItem> _fromList

_embeddedAliases

protected java.util.HashMap<java.lang.String,EmbeddedExpr> _embeddedAliases
Method Detail

getQueryString

public java.lang.String getQueryString()
Returns the query string.


addEmbeddedAlias

public void addEmbeddedAlias(java.lang.String alias,
                             EmbeddedExpr expr)
Adds an embedded alias.


getEmbeddedAliases

public java.util.HashMap<java.lang.String,EmbeddedExpr> getEmbeddedAliases()
Gets the embedded aliases.


createFromItem

public FromItem createFromItem(AmberTable table,
                               java.lang.String name)
Sets the from list.


createFromItem

public FromItem createFromItem(EntityType entityType,
                               AmberTable table,
                               java.lang.String name)
Sets the from list.


createDependentFromItem

public FromItem createDependentFromItem(FromItem parent,
                                        LinkColumns link,
                                        java.lang.String name)
Creates a dependent from item


getFromList

public java.util.ArrayList<FromItem> getFromList()
Returns the from list.


getParentQuery

public AbstractQuery getParentQuery()
Gets the parent query.


getPreparedMapping

public java.util.ArrayList<java.lang.String> getPreparedMapping()
Returns the prepared mapping.


getSQL

public abstract java.lang.String getSQL()
Returns the SQL.


hasSubQuery

public boolean hasSubQuery()
Returns true if this query has a subquery.


setHasSubQuery

public void setHasSubQuery(boolean hasSubQuery)
Sets true if this query has a subquery.


exists

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


usesFrom

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


getArgList

public ArgExpr[] getArgList()
Returns the arg list.


getCacheMaxAge

public long getCacheMaxAge()
Returns the expire time.


prepare

public void prepare(UserQuery userQuery,
                    AmberConnection aConn)
             throws java.sql.SQLException
Prepares before any update.

Throws:
java.sql.SQLException

complete

public void complete(UserQuery userQuery,
                     AmberConnection aConn)
              throws java.sql.SQLException
Any post-sql completion

Throws:
java.sql.SQLException