@param AndExpressionInterface $andExpression

@return int
341969
private function serializeAndExpression(AndExpressionInterface $andExpression): int
    {
        $index = $this->allocateIndex();

        $serialized = [
            static::TYPE                     => static::TYPE__AND_EXPRESSION,
            static::AND_EXPRESSION_PRIMARY   => $this->addBlock($andExpression->getPrimary()),
            static::AND_EXPRESSION_SECONDARY => $this->addBlock($andExpression->getSecondary()),
        ];
        if (empty($andExpression->getProperties()) === false) {
            $serialized[static::PROPERTIES] = $andExpression->getProperties();
        }

        $this->serializedBlocks[$index] = $serialized;

        return $index;
    }
126799
private void updateEnabled(boolean and) {

        boolean b = cTransfer.getState();

        tDestTable.setEnabled(and && b);
        tDestDrop.setEnabled(and && b && cDrop.getState());
        tDestCreate.setEnabled(and && b && cCreate.getState());
        tDestDelete.setEnabled(and && b && cDelete.getState());
        tDestCreateIndex.setEnabled(and && b && cCreateIndex.getState());
        tDestDropIndex.setEnabled(and && b && cDropIndex.getState());
        tSourceSelect.setEnabled(and && b);
        tDestInsert.setEnabled(and && b && cInsert.getState());
        tDestAlter.setEnabled(and && b && cAlter.getState());
        cDrop.setEnabled(and && b);
        cCreate.setEnabled(and && b);
        cDelete.setEnabled(and && b);
        cCreateIndex.setEnabled(and && b);
        cDropIndex.setEnabled(and && b);
        cInsert.setEnabled(and && b);
        cAlter.setEnabled(and && b);
        cFKForced.setEnabled(cAlter.getState());
        cIdxForced.setEnabled(cCreateIndex.getState());
        bStart.setEnabled(and);

        if (iTransferMode == TRFM_TRANSFER) {
            bContinue.setEnabled(and);
        }
    }
1201964
private AndQueryBuilder getAndFilterBuilder(Expression logicalExp, EntityMetadata m)
    {
        AndExpression andExp = (AndExpression) logicalExp;
        Expression leftExpression = andExp.getLeftExpression();
        Expression rightExpression = andExp.getRightExpression();

        return new AndQueryBuilder(populateFilterBuilder(leftExpression, m), populateFilterBuilder(rightExpression, m));
    }
1144528
public function truncate($entity, $andCluster = false)
    {
        try {
            $validator = new RidValidator;
            $validator->check($entity);
            $commandClass = $this->getCommandClass('truncate.record');
        } catch (ValidationException $e) {
            $commandClass = $this->getCommandClass('truncate.class');

            if ($andCluster) {
                $commandClass = $this->getCommandClass('truncate.cluster');
            }
        }

        $this->command = new $commandClass($entity);

        return $this->command;
    }
1249584
protected function execute(InputInterface $input, OutputInterface $output) : int
    {
        /* @var ConsoleOutput $output */
        $output->setPrefix(ConsoleOutput::PREFIX_TIMESTAMP | ConsoleOutput::PREFIX_CLASSNAME);

        $this->queue = self::queue($input->getOption('queue'));

        if ($this->input->getOption('stop-when-empty') && !$this->queue->getStorage() instanceof CountableInterface) {
            throw new UserException("Can't use stop-when-empty on '" . $this->queue->getType() . "' storage");
        }

        return parent::execute($input, $output);
    }
1312743
private function serializeOrExpression(OrExpressionInterface $orExpression): int
    {
        $index = $this->allocateIndex();

        $serialized = [
            static::TYPE                    => static::TYPE__OR_EXPRESSION,
            static::OR_EXPRESSION_PRIMARY   => $this->addBlock($orExpression->getPrimary()),
            static::OR_EXPRESSION_SECONDARY => $this->addBlock($orExpression->getSecondary()),
        ];
        if (empty($orExpression->getProperties()) === false) {
            $serialized[static::PROPERTIES] = $orExpression->getProperties();
        }

        $this->serializedBlocks[$index] = $serialized;

        return $index;
    }
