Loads data for the given $pass.

@param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
@param int $bulkCount
@param int $pass

@return array
555410
protected function loadData(SelectQuery $query, $bulkCount, $pass)
    {
        $query->limit($bulkCount, $pass * $bulkCount);

        $stmt = $query->prepare();
        $stmt->execute();

        return $stmt->fetchAll(PDO::FETCH_ASSOC);
    }
587318
public function getAll($query, $limit, $offset)
    {
        // TODO: user query
        $users = $this->userManager->findBy(array(), array('lastname' => 'ASC'), $limit, $offset);

        $data = array();
        foreach ($users as $user) {
            $data[] = array(
                'securityType' => get_class($user),
                'securityId' => $user->getId(),
                'securityName' => $user->getDisplayName(),
            );
        }

        return array(
            'total' => $this->userManager->countAll(),
            'data' => $data,
        );
    }
87825
public static function load($query, $fields = null)
    {
        //
        static::applySchema();

        //
        if (is_array($query)) {
            return static::loadByQuery($query, $fields);
        }

        //
        $key = static::getPrimaryKey();

        //
        return $key
             ? static::loadByPrimaryKey($query, $fields)
             : static::loadByMainField($query, $fields);
    }
32410
public function bindExecuteLastInsertId($query, $parameters = [])
    {
        $statement = $this->link->prepare($query);

        foreach ($parameters as $index => $paramProperties) {
            if (is_object($paramProperties)) {
                $paramProperties = (array) $paramProperties;
            }

            if (is_array($paramProperties)) {
                $statement->bindValue(
                    (int) $index + 1,
                    $paramProperties['value'],
                    $paramProperties['param']
                );
            } else {
                $statement->bindValue((int) $index + 1, $paramProperties);
            }
        }

        $statement->execute();

        return $this->link->lastInsertId();
    }
106037
public function update(Query $query)
    {
        $options = $query->getOptions();

        $data  = $this->parseSet($query, $options['data']);
        $where = $this->parseWhere($query, $options['where']);

        if (1 == $options['limit']) {
            $updateOptions = ['multi' => false];
        } else {
            $updateOptions = ['multi' => true];
        }

        if (isset($options['upsert']) && $options['upsert'] == true) {
            $updateOptions['upsert'] = true;
        }

        $bulk = new BulkWrite;

        $bulk->update($where, $data, $updateOptions);

        $this->log('update', $data, $where);

        return $bulk;
    }
875799
protected function verifySelectQuery(SelectQuery $query) {
        $this->verifyScope($query);
        $this->verifyRequiredFields($query);
        $this->verifyFields($query);
        $this->verifyLimits($query);
    }
500872
public function select( $query, $bindings = [] )
	{
		$query = $this->bind_params( $query, $bindings );

		$result = $this->db->get_results( $query );

		if ( $result === false || $this->db->last_error ) {
			throw new QueryException( $query, $bindings, new \Exception( $this->db->last_error ) );
		}

		return $result;
	}
268339
public function loadAll(array $criteria = [], ?array $sort = null, ?int $limit = null, ?int $skip = null) : Iterator
    {
        $criteria = $this->prepareQueryOrNewObj($criteria);
        $criteria = $this->addDiscriminatorToPreparedQuery($criteria);
        $criteria = $this->addFilterToPreparedQuery($criteria);

        $options = [];
        if ($sort !== null) {
            $options['sort'] = $this->prepareSort($sort);
        }

        if ($limit !== null) {
            $options['limit'] = $limit;
        }

        if ($skip !== null) {
            $options['skip'] = $skip;
        }

        assert($this->collection instanceof Collection);
        $baseCursor = $this->collection->find($criteria, $options);
        return $this->wrapCursor($baseCursor);
    }
976016
public function search($query, $limit = 10000, $showData = true, $include = null, $exclude = null)
    {
        $showData = $showData === true ? 1 : 0;

        $uri = "{$this->uri}?q=" . urlencode($query) . "&limit=$limit" . "&showData=$showData";

        if ($include) {
            $uri .= "&include=$include";
        } elseif($exclude) {
            $uri .= "&exclude=$exclude";
        }

        $response = Request::get($uri)
            ->authenticateWith($this->username, $this->password
            )->send();

        return $this->processResponse($response);
    }
1209611
public function getPaginated($limit = 1, $fields = null, $sqlQuery = false)
    {
        $sql = $this->buildQuery('select', $fields, ['count'=>null, 'field'=>'num']);
        $result = $this->executeQuery($sql);
        $row = $result->fetch_array(MYSQLI_ASSOC);
        $total = $row['num'];
        if($total == 0 && $sqlQuery == false) {
            return [];
        }
        $this->pagination->initialize($limit, $total);
        return $this->limit($limit, $this->pagination->getStartPoint())->getAll($fields, $sqlQuery);
    }
