Class ArrayContainsMethod
java.lang.Object
org.datanucleus.store.rdbms.sql.method.ArrayContainsMethod
- All Implemented Interfaces:
SQLMethod
Method for evaluating {arrExpr}.contains(elemExpr).
Returns a BooleanExpression.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SQLExpression
containsAsSubquery
(SQLStatement stmt, ArrayExpression arrExpr, SQLExpression elemExpr) Method to return an expression for Collection.contains using a subquery "EXISTS".protected boolean
elementTypeCompatible
(Class elementType, Class collectionElementType) getExpression
(SQLStatement stmt, SQLExpression expr, List<SQLExpression> args) Return the expression for this SQL function.
-
Constructor Details
-
ArrayContainsMethod
public ArrayContainsMethod()
-
-
Method Details
-
getExpression
Description copied from interface:SQLMethod
Return the expression for this SQL function.- Specified by:
getExpression
in interfaceSQLMethod
- Parameters:
stmt
- SQLStatement that this expression is forexpr
- The expression that it is invoked onargs
- Arguments passed in- Returns:
- The SQL expression using the SQL function
-
containsAsSubquery
protected SQLExpression containsAsSubquery(SQLStatement stmt, ArrayExpression arrExpr, SQLExpression elemExpr) Method to return an expression for Collection.contains using a subquery "EXISTS". This is for use when there are "!contains" or "OR" operations in the filter. Creates the following SQL,- Collection of NonPC using join table
SELECT 1 FROM JOIN_TBL A0_SUB WHERE A0_SUB.JOIN_OWN_ID = A0.ID AND A0_SUB.JOIN_ELEM_ID = {elemExpr}
- Collection of PC using join table
SELECT 1 FROM ELEM_TABLE A0_SUB INNER JOIN JOIN_TBL B0 ON ... WHERE B0.JOIN_OWN_ID = A0.ID AND A0_SUB.ID = {elemExpr}
- Parameters:
stmt
- SQLStatementarrExpr
- Collection expressionelemExpr
- Expression for the element- Returns:
- Contains expression
- Collection of NonPC using join table
-
elementTypeCompatible
-