443601
public function getSiblings($andSelf = false)
    {
        $tableName = $this->owner->tableName();
        $path = $this->getParentPath();
        $like = strtr($path . $this->delimiter, ['%' => '\%', '_' => '\_', '\\' => '\\\\']);

        $query = $this->owner->find()
            ->andWhere(['like', "{$tableName}.[[{$this->pathAttribute}]]", $like . '%', false])
            ->andWhere(['<=', "{$tableName}.[[{$this->depthAttribute}]]", $this->owner->{$this->depthAttribute}]);

        if (!$andSelf) {
            $query->andWhere(["!=", "{$tableName}.[[{$this->itemAttribute}]]", $this->owner->{$this->itemAttribute}]);
        }

        $orderBy = [];
        $orderBy["{$tableName}.[[{$this->depthAttribute}]]"] = SORT_ASC;
        if ($this->sortable !== false) {
            $orderBy["{$tableName}.[[{$this->behavior->sortAttribute}]]"] = SORT_ASC;
        }
        $orderBy["{$tableName}.[[{$this->itemAttribute}]]"] = SORT_ASC;

        $query
            ->andWhere($this->treeCondition())
            ->addOrderBy($orderBy);
        $query->multiple = true;
        return $query;
    }
1232917
public function delete($key = '', $and = true, $tablePrefix = null)
    {
        is_null($tablePrefix) && $tablePrefix = $this->tablePrefix;
        $tableName = $condition = '';

        empty($key) || list($tableName, $condition) = $this->parseKey($key, $and, true, true);

        if (empty($tableName)) {
            $tableAndCacheKey = $this->tableFactory(false);
            $tableName = $tableAndCacheKey[0];
            $upCacheTables = $tableAndCacheKey[1];
        } else {
            $tableName = $tablePrefix . $tableName;
            $upCacheTables = [$tableName];
            isset($this->forceIndex[$tableName]) && $tableName .= ' force index(' . $this->forceIndex[$tableName] . ') ';
        }

        if (empty($tableName)) {
            throw new \InvalidArgumentException(Lang::get('_PARSE_SQL_ERROR_NO_TABLE_', 'delete'));
        }
        $whereCondition = $this->sql['where'];
        $whereCondition .= empty($condition) ? '' : (empty($whereCondition) ? 'WHERE ' : '') . $condition;
        if (empty($whereCondition)) {
            throw new \InvalidArgumentException(Lang::get('_PARSE_SQL_ERROR_NO_CONDITION_', 'delete'));
        }
        $this->currentQueryIsMaster = true;
        $limit = '';
        if ($this->sql['limit']) {
            $limit = explode(',', $this->sql['limit']);
            $limit = 'LIMIT ' . $limit[1];
        }
        $stmt = $this->prepare("DELETE FROM {$tableName} {$whereCondition} {$limit}", $this->wlink);
        $this->execute($stmt);

        foreach ($upCacheTables as $tb) {
            $this->setCacheVer($tb);
        }
        return $stmt->rowCount();
    }
347205
public function andIf($master = null)
    {
        if ($this->logicalOperator == "or") {
            throw new Exception("ValidationLogicCriteria: Cannot declare a logical operator more than once. (Specified andIf() after calling orIf()). Use a nested ValidationLogicCriteriaSet to combine conjunctive and disjuctive logic.");
        }
        if ($master) {
            $this->master = $master;
        }
        $this->logicalOperator = "and";
        return $this;
    }
824933
public static QueryFilter and(QueryFilter... queryFilters) {
        QueryFilter result = null;
        for (QueryFilter q : queryFilters) {
            result = result == null ? q : result.and(q);
        }
        return result;
    }
