It depends on how you want to check them. If you are searching for each page, then enabling the profiler will be fine. This shows all the requests that are executed when this page loads, as well as the time taken to complete them. See the link below on the profiler.
http://codeigniter.com/user_guide/general/profiling.html
If you want to log all queries as they arise, and then read the log file later, you will have to extend the database class. If so, please comment and I will update / extend my answer further.
Extension to rewrite query()
Extend MY_Loader.php in / application / core / and paste this function
function database($params = '', $return = FALSE, $active_record = NULL) { // Grab the super object $CI =& get_instance(); // Do we even need to load the database class? if (class_exists('CI_DB') AND $return == FALSE AND $active_record == NULL AND isset($CI->db) AND is_object($CI->db)) { return FALSE; } require_once(BASEPATH.'database/DB'.EXT); // Load the DB class $db =& DB($params, $active_record); $my_driver = config_item('subclass_prefix').'DB_'.$db->dbdriver.'_driver'; $my_driver_file = APPPATH.'core/'.$my_driver.EXT; if (file_exists($my_driver_file)) { require_once($my_driver_file); $db = new $my_driver(get_object_vars($db)); } if ($return === TRUE) { return $db; } // Initialize the db variable. Needed to prevent // reference errors with some configurations $CI->db = ''; $CI->db = $db; }
Then create / application / core / MY _DB_mysql_driver.php
Then inside you can rewrite the request ()
function query($sql, $binds = FALSE, $return_object = TRUE) { // Do your stuff return parent::query( $sql, $binds, $return_object ); }
Obviously, replace mysql in the file name with any database driver that you are using / trying to expand.
This will also work with Active Record, since all get()
methods call query()
from the driver to launch their queries.