mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
修正Query类的gettableinfo方法
This commit is contained in:
@@ -47,6 +47,8 @@ class Query
|
|||||||
protected $options = [];
|
protected $options = [];
|
||||||
// 参数绑定
|
// 参数绑定
|
||||||
protected $bind = [];
|
protected $bind = [];
|
||||||
|
// 数据表信息
|
||||||
|
protected $info = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 架构函数
|
* 架构函数
|
||||||
@@ -1284,7 +1286,6 @@ class Query
|
|||||||
*/
|
*/
|
||||||
public function getTableInfo($tableName = '', $fetch = '')
|
public function getTableInfo($tableName = '', $fetch = '')
|
||||||
{
|
{
|
||||||
static $_info = [];
|
|
||||||
if (!$tableName) {
|
if (!$tableName) {
|
||||||
$tableName = $this->getTable();
|
$tableName = $this->getTable();
|
||||||
}
|
}
|
||||||
@@ -1299,8 +1300,8 @@ class Query
|
|||||||
$tableName = $this->parseSqlTable($tableName);
|
$tableName = $this->parseSqlTable($tableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
$guid = md5($tableName);
|
$guid = $tableName;
|
||||||
if (!isset($_info[$guid])) {
|
if (!isset($this->info[$guid])) {
|
||||||
$info = $this->connection->getFields($tableName);
|
$info = $this->connection->getFields($tableName);
|
||||||
$fields = array_keys($info);
|
$fields = array_keys($info);
|
||||||
$bind = $type = [];
|
$bind = $type = [];
|
||||||
@@ -1324,10 +1325,9 @@ class Query
|
|||||||
} else {
|
} else {
|
||||||
$pk = null;
|
$pk = null;
|
||||||
}
|
}
|
||||||
$result = ['fields' => $fields, 'type' => $type, 'bind' => $bind, 'pk' => $pk];
|
$this->info[$guid] = ['fields' => $fields, 'type' => $type, 'bind' => $bind, 'pk' => $pk];
|
||||||
$_info[$guid] = $result;
|
|
||||||
}
|
}
|
||||||
return $fetch ? $_info[$guid][$fetch] : $_info[$guid];
|
return $fetch ? $this->info[$guid][$fetch] : $this->info[$guid];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user