예제 #1
0
	/**
	 * Executes a query.
	 * Uses the cache version if available
	 * 
	 * @param	Atomik_Db_Query		$query
	 * @return 	Atomik_Db_Query_Result
	 */
	protected function _executeQuery(Atomik_Db_Query $query)
	{
		$hash = $query->toHash();
		if ($this->_queryCacheEnabled && isset($this->_queryCache[$hash])) {
			$this->_queryCache[$hash]->rewind();
			return $this->_queryCache[$hash];
		}
		
		if (($result = $query->execute()) === false) {
			return false;
		}
		
		if ($this->_queryCacheEnabled) {
			$this->_queryCache[$hash] = $result;
			return $this->_queryCache[$hash];
		}
		return $result;
	}