Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.access.trans
Class QueryAssemblerHelper

    java.lang.Object
      org.apache.cayenne.access.trans.QueryAssemblerHelper

Direct Known Subclasses:
  OrderingTranslator, QualifierTranslator

    public abstract class QueryAssemblerHelper

extends Object

Translates parts of the query to SQL. Always works in the context of parent Translator.

Field Summary
`protected Appendable` | `out`
`protected QueryAssembler` | `queryAssembler`

Constructor Summary
`QueryAssemblerHelper(QueryAssembler queryAssembler)` Creates QueryAssemblerHelper initializing with parent `QueryAssembler` and output buffer object.

Method Summary
`protected void` | `appendDbPath(Expression pathExp)`
`protected void` | `appendLiteral(Object val, DbAttribute attr, Expression parentExpression)` Appends SQL code to the query buffer to handle `val` as a parameter to the PreparedStatement being built.
`protected void` | `appendLiteralDirect(Object val, DbAttribute attr, Expression parentExpression)` Appends SQL code to the query buffer to handle `val` as a parameter to the PreparedStatement being built.
`protected void` | `appendObjPath(Expression pathExp)` Processes parts of the OBJ_PATH expression.
`
`<T extends Appendable> T`
` | `appendPart(T out)`
`protected abstract void` | `doAppendPart()`
`DbEntity` | `getDbEntity()`
`ObjEntity` | `getObjEntity()`
`protected DbAttribute` | `paramsDbType(Expression e)` Returns database type of expression parameters or null if it can not be determined.
`protected void` | `processColumn(DbAttribute dbAttr)`
`protected void` | `processRelTermination(DbRelationship rel, JoinType joinType, String joinSplitAlias)` Handles case when a DB_NAME expression ends with relationship.
`protected void` | `processRelTermination(ObjRelationship rel, JoinType joinType, String joinSplitAlias)` Processes case when an OBJ_PATH expression ends with relationship.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### queryAssembler

    protected QueryAssembler queryAssembler

### out

    protected Appendable out

Constructor Detail

### QueryAssemblerHelper

    public QueryAssemblerHelper(QueryAssembler queryAssembler)

  Creates QueryAssemblerHelper initializing with parent `QueryAssembler` and output buffer object.

Method Detail

### getObjEntity

    public ObjEntity getObjEntity()

### getDbEntity

    public DbEntity getDbEntity()

### appendPart

    public <T extends Appendable> T appendPart(T out)
                                    throws IOException

  Throws:
    `IOException`
  Since:
    3.0

### doAppendPart

    protected abstract void doAppendPart()
                                  throws IOException

  Throws:
    `IOException`
  Since:
    3.0

### appendObjPath

    protected void appendObjPath(Expression pathExp)
                          throws IOException

  Processes parts of the OBJ_PATH expression.

  Throws:
    `IOException`

### appendDbPath

    protected void appendDbPath(Expression pathExp)
                         throws IOException

  Throws:
    `IOException`

### processColumn

    protected void processColumn(DbAttribute dbAttr)
                          throws IOException

  Throws:
    `IOException`

### appendLiteral

    protected void appendLiteral(Object val,
                                 DbAttribute attr,
                                 Expression parentExpression)
                          throws IOException

  Appends SQL code to the query buffer to handle `val` as a parameter to the PreparedStatement being built. Adds `val` into QueryAssembler parameter list.

  If `val` is null, "NULL" is appended to the query.

  If `val` is a DataObject, its primary key value is used as a parameter. Only objects with a single column primary key can be used.

  Parameters:
    `val` - object that should be appended as a literal to the query. Must be of one of "standard JDBC" types, null or a DataObject.
    `attr` - DbAttribute that has information on what type of parameter is being appended.
  Throws:
    `IOException`

### appendLiteralDirect

    protected void appendLiteralDirect(Object val,
                                       DbAttribute attr,
                                       Expression parentExpression)
                                throws IOException

  Appends SQL code to the query buffer to handle `val` as a parameter to the PreparedStatement being built. Adds `val` into QueryAssembler parameter list.

  Parameters:
    `buf` - query buffer
    `val` - object that should be appended as a literal to the query. Must be of one of "standard JDBC" types. Can not be null.
  Throws:
    `IOException`

### paramsDbType

    protected DbAttribute paramsDbType(Expression e)

  Returns database type of expression parameters or null if it can not be determined.

### processRelTermination

    protected void processRelTermination(ObjRelationship rel,
                                         JoinType joinType,
                                         String joinSplitAlias)
                                  throws IOException

  Processes case when an OBJ_PATH expression ends with relationship. If this is a "to many" relationship, a join is added and a column expression for the target entity primary key. If this is a "to one" relationship, column expression for the source foreign key is added.

  Throws:
    `IOException`
  Since:
    3.0

### processRelTermination

    protected void processRelTermination(DbRelationship rel,
                                         JoinType joinType,
                                         String joinSplitAlias)
                                  throws IOException

  Handles case when a DB_NAME expression ends with relationship. If this is a "to many" relationship, a join is added and a column expression for the target entity primary key. If this is a "to one" relationship, column expression for the source foreign key is added.

  Throws:
    `IOException`
  Since:
    3.0

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.