改进sqlsrv驱动

This commit is contained in:
thinkphp
2018-12-06 15:43:51 +08:00
parent 312e9bec62
commit dabf711a3e

View File

@@ -50,7 +50,10 @@ class Sqlsrv extends Connection
public function getFields($tableName)
{
list($tableName) = explode(' ', $tableName);
$sql = "SELECT column_name, data_type, column_default, is_nullable
$tableNames = explode('.', $tableName);
$tableName = isset($tableNames[1]) ? $tableNames[1] : $tableNames[0];
$sql = "SELECT column_name, data_type, column_default, is_nullable
FROM information_schema.tables AS t
JOIN information_schema.columns AS c
ON t.table_catalog = c.table_catalog