改进Mysql驱动的getFields方法

This commit is contained in:
thinkphp
2017-01-03 14:37:41 +08:00
parent c659275872
commit 7fa018ca0c

View File

@@ -51,10 +51,13 @@ class Mysql extends Connection
{
$this->initConnect(true);
list($tableName) = explode(' ', $tableName);
if (strpos($tableName, '.')) {
$tableName = str_replace('.', '`.`', $tableName);
if (false === strpos($tableName, '`')) {
if (strpos($tableName, '.')) {
$tableName = str_replace('.', '`.`', $tableName);
}
$tableName = '`' . $tableName . '`';
}
$sql = 'SHOW COLUMNS FROM `' . $tableName . '`';
$sql = 'SHOW COLUMNS FROM ' . $tableName;
// 调试开始
$this->debug(true);
$pdo = $this->linkID->query($sql);