caching("table"); * * @return string */ public function caching($table) { return (array_key_exists('cache',Kohana::modules()) AND $this->_config['caching'] AND isset($this->_config['cache'][$table])) ? $this->_config['cache'][$table] : FALSE; } private function clear() { $this->_query_msg_codes = array(); } public function escape($value) { // SQL standard is to use single-quotes for all values return "'$value'"; } public function query($type, $sql, $as_object = FALSE, array $params = NULL) { // Make sure the database is connected if (! $this->_connection && ! $this->connect()) return new Database_TSM_Result(array(),'',$as_object,$params); $this->clear(); if ( ! empty($this->_config['profiling'])) // Benchmark this query for the current instance $benchmark = Profiler::start("Database ({$this->_instance})", $sql); // Execute the query $result = $this->execute($sql); if ($this->execute_stderr AND $this->execute_rc) { // This benchmark is worthless if (isset($benchmark)) Profiler::delete($benchmark); SystemMessage::TSM('danger',sprintf('%s (%s)',$this->execute_stdout,$this->execute_stderr),$sql); } if (isset($benchmark)) Profiler::stop($benchmark); // Set the last query $this->last_query = $sql; if ($type === Database::SELECT) // Return an iterator of results return new Database_TSM_Result($result, $sql, $as_object, $params); elseif ($type === Database::INSERT) return new Database_TSM_Result($result, $sql, $as_object, $params); elseif ($type === Database::SHOW) return new Database_TSM_Show($result, $sql, $as_object, $params); elseif ($type === Database::SET) return new Database_TSM_Set($result, $sql, $as_object, $params); } } ?>