title: Codeigniter $this->db->reconnect(); usage
body: <p>I’m <strong>not</strong> autoloading db because most pages of my application <strong>don’t</strong> need db processing otherwise whole thing will slow down. What I want to do is not to establish a new connection to db when there is one already alive and use it instead not to bother server-db. So how do I implement <code>$this-&gt;db-&gt;reconnect();</code> to my example below? I read user guide but no exact example there.</p>
  
  <p><strong>Note :</strong> If I necessary to use <code>$this-&gt;db-&gt;close();</code> and <code>$this-&gt;db-&gt;initialize();</code> then please help me implement them as well because I heard that calling <code>$this-&gt;db-&gt;reconnect();</code> with autoloading disabled will throw an error.</p>
  
  <p>I’m using CI 2.1</p>
  
  <p>Thanks</p>
  
  <pre><code>class Test_model extends CI_Model
  {
   public function __construct()
   {
    parent::__construct();
  
    $this-&gt;load-&gt;database();
   }
  
   public function function_a($id)
   {
    $this-&gt;db-&gt;protect_identifiers('year');
  
    $sql = "SELECT * FROM year WHERE id = ?";
  
    $data['dbquery'] = $this-&gt;db-&gt;query($sql, array($id));
  
    return $data['dbquery'];
   }
  
   public function function_b($id)
   {
    $this-&gt;db-&gt;protect_identifiers('month');
  
    $sql = "SELECT * FROM month WHERE id = ?";
  
    $data['dbquery'] = $this-&gt;db-&gt;query($sql, array($id));
  
    return $data['dbquery'];
   }
  
  
   public function function_c($id)...
   public function function_d($id)...
   public function function_e($id)...
  } 
  </code></pre>