class Db implements IDb {
private static $instance;
private $adapter;
+ private $link;
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();
die("Unknown DB_TYPE: " . DB_TYPE);
}
- $this->adapter->connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT);
- $this->adapter->init();
+ $this->link = $this->adapter->connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, defined('DB_PORT') ? DB_PORT : false);
}
private function __clone() {
return("'$str'");
}
- function init() {
- //
- }
-
function connect($host, $user, $pass, $db, $port) {
//return $this->adapter->connect($host, $user, $pass, $db, $port);
+ return ;
}
function escape_string($s, $strip_tags = true) {