Commits

Dan Horrigan committed 96aa009

Changed the Database library 'save_queries' option default to FALSE. The setting now gets overridden when profiling is enabled. Also added the setting to the documentation.

Comments (0)

Files changed (2)

system/database/DB_driver.php

 	var $benchmark		= 0;
 	var $query_count	= 0;
 	var $bind_marker	= '?';
-	var $save_queries	= TRUE;
+	var $save_queries	= FALSE;
 	var $queries		= array();
 	var $query_times	= array();
 	var $data_cache		= array();
 	var $cachedir		= '';
 	var $cache_autodel	= FALSE;
 	var $CACHE; // The cache class object
+	var $_ci			= NULL;
 
 	// Private variables
 	var $_protect_identifiers	= TRUE;
 	 */
 	function CI_DB_driver($params)
 	{
+		$this->_ci =& get_instance();
+
 		if (is_array($params))
 		{
 			foreach ($params as $key => $val)
 		}
 
 		// Save the  query for debugging
-		if ($this->save_queries == TRUE)
+		if ($this->save_queries === TRUE || $this->_ci->output->enable_profiler === TRUE)
 		{
 			$this->queries[] = $sql;
 		}
 		// Run the Query
 		if (FALSE === ($this->result_id = $this->simple_query($sql)))
 		{
-			if ($this->save_queries == TRUE)
+			if ($this->save_queries === TRUE || $this->_ci->output->enable_profiler === TRUE)
 			{
 				$this->query_times[] = 0;
 			}
 		$time_end = list($em, $es) = explode(' ', microtime());
 		$this->benchmark += ($em + $es) - ($sm + $ss);
 
-		if ($this->save_queries == TRUE)
+		if ($this->save_queries === TRUE || $this->_ci->output->enable_profiler === TRUE)
 		{
 			$this->query_times[] = ($em + $es) - ($sm + $ss);
 		}

user_guide/database/configuration.html

 <li><strong>pconnect</strong> - TRUE/FALSE (boolean) - Whether to use a persistent connection.</li>
 <li><strong>db_debug</strong> - TRUE/FALSE (boolean) - Whether database errors should be displayed.</li>
 <li><strong>cache_on</strong> - TRUE/FALSE (boolean) - Whether database query caching is enabled, see also <a href="caching.html">Database Caching Class</a>.</li>
+<li><strong>save_queries</strong> - TRUE/FALSE (boolean) - Whether to save all queries ran, along with the query execution times (this setting is overridden when <a href="../general/profiling.html">Profiling</a> is enabled).</li>
 <li><strong>cachedir</strong> - The absolute server path to your database query cache directory.</li>
 <li><strong>char_set</strong> - The character set used in communicating with the database.</li>
 <li><strong>dbcollat</strong> - The character collation used in communicating with the database.</li>