CodeIgniter Forums

Full Version: How to check database driver name
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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

El Forum

[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';

El Forum

[eluser]Unknown[/eluser]
Thank You -

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

Bensiu