Welcome Guest, Not a member yet? Register   Sign In
Loading databas instance on method request
#1

[eluser]Swedie[/eluser]
Hey,

I have a large system that loads a total of 4 databases, and I put them all inside as an ojbect inside my main class: $this->DB1 = $this->load->database(), $this->DB2 = $this->load->database() and so on.

This allows me to connect to any of my databases quick and easy. But currently my system is getting a major performance hit because of loading all of the databases the way I do.

Can I somehow tell CI's dataabase class to not connect to the database until a method (query) is being called for?

This would speed up the performance of my system by a lot.
#2

[eluser]Swedie[/eluser]
Hey, found a setting not in the user guide.

If you add $config['autoinit'] = FALSE; the DB object won't initiate the db connection.

So ignore, close or delete thread :-P




Theme © iAndrew 2016 - Forum software by © MyBB