org.datanucleus.store.rdbms.sql.method
Class MapContainsEntryMethod

java.lang.Object
  extended by org.datanucleus.store.rdbms.sql.method.AbstractSQLMethod
      extended by org.datanucleus.store.rdbms.sql.method.MapContainsEntryMethod
All Implemented Interfaces:
SQLMethod

public class MapContainsEntryMethod
extends AbstractSQLMethod

Method for evaluating {mapExpr}.containsEntry(keyExpr, valueExpr). Returns a BooleanExpression.


Field Summary
 
Fields inherited from class org.datanucleus.store.rdbms.sql.method.AbstractSQLMethod
clr, exprFactory, LOCALISER, stmt
 
Constructor Summary
MapContainsEntryMethod()
           
 
Method Summary
protected  SQLExpression containsAsInnerJoin(MapExpression mapExpr, SQLExpression keyExpr, SQLExpression valExpr)
          Method to return an expression for Map.containsEntry using INNER JOIN to the element.
protected  SQLExpression containsAsSubquery(MapExpression mapExpr, SQLExpression keyExpr, SQLExpression valExpr)
          Method to return an expression for Map.containsEntry using a subquery "EXISTS".
 SQLExpression getExpression(SQLExpression expr, java.util.List args)
          Return the expression for this SQL function.
 
Methods inherited from class org.datanucleus.store.rdbms.sql.method.AbstractSQLMethod
getMappingForClass, setStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapContainsEntryMethod

public MapContainsEntryMethod()
Method Detail

getExpression

public SQLExpression getExpression(SQLExpression expr,
                                   java.util.List args)
Description copied from interface: SQLMethod
Return the expression for this SQL function.

Parameters:
expr - The expression that it is invoked on
args - Arguments passed in
Returns:
The SQL expression using the SQL function

containsAsInnerJoin

protected SQLExpression containsAsInnerJoin(MapExpression mapExpr,
                                            SQLExpression keyExpr,
                                            SQLExpression valExpr)
Method to return an expression for Map.containsEntry using INNER JOIN to the element. This is only for use when there are no "!containsEntry" and no "OR" operations. Creates SQL by adding INNER JOIN to the join table (where it exists), and also to the value table adding an AND condition on the value (with value of the valueExpr). Returns a BooleanExpression "TRUE" (since the INNER JOIN will guarantee if the entry is contained of not).

Parameters:
mapExpr - Map expression
keyExpr - Expression for the key
valExpr - Expression for the value
Returns:
Contains expression

containsAsSubquery

protected SQLExpression containsAsSubquery(MapExpression mapExpr,
                                           SQLExpression keyExpr,
                                           SQLExpression valExpr)
Method to return an expression for Map.containsEntry using a subquery "EXISTS". This is for use when there are "!contains" or "OR" operations in the filter. Creates the following SQL, and returns a BooleanSubqueryExpression ("EXISTS (subquery)")

Parameters:
mapExpr - Map expression
keyExpr - Expression for the key
valExpr - Expression for the value
Returns:
Contains expression


Copyright © 2009. All Rights Reserved.