/** * Wraps a query result into a model set * * @param Atomik_Db_Query_Result $result * @return Atomik_Model_Modelset */ public function wrapResult(Atomik_Db_Query_Result $result) { $query = $result->getQuery(); $builder = self::getBuilderFromQuery($query); return new Atomik_Model_Modelset($builder, $result); }
/** * Executes the request against a PDO object * * @return bool|Atomik_Db_Query_Result False if fail or the Atomik_Db_Query_Result object */ public function execute($reCache = false, Atomik_Db_Query_Result $resultObject = null) { if ($this->_instance === null) { require_once 'Atomik/Db/Query/Exception.php'; throw new Atomik_Db_Query_Exception('An Atomik_Db_Instance must be attached to the queyr to execute it'); } if (($resultObject === null || !$reCache) && $this->_cachedResult !== null) { return $this->_cachedResult; } if ($this->_statement === null) { // prepare the query only if the statement is not already prepared $this->_statement = $this->_pdo->prepare($this->toSql()); } $this->_lastError = false; if (!$this->_statement->execute($this->getParams())) { $this->_lastError = $this->_statement->errorInfo(); return false; } if ($resultObject === null) { $resultObject = new Atomik_Db_Query_Result($this); if ($this->_cacheable) { $this->_cachedResult = $resultObject; } } $resultObject->reset($this->_statement); return $resultObject; }
/** * Sets the default fetch mode * * @param int $fetchMode */ public static function setDefaultFetchMode($fetchMode) { self::$_defaultFetchMode = func_get_args(); }