1183635
public static function countMultipleWhere (array $columnsOperatorsValues, string $joinOperator="AND", string $expressionOperator="AND") : int
	{
		$joinOperator 	= static::validateOperator($joinOperator, 'AND');
		$expressions 	= static::generateKeyValue($columnsOperatorsValues, $expressionOperator);
		$sqlQuery  		= "SELECT COUNT(*) as count FROM ".static::$tableName." WHERE ".join(" $joinOperator ", $expressions);
		$resultSet 		= Database::getInstance()->query($sqlQuery);
		$row 			= Database::fetchAssoc($resultSet);
		return (int) array_shift($row);
	}
434691
public final QueryParser.and_return and() throws RecognitionException {
        QueryParser.and_return retval = new QueryParser.and_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token WS10=null;
        Token AND11=null;
        Token WS12=null;
        QueryParser.not_return not8 = null;

        QueryParser.primary_return primary9 = null;

        QueryParser.not_return not13 = null;

        QueryParser.primary_return primary14 = null;


        CommonTree WS10_tree=null;
        CommonTree AND11_tree=null;
        CommonTree WS12_tree=null;

        try {
            // src/riemann/Query.g:30:5: ( ( not | primary ) ( ( WS )* AND ( WS )* ( not | primary ) )* )
            // src/riemann/Query.g:30:7: ( not | primary ) ( ( WS )* AND ( WS )* ( not | primary ) )*
            {
            root_0 = (CommonTree)adaptor.nil();

            // src/riemann/Query.g:30:7: ( not | primary )
            int alt4=2;
            int LA4_0 = input.LA(1);

            if ( (LA4_0==NOT) ) {
                alt4=1;
            }
            else if ( (LA4_0==TAGGED||LA4_0==25||(LA4_0>=27 && LA4_0<=38)) ) {
                alt4=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 4, 0, input);

                throw nvae;
            }
            switch (alt4) {
                case 1 :
                    // src/riemann/Query.g:30:8: not
                    {
                    pushFollow(FOLLOW_not_in_and183);
                    not8=not();

                    state._fsp--;

                    adaptor.addChild(root_0, not8.getTree());

                    }
                    break;
                case 2 :
                    // src/riemann/Query.g:30:14: primary
                    {
                    pushFollow(FOLLOW_primary_in_and187);
                    primary9=primary();

                    state._fsp--;

                    adaptor.addChild(root_0, primary9.getTree());

                    }
                    break;

            }

            // src/riemann/Query.g:30:23: ( ( WS )* AND ( WS )* ( not | primary ) )*
            loop8:
            do {
                int alt8=2;
                alt8 = dfa8.predict(input);
                switch (alt8) {
            	case 1 :
            	    // src/riemann/Query.g:30:24: ( WS )* AND ( WS )* ( not | primary )
            	    {
            	    // src/riemann/Query.g:30:24: ( WS )*
            	    loop5:
            	    do {
            	        int alt5=2;
            	        int LA5_0 = input.LA(1);

            	        if ( (LA5_0==WS) ) {
            	            alt5=1;
            	        }


            	        switch (alt5) {
            	    	case 1 :
            	    	    // src/riemann/Query.g:30:24: WS
            	    	    {
            	    	    WS10=(Token)match(input,WS,FOLLOW_WS_in_and191); 
            	    	    WS10_tree = (CommonTree)adaptor.create(WS10);
            	    	    adaptor.addChild(root_0, WS10_tree);


            	    	    }
            	    	    break;

            	    	default :
            	    	    break loop5;
            	        }
            	    } while (true);

            	    AND11=(Token)match(input,AND,FOLLOW_AND_in_and194); 
            	    AND11_tree = (CommonTree)adaptor.create(AND11);
            	    root_0 = (CommonTree)adaptor.becomeRoot(AND11_tree, root_0);

            	    // src/riemann/Query.g:30:33: ( WS )*
            	    loop6:
            	    do {
            	        int alt6=2;
            	        int LA6_0 = input.LA(1);

            	        if ( (LA6_0==WS) ) {
            	            alt6=1;
            	        }


            	        switch (alt6) {
            	    	case 1 :
            	    	    // src/riemann/Query.g:30:33: WS
            	    	    {
            	    	    WS12=(Token)match(input,WS,FOLLOW_WS_in_and197); 
            	    	    WS12_tree = (CommonTree)adaptor.create(WS12);
            	    	    adaptor.addChild(root_0, WS12_tree);


            	    	    }
            	    	    break;

            	    	default :
            	    	    break loop6;
            	        }
            	    } while (true);

            	    // src/riemann/Query.g:30:37: ( not | primary )
            	    int alt7=2;
            	    int LA7_0 = input.LA(1);

            	    if ( (LA7_0==NOT) ) {
            	        alt7=1;
            	    }
            	    else if ( (LA7_0==TAGGED||LA7_0==25||(LA7_0>=27 && LA7_0<=38)) ) {
            	        alt7=2;
            	    }
            	    else {
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 7, 0, input);

            	        throw nvae;
            	    }
            	    switch (alt7) {
            	        case 1 :
            	            // src/riemann/Query.g:30:38: not
            	            {
            	            pushFollow(FOLLOW_not_in_and201);
            	            not13=not();

            	            state._fsp--;

            	            adaptor.addChild(root_0, not13.getTree());

            	            }
            	            break;
            	        case 2 :
            	            // src/riemann/Query.g:30:44: primary
            	            {
            	            pushFollow(FOLLOW_primary_in_and205);
            	            primary14=primary();

            	            state._fsp--;

            	            adaptor.addChild(root_0, primary14.getTree());

            	            }
            	            break;

            	    }


            	    }
            	    break;

            	default :
            	    break loop8;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
1234546
private function serializeIfExpression(IfExpressionInterface $ifExpression): int
    {
        $index = $this->allocateIndex();

        $serialized = [
            static::TYPE                             => static::TYPE__IF_EXPRESSION,
            static::IF_EXPRESSION_CONDITION_CALLABLE => $ifExpression->getConditionCallable(),
        ];

        assert($ifExpression->getOnTrue() !== null || $ifExpression->getOnFalse() !== null);

        if ($ifExpression->getOnTrue() !== null) {
            $serialized[static::IF_EXPRESSION_ON_TRUE_BLOCK] = $this->addBlock($ifExpression->getOnTrue());
        }
        if ($ifExpression->getOnFalse() !== null) {
            $serialized[static::IF_EXPRESSION_ON_FALSE_BLOCK] = $this->addBlock($ifExpression->getOnFalse());
        }
        if (empty($ifExpression->getProperties()) === false) {
            $serialized[static::PROPERTIES] = $ifExpression->getProperties();
        }

        $this->serializedBlocks[$index] = $serialized;

        return $index;
    }
1276931
protected String describe(final And and) {
        final List<FieldExpression> expressions = new ArrayList<>();
        final List<FieldExpression> onExpressions = new ArrayList<>();
        for (final FieldExpression fieldExpression : and.getExpressions()) {
            if (fieldExpression instanceof On) {
                onExpressions.add(fieldExpression);
            } else {
                expressions.add(fieldExpression);
            }
        }
        final StringBuilder builder = new StringBuilder();
        if (!onExpressions.isEmpty()) {
            builder.append(bundle.getString("at"));
            createAndDescription(builder, onExpressions);
        }
        if (!expressions.isEmpty()) {
            createAndDescription(builder, expressions);
        }

        return builder.toString();
    }
610273
public function count($field = '*', $isMulti = false, $useMaster = false)
    {
        return $this->aggregation($field, $isMulti, $useMaster, 'COUNT');
    }
282372
protected function addSeparator($and) {
        $separator = $this->getDriverEscaper()->dbCommand('OR');

        if ($and) {
            $separator = $this->getDriverEscaper()->dbCommand('AND');
        }
        $this->query .= ' ' . $separator . ' ';
        return $this;
    }
56481
protected function whereCountQuery( QueryBuilder $query, $operator = '>=', $count = 1, $boolean = 'and' )
	{
		if ( is_numeric( $count ) )
		{
			$count = new Expression( $count );
		}

		$this->query->addBinding( $query->getBindings(), 'where' );

		return $this->where( new Expression( '(' . $query->toSql() . ')' ), $operator, $count, $boolean );
	}