mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
驱动改进
This commit is contained in:
@@ -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')) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace think\db\connector;
|
||||
|
||||
use PDO;
|
||||
use think\Db;
|
||||
use think\db\Connection;
|
||||
|
||||
@@ -104,7 +105,7 @@ class Oracle extends Connection
|
||||
list($tableName) = explode(' ', $tableName);
|
||||
$sql = "select a.column_name,data_type,DECODE (nullable, 'Y', 0, 1) notnull,data_default, DECODE (A .column_name,b.column_name,1,0) pk from all_tab_columns a,(select column_name from all_constraints c, all_cons_columns col where c.constraint_name = col.constraint_name and c.constraint_type = 'P' and c.table_name = '" . strtoupper($tableName) . "' ) b where table_name = '" . strtoupper($tableName) . "' and a.column_name = b.column_name (+)";
|
||||
$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) {
|
||||
@@ -131,7 +132,7 @@ class Oracle extends Connection
|
||||
public function getTables()
|
||||
{
|
||||
$pdo = $this->linkID->query("select table_name from all_tables");
|
||||
$result = $pdo->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
|
||||
$info = [];
|
||||
foreach ($result as $key => $val) {
|
||||
$info[$key] = current($val);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace think\db\connector;
|
||||
|
||||
use PDO;
|
||||
use think\db\Connection;
|
||||
|
||||
/**
|
||||
@@ -45,7 +46,7 @@ class Pgsql extends Connection
|
||||
list($tableName) = explode(' ', $tableName);
|
||||
$sql = 'select fields_name as "field",fields_type as "type",fields_not_null as "null",fields_key_name as "key",fields_default as "default",fields_default as "extra" from table_msg(' . $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) {
|
||||
@@ -73,7 +74,7 @@ class Pgsql extends Connection
|
||||
{
|
||||
$sql = "select tablename as Tables_in_test from pg_tables where schemaname ='public'";
|
||||
$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);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace think\db\connector;
|
||||
|
||||
use PDO;
|
||||
use think\db\Connection;
|
||||
|
||||
/**
|
||||
@@ -42,7 +43,7 @@ class Sqlite extends Connection
|
||||
list($tableName) = explode(' ', $tableName);
|
||||
$sql = 'PRAGMA table_info( ' . $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) {
|
||||
@@ -72,7 +73,7 @@ class Sqlite extends Connection
|
||||
. "UNION ALL SELECT name FROM sqlite_temp_master "
|
||||
. "WHERE type='table' ORDER BY name";
|
||||
$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);
|
||||
|
||||
@@ -59,7 +59,7 @@ class Sqlsrv extends Connection
|
||||
AND t.table_name = c.table_name
|
||||
WHERE t.table_name = '$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) {
|
||||
@@ -90,7 +90,7 @@ class Sqlsrv extends Connection
|
||||
WHERE TABLE_TYPE = 'BASE TABLE'
|
||||
";
|
||||
$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);
|
||||
|
||||
Reference in New Issue
Block a user