public Predicate isNotNull() { List list = new ArrayList(); list.add(this); return new CompoundExpressionImpl(this.metamodel, this.currentNode.notNull(), list, "not null"); }
/** * Create a predicate to test whether the expression is not null. * @param x expression * @return predicate */ public Predicate isNotNull(Expression<?> x){ return new PredicateImpl(this.metamodel, ((InternalSelection)x).getCurrentNode().notNull(),new ArrayList(), BooleanOperator.AND); }
/** * INTERNAL: * This method is used when the attribute value is null, but it has * to be included at all times. It determines whether to use isNull, or notNull. */ public Expression completeExpressionForNull(Expression expression) { if (shouldUseEqualityForNulls()) { return expression.isNull(); } else { return expression.notNull(); } }
/** * INTERNAL: * This method is used when the attribute value is null, but it has * to be included at all times. It determines whether to use isNull, or notNull. */ public Expression completeExpressionForNull(Expression expression) { if (shouldUseEqualityForNulls()) { return expression.isNull(); } else { return expression.notNull(); } }
/** * INTERNAL: * This method is used when the attribute value is null, but it has * to be included at all times. It determines whether to use isNull, or notNull. */ public Expression completeExpressionForNull(Expression expression) { if (shouldUseEqualityForNulls()) { return expression.isNull(); } else { return expression.notNull(); } }
/** * INTERNAL: * The general case. */ public Expression newExpressionForArguments(Expression base, List arguments) { if ((arguments.size() == 1) && (arguments.get(0) == null)) { if (this.selector == Equal) { return base.isNull(); } else if (this.selector == NotEqual) { return base.notNull(); } } Expression node = createNode(); node.create(base, arguments, this); return node; }
/** * INTERNAL: * The general case. */ public Expression newExpressionForArguments(Expression base, List arguments) { if ((arguments.size() == 1) && (arguments.get(0) == null)) { if (this.selector == Equal) { return base.isNull(); } else if (this.selector == NotEqual) { return base.notNull(); } } Expression node = createNode(); node.create(base, arguments, this); return node; }
/** * INTERNAL: * Create a new expression. Optimized for the single argument case with base last */ public Expression newExpressionForArgumentWithBaseLast(Expression base, Object singleArgument) { if (singleArgument == null) { if (this.selector == Equal) { return base.isNull(); } else if (this.selector == NotEqual) { return base.notNull(); } } Expression node = createNode(); node.createWithBaseLast(base, singleArgument, this); return node; }
/** * INTERNAL: * Create a new expression. Optimized for the single argument case with base last */ public Expression newExpressionForArgumentWithBaseLast(Expression base, Object singleArgument) { if (singleArgument == null) { if (this.selector == Equal) { return base.isNull(); } else if (this.selector == NotEqual) { return base.notNull(); } } Expression node = createNode(); node.createWithBaseLast(base, singleArgument, this); return node; }
/** * INTERNAL: * Create a new expression. Optimized for the single argument case. */ public Expression newExpressionForArgument(Expression base, Object singleArgument) { if (singleArgument == null) { if (this.selector == Equal) { return base.isNull(); } else if (this.selector == NotEqual) { return base.notNull(); } } Expression node = createNode(); node.create(base, singleArgument, this); return node; }
/** * INTERNAL: * The general case. */ public Expression newExpressionForArguments(Expression base, Vector arguments) { if ((arguments.size() == 1) && (arguments.get(0) == null)) { if (getSelector() == Equal) { return base.isNull(); } else if (getSelector() == NotEqual) { return base.notNull(); } } Expression node = createNode(); node.create(base, arguments, this); return node; }
/** * INTERNAL: * Create a new expression. Optimized for the single argument case. */ public Expression newExpressionForArgument(Expression base, Object singleArgument) { if (singleArgument == null) { if (this.selector == Equal) { return base.isNull(); } else if (this.selector == NotEqual) { return base.notNull(); } } Expression node = createNode(); node.create(base, singleArgument, this); return node; }
/** * {@inheritDoc} */ @Override public void visit(NullComparisonExpression expression) { // Create the expression first expression.getExpression().accept(this); // Mark it as NOT NULL if (expression.hasNot()) { queryExpression = queryExpression.notNull(); } // Mark it as IS NULL else { queryExpression = queryExpression.isNull(); } // Set the expression type type[0] = Boolean.class; }
/** * INTERNAL: * Create a new expression. Optimized for the single argument case. */ public Expression newExpressionForArgument(Expression base, Object singleArgument) { if (singleArgument == null) { if (getSelector() == Equal) { return base.isNull(); } else if (getSelector() == NotEqual) { return base.notNull(); } } Expression node = createNode(); node.create(base, singleArgument, this); return node; }
/** * INTERNAL: * Create a new expression. Optimized for the single argument case with base last */ public Expression newExpressionForArgumentWithBaseLast(Expression base, Object singleArgument) { if (singleArgument == null) { if (getSelector() == Equal) { return base.isNull(); } else if (getSelector() == NotEqual) { return base.notNull(); } } Expression node = createNode(); node.createWithBaseLast(base, singleArgument, this); return node; }
/** * {@inheritDoc} */ @Override public void visit(NullComparisonExpression expression) { //cuba begin if (!expression.hasNot()) { isNullExpression = true; } //cuba end try { // Create the expression first expression.getExpression().accept(this); // Mark it as NOT NULL if (expression.hasNot()) { queryExpression = queryExpression.notNull(); } // Mark it as IS NULL else { queryExpression = queryExpression.isNull(); } // Set the expression type type[0] = Boolean.class; } finally { isNullExpression = false; } }
/** * INTERNAL: * Print SQL */ public void printSQL(ExpressionSQLPrinter printer) { // If both sides are parameters, some databases don't allow binding. if (printer.getPlatform().isDynamicSQLRequiredForFunctions() && ((this.firstChild.isParameterExpression() || this.firstChild.isConstantExpression()) && (this.secondChild.isParameterExpression() || this.secondChild.isConstantExpression()))) { printer.getCall().setUsesBinding(false); } if (isEqualNull(printer)) { this.firstChild.isNull().printSQL(printer); } else if (isNotEqualNull(printer)) { this.firstChild.notNull().printSQL(printer); } else { super.printSQL(printer); } }
/** * INTERNAL: * Print SQL */ public void printSQL(ExpressionSQLPrinter printer) { // If both sides are parameters, some databases don't allow binding. if (printer.getPlatform().isDynamicSQLRequiredForFunctions() && ((this.firstChild.isParameterExpression() || this.firstChild.isConstantExpression()) && (this.secondChild.isParameterExpression() || this.secondChild.isConstantExpression()))) { printer.getCall().setUsesBinding(false); } if (isEqualNull(printer)) { this.firstChild.isNull().printSQL(printer); } else if (isNotEqualNull(printer)) { this.firstChild.notNull().printSQL(printer); } else { super.printSQL(printer); } }
/** * INTERNAL: * Print SQL */ public void printSQL(ExpressionSQLPrinter printer) { // If both sides are parameters, some databases don't allow binding. if (printer.getPlatform().isDynamicSQLRequiredForFunctions() && ((this.firstChild.isParameterExpression() || this.firstChild.isConstantExpression()) && (this.secondChild.isParameterExpression() || this.secondChild.isConstantExpression()))) { printer.getCall().setUsesBinding(false); } if (isEqualNull(printer)) { this.firstChild.isNull().printSQL(printer); } else if (isNotEqualNull(printer)) { this.firstChild.notNull().printSQL(printer); } else { super.printSQL(printer); } }