驱动改进

This commit is contained in:
thinkphp
2016-05-09 12:01:41 +08:00
parent ae908199eb
commit e7839557c6
5 changed files with 15 additions and 11 deletions

View File

@@ -11,6 +11,7 @@
namespace think\db\connector;
use PDO;
use think\db\Connection;
use think\Log;
@@ -55,7 +56,7 @@ class Mysql extends Connection
}
$sql = 'SHOW COLUMNS FROM `' . $tableName . '`';
$pdo = $this->linkID->query($sql);
$result = $pdo->fetchAll(\PDO::FETCH_ASSOC);
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
$info = [];
if ($result) {
foreach ($result as $key => $val) {
@@ -83,7 +84,7 @@ class Mysql extends Connection
{
$sql = !empty($dbName) ? 'SHOW TABLES FROM ' . $dbName : 'SHOW TABLES ';
$pdo = $this->linkID->query($sql);
$result = $pdo->fetchAll(\PDO::FETCH_ASSOC);
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
$info = [];
foreach ($result as $key => $val) {
$info[$key] = current($val);
@@ -100,7 +101,7 @@ class Mysql extends Connection
protected function getExplain($sql)
{
$pdo = $this->linkID->query("EXPLAIN " . $sql);
$result = $pdo->fetch(\PDO::FETCH_ASSOC);
$result = $pdo->fetch(PDO::FETCH_ASSOC);
$result = array_change_key_case($result);
if (isset($result['extra'])) {
if (strpos($result['extra'], 'filesort') || strpos($result['extra'], 'temporary')) {