/** * Returns result of a query if it's successful and false otherwise * @param Sql $sql * @param Select $select * @param int $offset * @param int $limit * @return boolean|ResultInterface */ protected function fetch(Sql $sql, Select $select, $offset = 0, $limit = 0) { $this->logQuery($select); if ($offset > 0) { $select->offset($offset); } if ($limit > 0) { $select->limit($limit); } $stmt = $sql->prepareStatementForSqlObject($select); $profiler = $this->dbAdapter->getProfiler(); if ($profiler) { $profiler->profilerStart($stmt); $result = $stmt->execute(); $profile = $profiler->getLastProfile(); $this->logQuery($profile); } else { $result = $stmt->execute(); } if ($result instanceof ResultInterface && $result->isQueryResult()) { return $result; } return false; }