Gets the where clause.

@param jpqlExpression
the jpql expression
@return the where clause
353137
public static WhereClause getWhereClause(JPQLExpression jpqlExpression)
    {
        WhereClause whereClause = null;

        if (hasWhereClause(jpqlExpression))
        {
            if (isSelectStatement(jpqlExpression))
            {
                whereClause = (WhereClause) ((SelectStatement) jpqlExpression.getQueryStatement()).getWhereClause();

            }
            else if (isUpdateStatement(jpqlExpression))
            {
                whereClause = (WhereClause) ((UpdateStatement) jpqlExpression.getQueryStatement()).getWhereClause();

            }
            if (isDeleteStatement(jpqlExpression))
            {
                whereClause = (WhereClause) ((DeleteStatement) jpqlExpression.getQueryStatement()).getWhereClause();
            }
        }
        return whereClause;
    }
369164
def where(cls, where_clause="", start_position="", max_results="", qb=None):
        
        if where_clause:
            where_clause = "WHERE " + where_clause

        if start_position:
            start_position = " STARTPOSITION " + str(start_position)

        if max_results:
            max_results = " MAXRESULTS " + str(max_results)

        select = "SELECT * FROM {0} {1}{2}{3}".format(
            cls.qbo_object_name, where_clause, start_position, max_results)

        return cls.query(select, qb=qb)
95347
public RuleDescr query(PackageDescrBuilder pkg) throws RecognitionException {
        QueryDescrBuilder query = null;
        try {
            query = helper.start(pkg,
                    QueryDescrBuilder.class,
                    null);

            setAnnotationsOn(query);

            // 'query'
            match(input,
                    DRL6Lexer.ID,
                    DroolsSoftKeywords.QUERY,
                    null,
                    DroolsEditorType.KEYWORD);
            if (state.failed)
                return null;

            if (helper.validateIdentifierKey(DroolsSoftKeywords.WHEN) ||
                    helper.validateIdentifierKey(DroolsSoftKeywords.THEN) ||
                    helper.validateIdentifierKey(DroolsSoftKeywords.END)) {
                failMissingTokenException();
                return null; // in case it is backtracking
            }

            String name = stringId();
            if (state.backtracking == 0)
                query.name(name);
            if (state.failed)
                return null;

            if (state.backtracking == 0) {
                helper.emit(Location.LOCATION_RULE_HEADER);
            }

            if (speculateParameters(true)) {
                // parameters
                parameters(query,
                        true);
                if (state.failed)
                    return null;
                if (state.backtracking == 0) {
                    helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION);
                }
            } else if (speculateParameters(false)) {
                // parameters
                parameters(query,
                        false);
                if (state.failed)
                    return null;
                if (state.backtracking == 0) {
                    helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION);
                }
            }

            if (state.backtracking == 0 && input.LA(1) != DRL6Lexer.EOF) {
                helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION);
            }
            if (input.LA(1) != DRL6Lexer.EOF) {
                lhsExpression(query != null ? query.lhs() : null);
            }

            match(input,
                    DRL6Lexer.ID,
                    DroolsSoftKeywords.END,
                    null,
                    DroolsEditorType.KEYWORD);
            if (state.failed)
                return null;

            helper.emit(Location.LOCATION_RHS);

        } catch (RecognitionException re) {
            reportError(re);
        } finally {
            helper.end(QueryDescrBuilder.class,
                    query);
        }
        return (query != null) ? query.getDescr() : null;
    }
814812
public <KEY> Where<KEY> where(KeySelector<T1, KEY> keySelector)  {
		Preconditions.checkNotNull(keySelector);
		final TypeInformation<KEY> keyType = TypeExtractor.getKeySelectorTypes(keySelector, input1.getType());
		return where(keySelector, keyType);
	}
590271
public static List<OrderByItem> getOrderByItems(JPQLExpression jpqlExpression)
    {
        List<OrderByItem> orderList = new LinkedList<>();

        if (hasOrderBy(jpqlExpression))
        {
            Expression orderByItems = getOrderByClause(jpqlExpression).getOrderByItems();

            if (orderByItems instanceof CollectionExpression)
            {
                ListIterator<Expression> iterator = orderByItems.children().iterator();
                while (iterator.hasNext())
                {
                    OrderByItem orderByItem = (OrderByItem) iterator.next();
                    orderList.add(orderByItem);
                }
            }
            else
            {
                orderList.add((OrderByItem) orderByItems);
            }
        }

        return orderList;
    }
1028122
public Entity get(Entity where) throws SQLException {
		return db.find(null, fixEntity(where), new EntityHandler());
	}
686445
static QuerySpecification getCheckSelect(Session session, Table t,
            Expression e) {

        CompileContext     compileContext = new CompileContext(session);
        QuerySpecification s = new QuerySpecification(compileContext);

        s.exprColumns    = new Expression[1];
        s.exprColumns[0] = EXPR_TRUE;

        RangeVariable range = new RangeVariable(t, null, null, null,
            compileContext);

        s.rangeVariables = new RangeVariable[]{ range };

        HsqlList unresolved = e.resolveColumnReferences(s.rangeVariables,
            null);

        ExpressionColumn.checkColumnsResolved(unresolved);
        e.resolveTypes(session, null);

        if (Type.SQL_BOOLEAN != e.getDataType()) {
            throw Error.error(ErrorCode.X_42568);
        }

        Expression condition = new ExpressionLogical(OpTypes.NOT, e);

        s.queryCondition = condition;

        s.resolveReferences(session);
        s.resolveTypes(session);

        return s;
    }
