/** * Execute a fetchAll query and deal with offsets and limits * * Populates the _result variable. Uses the $_consistentRead property to * determine whether consistency needs to be enforced for the SDB request * * @return boolean * \c true on success */ private function _executeFetchQuery() { $this->_simplifyQuery(); $optionsArray = array('ConsistentRead' => $this->_consistentRead ? 'true' : 'false'); // If we already know some tokens, don't start from the begining (for speed) $initialOffset = 0; if ($this->_offset > 0) { list($initialOffset, $token) = NextTokenCache::GetNearestToken($this->_queryString, $this->_limit, $this->_offset); if ($token) { $optionsArray['NextToken'] = $token; } } $this->_result = self::$_sdb->select($this->_queryString, $optionsArray)->getAll($this->_consistentRead, $this->_limit, $this->_offset, $initialOffset); $this->_items = $this->_result->items(); return $this->_result->isOK(); }
/** * Get items from a query and add them to this query * * @throws ORMPDOException if SDB response is not OK * @param SDBResponse $response */ private function _setItems(SDBResponse $response) { if (!$response->isOK()) { throw new ORMPDOException($response->errorMessage() . ' - ' . $response->getQuery()); } foreach ($response as $key => $item) { $this->_items[$key] = $item; } }