Mouhong Lin
Mouhong Lin

Reputation: 4509

How CodeIgniter close db connections?

I'm wondering how CodeIgniter close db connections. In the doc, it says "CodeIgniter intelligently takes care of closing your database connections". But how does CodeIgniter do this? Seems I didn't find the db driver's close method get called in CodeIgniter 3.0.3 source code.

Upvotes: 2

Views: 3735

Answers (1)

Tpojka
Tpojka

Reputation: 7111

Follow the code. If

$this->db->close() 

is called for an action, first thing you should look is

DB.php

file with

CI_DB

class within. There you would see that there is no

close()

method and you should then make search in

DB_driver.php

file which holds

CI_DB_driver

class that is extended class by

CI_DB

class. And Eureca! method with code is there. :) Of course, all these files are in system directory.

Upvotes: 4

Related Questions