where条件中，括号开始(左括号)

@param string $connector

@return QueryBuilder
163449
public function openWhere($connector = self::LOGICAL_AND): self
    {
        return $this->bracketCriteria($this->where, self::BRACKET_OPEN, $connector);
    }
1020697
public function sqlBuilder($domain)
    {
        switch ($domain) {
            case 'connexion' :
                return new module_report_sqlconnexion($this->app, $this);
                break;
            case 'download' :
  // no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
                return new module_report_sqldownload($this->app, $this);
                break;
            case 'question' :
                return new module_report_sqlquestion($this->app, $this);
                break;
            case 'action' :
                return new module_report_sqlaction($this->app, $this);
                break;
            default:
                return $this->req;
                break;
        }
    }
950190
public function SqlBuilder()
    {
        if (!$this->builder)
            $this->builder = new Sql\Builder($this->Connection());
        
        return $this->builder;
    }
1115566
public function onClientConnect($connection)
    {
        $connection->id = self::generateConnectionId();
        // 保存该连接的内部通讯的数据包报头，避免每次重新初始化
        $connection->gatewayHeader = array(
            'local_ip'      => ip2long($this->lanIp),
            'local_port'    => $this->lanPort,
            'client_ip'     => ip2long($connection->getRemoteIp()),
            'client_port'   => $connection->getRemotePort(),
            'gateway_port'  => $this->_gatewayPort,
            'connection_id' => $connection->id,
            'flag'          => 0,
        );
        // 连接的 session
        $connection->session                       = '';
        // 该连接的心跳参数
        $connection->pingNotResponseCount          = -1;
        // 该链接发送缓冲区大小
        $connection->maxSendBufferSize             = $this->sendToClientBufferSize;
        // 保存客户端连接 connection 对象
        $this->_clientConnections[$connection->id] = $connection;

        // 如果用户有自定义 onConnect 回调，则执行
        if ($this->_onConnect) {
            call_user_func($this->_onConnect, $connection);
        }

        $this->sendToWorker(GatewayProtocol::CMD_ON_CONNECTION, $connection);
    }
822936
private function createBuilderFromConnection(Connection $connection, string $modelClass): ModelQueryBuilder
    {
        return $this->getFactory()->createModelQueryBuilder($connection, $modelClass, $this->getModelSchemas());
    }
289314
protected function exportableQuery(Builder $query): Builder
    {
        // Allow executing custom exportable query.
        if (method_exists($this->module, 'exportableQuery')) {
            return $this->module->exportableQuery($query);
        }

        return $query
            ->when($query->getModel() instanceof Translatable, function ($query) {
                $query->translated();
            })
            // leave select after joining with translations
            // table in order to rewrite selected columns
            ->select($this->exportableColumns());
    }
225467
private function slaveQueryBuilder()
    {
        /** @var Connection $connection */
        $connection = $this->em->getConnection();
        if ($connection instanceof MasterSlaveConnection) {
            // Prefer a slave connection if available.
            $connection->connect('slave');
        }

        return new QueryBuilder($connection);
    }
819287
public function whereNotBetween(string $column, $min, $max, string $connector = self::LOGICAL_AND): self
    {
        $this->criteria($this->where, $column, [$min, $max], self::NOT_BETWEEN, $connector);

        return $this;
    }
183727
public static function selectQuery($tableName, $fields, $data, $condition, $connection)
    {
        $query = "";
        $columnName = "";
        
        try
        {
            $arraySize = count($data);
            if( $arraySize > 1 && $condition == NULL)
            {
                $query = "Please Supply the condition";
            }
            else
            {
                if ($condition === 'AND' || $condition === 'OR' || $condition === NULL) {
                    $columnName = self::whereAndClause($tableName, $data, $condition);
                } elseif ($condition === 'LIKE') {
                    $columnName = self::whereLikeClause($tableName, $data, $condition);
                } 
                $query =  "SELECT $fields FROM $tableName WHERE $columnName";
            }
        } catch (PDOException $e) {
            $query = $e->getMessage();
        }

        return $query;
    }
568700
public function where(string $column, $value, $operator = self::OPERATOR_EQ, $connector = self::LOGICAL_AND): self
    {
        $this->criteria($this->where, $column, $value, $operator, $connector);

        return $this;
    }
