[Solved] Profiler only shows queries to one database |
[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?
[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.
[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?
[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
[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.
[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…
[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. |
Welcome Guest, Not a member yet? Register Sign In |