|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An expression within an SQL query statement. Most often used to construct the contents of a statement's WHERE and ORDER BY clauses.
Larger expressions can be built up through combinations of operations performed on smaller expressions. The available operations are modeled after those that are supported in a JDO query filter string, i.e. Java-like operators.
Method Summary | |
SqlExpression |
accessField(java.lang.String fieldName)
Returns a new expression representing "this.fieldName". |
SqlExpression |
add(SqlExpression expr)
Returns a new expression representing "this + expr". |
BooleanExpression |
and(SqlExpression expr)
Returns a new expression representing "this && expr". |
SqlExpression |
callMethod(java.lang.String methodName,
java.util.List arguments)
Returns a new expression representing "this.methodName(arguments)". |
SqlExpression |
cast(java.lang.Class type)
Returns a new expression representing this expression cast to the given data type. |
SqlExpression |
com()
Returns a new expression representing "~this". |
SqlExpression |
div(SqlExpression expr)
Returns a new expression representing "this / expr". |
BooleanExpression |
eor(SqlExpression expr)
Returns a new expression representing "this ^ expr". |
BooleanExpression |
eq(SqlExpression expr)
Returns a new expression representing "this == expr". |
ColumnMapping |
getColumnMapping()
Returns the preferred mapping for this expression if it is a column mapping. |
java.lang.Class |
getJavaType()
Returns the corresponding Java type of this expression. |
Mapping |
getMapping()
Returns the preferred mapping for mapping this expression to/from Java objects. |
QueryStatement |
getQueryStatement()
Returns the query statement to which this expression belongs. |
java.util.Set |
getReferencedColumns()
Returns a set containing all the query columns referenced by this expression. |
BooleanExpression |
gt(SqlExpression expr)
Returns a new expression representing "this > expr". |
BooleanExpression |
gteq(SqlExpression expr)
Returns a new expression representing "this >= expr". |
BooleanExpression |
ior(SqlExpression expr)
Returns a new expression representing "this || expr". |
BooleanExpression |
lt(SqlExpression expr)
Returns a new expression representing "this < expr". |
BooleanExpression |
lteq(SqlExpression expr)
Returns a new expression representing "this <= expr". |
SqlExpression |
mod(SqlExpression expr)
Returns a new expression representing "this % expr". |
SqlExpression |
mul(SqlExpression expr)
Returns a new expression representing "this * expr". |
SqlExpression |
neg()
Returns a new expression representing "-this". |
ResultExpression |
newResultExpression(PersistenceManager pm)
SELECTs this expression in the surrounding query statement and returns a corresponding result expression. |
BooleanExpression |
not()
Returns a new expression representing "!this". |
BooleanExpression |
noteq(SqlExpression expr)
Returns a new expression representing "this != expr". |
int |
select()
Adds this expression to the list of those SELECTed in its surrounding query statement. |
SqlExpression |
setMapping(Mapping m)
Sets the preferred mapping for mapping this expression to/from Java objects. |
SqlExpression |
sub(SqlExpression expr)
Returns a new expression representing "this - expr". |
Methods inherited from interface com.triactive.jdo.store.sql.expr.StatementTextGenerator |
toStatementText, toString |
Method Detail |
public QueryStatement getQueryStatement()
public java.lang.Class getJavaType()
public SqlExpression setMapping(Mapping m)
public Mapping getMapping()
public ColumnMapping getColumnMapping()
javax.jdo.JDOUserException
- if not mapped by a column mappingpublic int select()
public ResultExpression newResultExpression(PersistenceManager pm)
pm
- The persistence manager for the result objects.public java.util.Set getReferencedColumns()
QueryStatement.QueryColumn
objects.public BooleanExpression and(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public BooleanExpression eor(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public BooleanExpression ior(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public BooleanExpression not()
IllegalOperationException
- If the operation is not valid on this type of expression.public BooleanExpression eq(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public BooleanExpression noteq(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public BooleanExpression lt(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public BooleanExpression lteq(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public BooleanExpression gt(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public BooleanExpression gteq(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public SqlExpression add(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public SqlExpression sub(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public SqlExpression mul(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public SqlExpression div(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public SqlExpression mod(SqlExpression expr)
expr
- The right-hand side of the operator.
IllegalOperationException
- If the operation is not valid between the two expressions based on
their type.public SqlExpression neg()
IllegalOperationException
- If the operation is not valid on this type of expression.public SqlExpression com()
IllegalOperationException
- If the operation is not valid on this type of expression.public SqlExpression cast(java.lang.Class type)
type
- The Java type to which the expression should be cast.
IllegalOperationException
- If the operation is not valid on this type of expression.public SqlExpression accessField(java.lang.String fieldName)
fieldName
- The name of the field to be accessed.
IllegalOperationException
- If the operation is not valid on this type of expression.public SqlExpression callMethod(java.lang.String methodName, java.util.List arguments)
JDO query methods are implemented via a reflective call to Java methods on the SqlExpression object. Any Java method named as "abcMethod" can be called from a query filter as "abc". The Java method is passed zero or more SqlExpression objects as arguments.
For example, a query method call such as "str.substring(0, 4)" will look to reflectively invoke a Java method on this object having the signature substringMethod(SqlExpression,SqlExpression).
methodName
- The name of the method to be invoked.arguments
- A list of SqlExpression objects representing the arguments to the
method.
MethodInvocationException
- If an exception occurs in invoking the method.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |