![]() |
[Solved] Profiler only shows queries to one database - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: [Solved] Profiler only shows queries to one database (/showthread.php?tid=31715) |
[Solved] Profiler only shows queries to one database - El Forum - 06-29-2010 [eluser]sqwk[/eluser] I am trying to find an error using the profiler, however, it only seems to list queries to the default database. I know there is definitely a query to a second database, which is not being shown. How do I tell the profiler to show all queries? [Solved] Profiler only shows queries to one database - El Forum - 06-29-2010 [eluser]danmontgomery[/eluser] The profiler should catch queries for all database objects that are assigned to the CI superobject... So, assuming you are doing something like: Code: $db1 = $this->load->database('db1', TRUE); In the controller, you should be able to just do: Code: $this->db1 = $this->load->database('db1', TRUE); There's been some discussion about this (http://ellislab.com/forums/viewthread/141499/) and I haven't tried it myself, but it should work. [Solved] Profiler only shows queries to one database - El Forum - 06-29-2010 [eluser]sqwk[/eluser] In the controller? I load the db in the model like this: Code: $geo = $this->load->database('geodb', TRUE); Is this the wrong way to do this? [Solved] Profiler only shows queries to one database - El Forum - 06-29-2010 [eluser]danmontgomery[/eluser] No, it's not wrong, the queries just won't show up in the profiler unless the DB object is a member of the CI superobject [Solved] Profiler only shows queries to one database - El Forum - 06-29-2010 [eluser]sqwk[/eluser] … and in order to become a member of the superobject they need to be in the controller? Code: $this->default = $this->load->database('default', TRUE); I added the this-> in the model but it doesn't make the query show up in the profiler. [Solved] Profiler only shows queries to one database - El Forum - 06-29-2010 [eluser]sqwk[/eluser] Only just read the whole thread that you linked earlier… Loading in the model works just fine but you need to extend the CI Loader class: http://ellislab.com/forums/viewthread/141499/#706357 And the $this-> is not actually needed… [Solved] Profiler only shows queries to one database - El Forum - 10-12-2010 [eluser]slowgary[/eluser] In my application I don't need 2 connections, but I do need to replace the connection with a high privileged database user after login. If this helps anyone, here's how I've done it: Code: // config/database.php This worked for me. I hope this helps someone else on the hunt. |