From ae35bb87ebcf08007a6086f136b98cba2448d34f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Apr 2013 18:56:13 +0400 Subject: support mysqli when available --- classes/db.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'classes/db.php') diff --git a/classes/db.php b/classes/db.php index 6dc31a22e..c9d9ad5ea 100644 --- a/classes/db.php +++ b/classes/db.php @@ -7,7 +7,11 @@ class Db implements IDb { private function __construct() { switch (DB_TYPE) { case "mysql": - $this->adapter = new Db_Mysql(); + if (function_exists("mysqli_connect")) { + $this->adapter = new Db_Mysqli(); + } else { + $this->adapter = new Db_Mysql(); + } break; case "pgsql": $this->adapter = new Db_Pgsql(); @@ -16,7 +20,7 @@ class Db implements IDb { die("Unknown DB_TYPE: " . DB_TYPE); } - $this->link = $this->adapter->connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT); + $this->link = $this->adapter->connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, defined('DB_PORT') ? DB_PORT : false); } private function __clone() { -- cgit v1.2.3-54-g00ecf