(05-24-2016, 07:40 PM)Shawn Wrote: You can create multiple instances of a library? I thought Libraries were singletons as well.
It all depends on how your class is structured. The key is that libraries are really "anything that's not a Controller or a Model". Which means they don't have to have any dependencies on anything else. In this example, using $this->load->library('x'); was simply getting the class into memory since CodeIgniter doesn't currently provide an autoloader. Once in memory, you can do
new SomeLibraryClass(); as often as you want. Which is exactly what the database driver would do here.
Now, the instance of the class that you reference with $this->somelibrary is always the same instance, but you're free to create additional instances all day long.