59419
public WhereCondition Val(Object val) {

        if ("?".equals(val)) {
            // question mark means WILDCARD for prepared statement
            mSgSQL.append(" ?");
        }
        else {
            mSgSQL.append("'");
            mSgSQL.append(val.toString());
            mSgSQL.append("'");
        }

        checkTokenOrderIsCorrect(ESqlToken.VALUE);
        return WhereCondition.this;
    }
137008
public static boolean hasHaving(JPQLExpression jpqlExpression)
    {
        if (isSelectStatement(jpqlExpression))
        {
            return ((SelectStatement) jpqlExpression.getQueryStatement()).hasHavingClause();
        }
        return false;
    }
1303468
public List<Entity> find(Entity where) throws SQLException {
		return find(where.getFieldNames(), where, EntityListHandler.create());
	}
900027
public static QueryLexer lexer(String expression) {
        QueryLexer lexer = new QueryLexer(input(expression));
        lexer.removeErrorListeners();
        lexer.addErrorListener(ERROR_LISTENER);
        return lexer;
    }
674950
private <L extends Collection<JQLPlaceHolder>> L extractPlaceHoldersFromVariableStatement(final JQLContext jqlContext, String jql, final L result) {
		final One<Boolean> valid = new One<>();

		if (!StringUtils.hasText(jql))
			return result;

		valid.value0 = false;

		analyzeVariableStatementInternal(jqlContext, jql, new JqlBaseListener() {

			@Override
			public void enterBind_parameter(Bind_parameterContext ctx) {
				String parameter;
				if (ctx.bind_parameter_name() != null) {
					parameter = ctx.bind_parameter_name().getText();
				} else {
					parameter = ctx.getText();
				}
				result.add(new JQLPlaceHolder(JQLPlaceHolderType.PARAMETER, parameter));
			}

			@Override
			public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) {
				result.add(new JQLPlaceHolder(JQLPlaceHolderType.DYNAMIC_SQL, ctx.bind_parameter_name().getText()));
			}

		});
		return result;
	}
428852
private List<IndexExpression> filteredExpressions(List<IndexExpression> clause) {
        List<IndexExpression> filteredExpressions = new ArrayList<>(clause.size());
        for (IndexExpression ie : clause) {
            ByteBuffer columnName = ie.column;
            if (!indexedColumnName.equals(columnName)) {
                filteredExpressions.add(ie);
            }
        }
        return filteredExpressions;
    }
1204168
protected String getWhereClause() {
		StringBuilder where = new StringBuilder();
		for (final TableMetadata.Column col : this.tableMetadata.getColumns()) {
			final String camelColName = col.getCamelColumnName();

			Parameter param = context().getParam(camelColName);
			if (param != null) {
				if (param.getValue() instanceof Operator) {
					Operator ope = (Operator) param.getValue();
					where.append("\t").append("AND ").append(col.getColumnIdentifier())
							.append(ope.toConditionString()).append(System.lineSeparator());
				} else if (!this.useOperator) {
					where.append("\t").append("AND ").append(col.getColumnIdentifier())
							.append(" = ").append("/*").append(camelColName).append("*/''")
							.append(System.lineSeparator());
				}
			}
		}
		if (!this.rawStrings.isEmpty()) {
			for (CharSequence raw : rawStrings) {
				if (where.length() > 0) {
					where.append("\t").append("AND ( ").append(raw).append(" )").append(System.lineSeparator());
				} else {
					where.append("\t").append("( ").append(raw).append(" )").append(System.lineSeparator());
				}
			}
		}

		if (where.length() > 0) {
			return new StringBuilder().append("WHERE").append(System.lineSeparator()).append(where.toString())
					.toString();
		} else {
			return "";
		}
	}
471809
public static boolean hasWhereClause(JPQLExpression jpqlExpression)
    {
        if (isSelectStatement(jpqlExpression))
        {
            return ((SelectStatement) jpqlExpression.getQueryStatement()).hasWhereClause();
        }
        else if (isUpdateStatement(jpqlExpression))
        {
            return ((UpdateStatement) jpqlExpression.getQueryStatement()).hasWhereClause();
        }
        if (isDeleteStatement(jpqlExpression))
        {
            return ((DeleteStatement) jpqlExpression.getQueryStatement()).hasWhereClause();
        }
        return false;
    }
18440
public function getDSQLExpression($expression)
    {
        $expr = $this->expr;
        if (is_callable($expr)) {
            $c = $this->expr;
            $expr = $c($this->owner, $expression);
        }

        if (is_string($expr)) {
            // If our Model has expr() method (inherited from Persistence\SQL) then use it
            if ($this->owner->hasMethod('expr')) {
                return $this->owner->expr('([])', [$this->owner->expr($expr)]);
            }

            // Otherwise call it from expression itself
            return $expression->expr('([])', [$expression->expr($expr)]);
        }

        return $expr;
    }
1115851
public function getWhereExpression()
    {
        if (!count($this->filters)) {
            return null;
        }

        $wrapExpr = $this->qb->expr()->andX();
        $config = $this->config->getConfig($this->contentType);
        $searchExpr = $this->qb->expr()->orX();
        $searchKeys = array_keys($config);

        /** @var Filter $filter */
        foreach ($this->filters as $filter) {
            if (in_array($filter->getKey(), $searchKeys, true)) {
                $searchExpr->add($filter->getExpression());
            } else {
                $wrapExpr->add($filter->getExpression());
            }
        }
        $wrapExpr->add($searchExpr);

        return $wrapExpr;
    }