public static function getInstance() { if (class_exists('mysqli', FALSE)) { return MySqlii::getInstance(); } else { if (class_exists('mysql', FALSE)) { return MySql::getInstance(); } else { emMsg('服务器空间PHP不支持MySql数据库'); } } }
public static function getInstance() { switch (Option::DEFAULT_MYSQLCONN) { case 'mysqli': return MySqlii::getInstance(); break; case 'mysql': default: return MySql::getInstance(); break; } }
/** * 获取Db实例 * @param null */ public function getDbInstance() { if (!is_null($this->_db)) { return $this->_db; } if (class_exists('mysqli')) { $this->_db = MySqlii::getInstance(); } else { $this->_db = MySql::getInstance(); } return $this->_db; }
public function __construct() { if (is_null(self::$DbHandler)) { if (class_exists('mysqli')) { self::$DbHandler = MySqlii::getInstance(); } else { self::$DbHandler = MySql::getInstance(); } } $this->tableName = DB_PREFIX . $this->tableName; $this->fields = $this->getDbFields(); foreach ($this->fields as $key => $value) { $this->SQLfields .= $this->parseKey($value) . ','; } $this->SQLfields = rtrim($this->SQLfields, ','); #查询的全字段预处理 }