CodeIgniter Forums
How to see MySQL activities on profiler from all active MySQL connections? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: How to see MySQL activities on profiler from all active MySQL connections? (/thread-32717.html)



How to see MySQL activities on profiler from all active MySQL connections? - El Forum - 08-02-2010

[eluser]MatteMatte[/eluser]
Hi Everyone,

On my CI powered website, the profiler is enabled and I can see MySQL activity from the main database set in database.php

But I can not see other MySQL activities happening on other MySQL connections opened dynamically during the code run $config and load->database($config, true) routines.

Any suggestions about how to see all MySQL activities from all MySQL connections on profiler?

Thanks.
Mat.


How to see MySQL activities on profiler from all active MySQL connections? - El Forum - 08-02-2010

[eluser]WanWizard[/eluser]
If you create a second connection and store it in a local variable, the profiler won't be able to pick it up.

Use:
Code:
$CI =& get_instance();
$CI->db2 = $this->load->database($config, TRUE);
// make it known to our controller
$this->db2 =& $CI->db2;

instead of:
Code:
$db2 = $this->load->database($config, TRUE);



How to see MySQL activities on profiler from all active MySQL connections? - El Forum - 08-06-2010

[eluser]MatteMatte[/eluser]
Great, thanks! It works like a charm!

Cheers.