CodeIgniter Forums
How to check database driver name - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: How to check database driver name (/thread-33197.html)



How to check database driver name - El Forum - 08-18-2010

[eluser]Unknown[/eluser]
I am writing a library and I would like to know which database project is using
there is a small difference if it is MySQL or PostgreSQL...

Is it a field or method what will return database driver name like

$this->db->driver_name ()
what will return 'mysql' or 'postgre' according to what $this->db is driving on ?

Bensiu


How to check database driver name - El Forum - 08-18-2010

[eluser]mddd[/eluser]
I think $this->db->dbdriver contains the name.

Code:
// this is the start of the mysql driver file; it extends CI_DB that ends up in $this->db.

class CI_DB_mysql_driver extends CI_DB {

    var $dbdriver = 'mysql';



How to check database driver name - El Forum - 08-18-2010

[eluser]Unknown[/eluser]
Thank You -

"Sometimes thing to close to you nose become invisible" Smile

Bensiu