Example #1
0
 /**
  * 静态方法,返回数据库连接实例
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new MySqlii();
     }
     return self::$instance;
 }
Example #2
0
 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数据库');
         }
     }
 }
Example #3
0
 public static function getInstance()
 {
     switch (Option::DEFAULT_MYSQLCONN) {
         case 'mysqli':
             return MySqlii::getInstance();
             break;
         case 'mysql':
         default:
             return MySql::getInstance();
             break;
     }
 }
Example #4
0
 /**
  * 获取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;
 }
Example #5
0
 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, ',');
     #查询的全字段预处理
 }