All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.persistence.jpa.jpql.parser.AllOrAnyExpression Maven / Gradle / Ivy

There is a newer version: 5.0.0-B03
Show newest version
/*
 * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0,
 * or the Eclipse Distribution License v. 1.0 which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
 */

// Contributors:
//     Oracle - initial API and implementation
//
package org.eclipse.persistence.jpa.jpql.parser;

import org.eclipse.persistence.jpa.jpql.WordParser;

/**
 * An ALL conditional expression is a predicate that is true if the comparison
 * operation is true for all values in the result of the subquery or the result of the
 * subquery is empty. An ALL conditional expression is false if the result of
 * the comparison is false for at least one row, and is unknown if neither
 * true nor false.
 * 

* An ANY conditional expression is a predicate that is true if the comparison * operation is true for some value in the result of the subquery. An ANY * conditional expression is false if the result of the subquery is empty or if the * comparison operation is false for every value in the result of the subquery, and is * unknown if neither true nor false. The keyword SOME is * synonymous with ANY. The comparison operators used with ALL or ANY * conditional expressions are =, {@literal <, <=, >, >=, <>}. The result of the subquery must be * like that of the other argument to the comparison operator in type. * *

BNF: all_or_any_expression ::= {ALL|ANY|SOME}(subquery)

* * @version 2.5 * @since 2.3 * @author Pascal Filion */ public final class AllOrAnyExpression extends AbstractSingleEncapsulatedExpression { /** * Creates a new AllOrAnyExpression. * * @param parent The parent of this expression * @param identifier Either {@link Expression#ALL ALL}, {@link Expression#ANY ANY} or {@link * Expression#SOME SOME} */ public AllOrAnyExpression(AbstractExpression parent, String identifier) { super(parent, identifier); } /** * {@inheritDoc} */ public void accept(ExpressionVisitor visitor) { visitor.visit(this); } /** * {@inheritDoc} */ @Override public String getEncapsulatedExpressionQueryBNFId() { return SubqueryBNF.ID; } /** * {@inheritDoc} */ public JPQLQueryBNF getQueryBNF() { return getQueryBNF(AllOrAnyExpressionBNF.ID); } /** * {@inheritDoc} */ @Override protected AbstractExpression parse(WordParser wordParser, String queryBNFId, boolean tolerant) { if (tolerant) { return super.parse(wordParser, queryBNFId, tolerant); } SimpleSelectStatement expression = new SimpleSelectStatement(this); expression.parse(wordParser, tolerant); return expression; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy