/** * 架构函数 * @access public * @param mixed $data 要创建的数据对象内容 */ public function __construct() { //初始化 parent::__construct(App::config('db_host'), App::config('db_user'), App::config('db_password'), App::config('db_database'), App::config('db_charset'), App::config('db_pconnect')); //完整表名、表主键、表前缀 $tablePrefix = $this->tablePrefix !== null ? $this->tablePrefix : App::config('db_table_prefix'); $this->trueTableName = $tablePrefix . $this->tableName; $this->primaryKeys[$this->trueTableName] = $this->primaryKey; /** * 转化手工指定的表字段为:DESCRIBE tableName 查询出来的格式 * 最佳的方法是缓存 DESCRIBE tableName 查询出来的数据 * 这里暂且不使用缓存的方式 */ if (is_array($this->fields) && !empty($this->fields)) { foreach ((array) $this->fields as $field) { $fields[$field] = array(); } $this->tableFields[$this->trueTableName] = $fields; } }
public function __construct() { return parent::__construct(App::config('db_host'), App::config('db_user'), App::config('db_password'), App::config('db_database'), App::config('db_charset'), App::config('db_pconnect')); }