CodeIgniter Forums
Simple bug in Profiler's _compile_queries function - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Simple bug in Profiler's _compile_queries function (/showthread.php?tid=32419)



Simple bug in Profiler's _compile_queries function - El Forum - 07-22-2010

[eluser]Unknown[/eluser]
Hi guys,

I've been using CI for a few months now and love it. This is my first contribution, however small!

The bug is very easy to fix and I already submitted an issue for it on bitbucket: http://bitbucket.org/ellislab/codeigniter/issue/85/simple-bug-in-profilers-_compile_queries

Is there more I can do to get this simple fix into the next release?


Here's the details copied from the issue:

The _compile_queries function grabs all the database objects and then goes through the queries for each them, generating output. However, in the function that generates the output for each database is still using $this->CI->db->queries instead of $db->queries to output the query count.

This causes errors in the profiler when more than one database is in use.

To fix it change Profiler line 188:

Code:
$output .= '<legend style="color:<<issue 0000>>FF;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_database').':&nbsp; '.$db->database.'&nbsp;&nbsp;&nbsp;'.$this->CI->lang->line('profiler_queries').': '.count($this->CI->db->queries).'&nbsp;&nbsp;&nbsp;</legend>';


Should be changed to:

Code:
$output .= '<legend style="color:<<issue 0000>>FF;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_database').':&nbsp; '.$db->database.'&nbsp;&nbsp;&nbsp;'.$this->CI->lang->line('profiler_queries').': '.count($db->queries).'&nbsp;&nbsp;&nbsp;</legend>';