mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
修正数据库驱动类
This commit is contained in:
@@ -29,13 +29,13 @@ class Mysql extends Driver{
|
|||||||
$info = [];
|
$info = [];
|
||||||
if($result) {
|
if($result) {
|
||||||
foreach ($result as $key => $val) {
|
foreach ($result as $key => $val) {
|
||||||
$info[$val['Field']] = array(
|
$info[$val['field']] = array(
|
||||||
'name' => $val['Field'],
|
'name' => $val['field'],
|
||||||
'type' => $val['Type'],
|
'type' => $val['type'],
|
||||||
'notnull' => (bool) ($val['Null'] === ''), // not null is empty, null is yes
|
'notnull' => (bool) ($val['null'] === ''), // not null is empty, null is yes
|
||||||
'default' => $val['Default'],
|
'default' => $val['default'],
|
||||||
'primary' => (strtolower($val['Key']) == 'pri'),
|
'primary' => (strtolower($val['key']) == 'pri'),
|
||||||
'autoinc' => (strtolower($val['Extra']) == 'auto_increment'),
|
'autoinc' => (strtolower($val['extra']) == 'auto_increment'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ class Model {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 分析表达式
|
// 分析表达式
|
||||||
$options = $this->_parseOptions();
|
$options = $this->_parseOptions();dump($this->fields);
|
||||||
// 数据处理
|
// 数据处理
|
||||||
$data = $this->_facade($data);
|
$data = $this->_facade($data);
|
||||||
if(false === $this->_before_insert($data,$options)) {
|
if(false === $this->_before_insert($data,$options)) {
|
||||||
@@ -927,9 +927,9 @@ class Model {
|
|||||||
*/
|
*/
|
||||||
public function getDbFields(){
|
public function getDbFields(){
|
||||||
if($this->fields) {
|
if($this->fields) {
|
||||||
$fields = $this->fields;
|
$fields = $this->fields;
|
||||||
unset($fields['_pk'],$fields['_type']);
|
unset($fields['_pk'],$fields['_type']);
|
||||||
return array_keys($fields);
|
return $fields;
|
||||||
}else{
|
}else{
|
||||||
$fields = Cache::get(md5($this->getTableName()));
|
$fields = Cache::get(md5($this->getTableName()));
|
||||||
if(!$fields) {
|
if(!$fields) {
|
||||||
@@ -946,9 +946,9 @@ class Model {
|
|||||||
Cache::set(md5($this->trueTableName),$fields);
|
Cache::set(md5($this->trueTableName),$fields);
|
||||||
}
|
}
|
||||||
if($fields) {
|
if($fields) {
|
||||||
$this->fields = $fields;
|
$this->fields = array_keys($fields);
|
||||||
// 永久缓存
|
$this->fields['_pk'] = $fields['_pk'];
|
||||||
unset($fields['_pk'],$fields['_type']);
|
$this->fields['_type'] = $fields['_type'];
|
||||||
return array_keys($fields);
|
return array_keys($fields);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ Config::load(THINK_PATH.'convention.php');
|
|||||||
Log::init(['type'=>Config::get('log_type'),'log_path'=> Config::get('log_path')]);
|
Log::init(['type'=>Config::get('log_type'),'log_path'=> Config::get('log_path')]);
|
||||||
|
|
||||||
// 缓存初始化
|
// 缓存初始化
|
||||||
//Cache::connect(['type'=>Config::get('cache_type'),'temp'=> CACHE_PATH]);
|
Cache::connect(['type'=>'File','temp'=> CACHE_PATH]);
|
||||||
|
|
||||||
// 注册行为扩展
|
// 注册行为扩展
|
||||||
//Tag::add('content_filter','ContentReplace','Think');
|
//Tag::add('content_filter','ContentReplace','Think');
|
||||||
|
|||||||
Reference in New Issue
Block a user