mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-05 14:52:47 +08:00
Connection类的debug方法改进,增加第二个参数,改进数据库驱动的获取表信息的sql记录
This commit is contained in:
@@ -58,7 +58,11 @@ class Sqlsrv extends Connection
|
||||
AND t.table_schema = c.table_schema
|
||||
AND t.table_name = c.table_name
|
||||
WHERE t.table_name = '$tableName'";
|
||||
$pdo = $this->linkID->query($sql);
|
||||
// 调试开始
|
||||
$this->debug(true);
|
||||
$pdo = $this->linkID->query($sql);
|
||||
// 调试结束
|
||||
$this->debug(false, $sql);
|
||||
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
|
||||
$info = [];
|
||||
if ($result) {
|
||||
@@ -74,8 +78,12 @@ class Sqlsrv extends Connection
|
||||
];
|
||||
}
|
||||
}
|
||||
$sql = "SELECT column_name FROM information_schema.key_column_usage WHERE table_name='$tableName'";
|
||||
$pdo = $this->linkID->query($sql);
|
||||
$sql = "SELECT column_name FROM information_schema.key_column_usage WHERE table_name='$tableName'";
|
||||
// 调试开始
|
||||
$this->debug(true);
|
||||
$pdo = $this->linkID->query($sql);
|
||||
// 调试结束
|
||||
$this->debug(false, $sql);
|
||||
$result = $pdo->fetch(PDO::FETCH_ASSOC);
|
||||
if ($result) {
|
||||
$info[$result['column_name']]['primary'] = true;
|
||||
@@ -95,7 +103,11 @@ class Sqlsrv extends Connection
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_TYPE = 'BASE TABLE'
|
||||
";
|
||||
$pdo = $this->linkID->query($sql);
|
||||
// 调试开始
|
||||
$this->debug(true);
|
||||
$pdo = $this->linkID->query($sql);
|
||||
// 调试结束
|
||||
$this->debug(false, $sql);
|
||||
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
|
||||
$info = [];
|
||||
foreach ($result as $key => $val) {
|
||||
|
||||
Reference in New Issue
Block a user