446520
public function paginate(Query $query, $page = 1, $limit = 10, $fetchJoinCollection = false): array
    {
        $paginator = new Paginator($query, $fetchJoinCollection);
        $totalItems = $paginator->count();
        $pagesCount = ceil($totalItems / $limit);
        $paginator
            ->getQuery()
            ->setFirstResult($limit * ($page - 1))// offset
            ->setMaxResults($limit); // limit

        return [
            'meta' => [
                'page' => $page,
                'total' => $totalItems,
                'pages' => $pagesCount,
                'limit' => $limit,
            ],
            'data' => $paginator
        ];
    }
894883
public function paginate(Query $query, array $countFields = [], $total = false)
    {
        $limit = $this->defaultLimit;
        if (in_array((integer)$this->request->getQuery('l', 0), $this->limits)) {
            $limit = (integer)$this->request->getQuery('l');
            $this->activeLimit = $limit;
        }
        if (!$this->activeLimit) {
            $lastLimit = $this->request->getSession()->read(join('.', [
                'LIMIT_' . $this->request->getParam('plugin'),
                $this->controller->getName(),
                $this->action
            ]));
            if ($lastLimit) {
                $limit = $lastLimit;
            }
            $this->activeLimit = $limit;
        }
        $this->request = $this->request->withData('l', $limit);

        if ($total === false) {
            $countQuery = clone $query;
            if (!empty($countFields)) {
                $countQuery->select($countFields);
            }
            $total = $countQuery->count();
        }

        if ($limit !== null && $total !== null) {
            $pages = ceil($total / $limit);
            if ($this->page > $pages) {
                $this->page = $pages;
            }
            if ($this->page < 1) {
                $this->page = 1;
            }
            $offset = ($this->page > 1) ? ($this->page - 1) * $limit : 0;
            $from = ($offset > 0) ? $offset + 1 : 1;
            $to = (($from + $limit - 1) > $total) ? $total : $from + $limit - 1;

            $query->limit($limit)->offset($offset);

            $this->paginationParams = [
                'from' => ($total === 0) ? 0 : $from,
                'page' => $this->page,
                'pages' => ($total === 0) ? 1 : $pages,
                'to' => $to,
                'total' => $total,
                'defaultLimit' => $this->defaultLimit,
                'limits' => array_combine($this->limits, $this->limits),
                'passParams' => []
            ];

            if (!empty($this->_passParams)) {
                $this->paginationParams['passParams'] = $this->_passParams;
            }
        }

        return $query;
    }
181544
public function delete(Query $query)
    {
        $options = $query->getOptions();
        $where   = $this->parseWhere($query, $options['where']);

        $bulk = new BulkWrite;

        if (1 == $options['limit']) {
            $deleteOptions = ['limit' => 1];
        } else {
            $deleteOptions = ['limit' => 0];
        }

        $bulk->delete($where, $deleteOptions);

        $this->log('remove', $where, $deleteOptions);

        return $bulk;
    }
261573
public static function executeBulk(BulkHandler $bulkHandler, string $query): void
  {
    self::realQuery($query);

    $bulkHandler->start();

    $result = self::$mysqli->use_result();
    while (($row = $result->fetch_assoc()))
    {
      $bulkHandler->row($row);
    }
    $result->free();

    $bulkHandler->stop();

    if (self::$mysqli->more_results()) self::$mysqli->next_result();
  }
1058191
protected function _fetchAll($query, $params)
    {
        $db = $this->db;
        $sth = $db->prepare($query);
        foreach ($params as $key => $val) {
            if (is_int($val)) {
                $sth->bindValue("$key", $val, $db::PARAM_INT);
            } else {
                $sth->bindValue("$key", $val);
            }
        }
        $sth->execute();
        return $sth->fetchAll($db::FETCH_ASSOC);
    }
84138
public function executeRow0(string $query): ?array
  {
    $result = $this->query($query);
    $row    = $result->fetch_assoc();
    $n      = $result->num_rows;
    $result->free();

    if ($this->mysqli->more_results()) $this->mysqli->next_result();

    if (!($n==0 || $n==1))
    {
      throw new ResultException('0 or 1', $n, $query);
    }

    return $row;
  }
1021619
protected function verifyLimits (SelectQuery $query) {
        if (empty($query->getLimit())) {
            $query->limit($this->getDefaultLimit());

        } else if ($query->getLimit() > $this->getMaxLimit()) {
            $query->limit($this->getMaxLimit());
        }
    }