[eluser]PhilTem[/eluser]
As you probably got confused with the terms singleton, auto-load and others, let me try to shed some light (hope I do it all correctly):
When a person browses your domain, one specific controller is invoked and everything that it needs to load is loaded. If you load the database via
Code:
$this->load->database();
there will be one instance under
$this->db of your database
connection. You can load as many models afterwards, they will all use that one
$this->db which we created previously by loading the database.
However, if the person browsing your page opens two tabs and loads two of your pages at the same time, you basically get two database objects, but they are completely isolated from each other. Furthermore that means, there is no persistence between two page requests (neither at the same time nor one chronologically executed after another).
Though you can set the database connection to persistent it does not mean that you will always have one and the same database object. It's always a similar object but not the very same. The process of using persistent connections has nothing to do with persistent objects (which are by nature impossible to have in PHP)
To sum it up:
Once you load the database somehow ($this->load->database() or by autoload.php) you have on database object that serves all models, libraries, controllers, helpers, ... but only until the page is created and sent to the user's browser. At that time the PHP "garbage collection" runs and everything that remains from your prior script execution is deleted. It's actually that simple