874140
public function getQueryBuilder($entity): QueryBuilderInterface
    {
        $metaInformation = $this->metaInformationFactory->loadInformation($entity);

        return new QueryBuilder($this, $metaInformation);
    }
1356495
private function getRuleSelectQuery(): QueryBuilder
    {
        $query = $this->connection->createQueryBuilder();
        $query->select('DISTINCT r.*', 'rd.*')
            ->from('ngbm_rule', 'r')
            ->innerJoin(
                'r',
                'ngbm_rule_data',
                'rd',
                $query->expr()->eq('rd.rule_id', 'r.id')
            );

        return $query;
    }
734652
protected function getNewMySqlConnection(array $config, string $connection = null)
    {
        if ($connection && isset($config[$connection])) {
            $config = array_merge($config, $config[$connection]);
        }

        return ConnectorFactory::make(FW::version())->connect($config);
    }
188027
public function buildWhere(Query $query, $where)
    {
        if (empty($where)) {
            $where = [];
        }

        $whereStr = '';
        $binds    = $this->connection->getFieldsBind($query->getOptions('table'));

        foreach ($where as $logic => $val) {
            $str = [];

            foreach ($val as $value) {
                if ($value instanceof Expression) {
                    $str[] = ' ' . $logic . ' ( ' . $value->getValue() . ' )';
                    continue;
                }

                if (is_array($value)) {
                    if (key($value) !== 0) {
                        throw new Exception('where express error:' . var_export($value, true));
                    }
                    $field = array_shift($value);
                } elseif (!($value instanceof \Closure)) {
                    throw new Exception('where express error:' . var_export($value, true));
                }

                if ($value instanceof \Closure) {
                    // 使用闭包查询
                    $newQuery = $query->newQuery()->setConnection($this->connection);
                    $value($newQuery);
                    $whereClause = $this->buildWhere($query, $newQuery->getOptions('where'));

                    if (!empty($whereClause)) {
                        $str[] = ' ' . $logic . ' ( ' . $whereClause . ' )';
                    }
                } elseif (is_array($field)) {
                    array_unshift($value, $field);
                    $str2 = [];
                    foreach ($value as $item) {
                        $str2[] = $this->parseWhereItem($query, array_shift($item), $item, $logic, $binds);
                    }

                    $str[] = ' ' . $logic . ' ( ' . implode(' AND ', $str2) . ' )';
                } elseif (strpos($field, '|')) {
                    // 不同字段使用相同查询条件（OR）
                    $array = explode('|', $field);
                    $item  = [];

                    foreach ($array as $k) {
                        $item[] = $this->parseWhereItem($query, $k, $value, '', $binds);
                    }

                    $str[] = ' ' . $logic . ' ( ' . implode(' OR ', $item) . ' )';
                } elseif (strpos($field, '&')) {
                    // 不同字段使用相同查询条件（AND）
                    $array = explode('&', $field);
                    $item  = [];

                    foreach ($array as $k) {
                        $item[] = $this->parseWhereItem($query, $k, $value, '', $binds);
                    }

                    $str[] = ' ' . $logic . ' ( ' . implode(' AND ', $item) . ' )';
                } else {
                    // 对字段使用表达式查询
                    $field = is_string($field) ? $field : '';
                    $str[] = ' ' . $logic . ' ' . $this->parseWhereItem($query, $field, $value, $logic, $binds);
                }
            }

            $whereStr .= empty($whereStr) ? substr(implode(' ', $str), strlen($logic) + 1) : implode(' ', $str);
        }

        return $whereStr;
    }
1232140
public function query() : Builder
	{
		if (trim($conditions = $this->conditions) !== '') {
			$this->builder->where('condition', 'LIKE', $conditions);
		}

		return $this->builder;
	}
1224044
private function slaveQueryBuilder()
    {
        /** @var Connection $connection */
        $connection = $this->getEntityManager()->getConnection();
        if ($connection instanceof MasterSlaveConnection) {
            // Prefer a slave connection if available.
            $connection->connect('slave');
        }

        return new QueryBuilder($connection);
    }
102443
public function openHaving($connector = self::LOGICAL_AND): self
    {
        return $this->bracketCriteria($this->having, self::BRACKET_OPEN, $connector);
    }