内核更新

This commit is contained in:
2016-08-16 16:14:36 +08:00
parent ebde0fc13e
commit 81a25be484
25 changed files with 340 additions and 129 deletions

View File

@@ -54,8 +54,12 @@ class Mysql extends Connection
if (strpos($tableName, '.')) {
$tableName = str_replace('.', '`.`', $tableName);
}
$sql = 'SHOW COLUMNS FROM `' . $tableName . '`';
$pdo = $this->linkID->query($sql);
$sql = 'SHOW COLUMNS FROM `' . $tableName . '`';
// 调试开始
$this->debug(true);
$pdo = $this->linkID->query($sql);
// 调试结束
$this->debug(false, $sql);
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
$info = [];
if ($result) {
@@ -82,8 +86,12 @@ class Mysql extends Connection
*/
public function getTables($dbName = '')
{
$sql = !empty($dbName) ? 'SHOW TABLES FROM ' . $dbName : 'SHOW TABLES ';
$pdo = $this->linkID->query($sql);
$sql = !empty($dbName) ? 'SHOW TABLES FROM ' . $dbName : 'SHOW TABLES ';
// 调试开始
$this->debug(true);
$pdo = $this->linkID->query($sql);
// 调试结束
$this->debug(false, $sql);
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
$info = [];
foreach ($result as $key => $val) {
@@ -110,8 +118,9 @@ class Mysql extends Connection
}
return $result;
}
protected function supportSavepoint(){
protected function supportSavepoint()
{
return true;
}
}

View File

@@ -46,9 +46,13 @@ class Pgsql extends Connection
$this->initConnect(true);
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);
$info = [];
// 调试开始
$this->debug(true);
$pdo = $this->linkID->query($sql);
// 调试结束
$this->debug(false, $sql);
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
$info = [];
if ($result) {
foreach ($result as $key => $val) {
$val = array_change_key_case($val);
@@ -73,8 +77,12 @@ class Pgsql extends Connection
*/
public function getTables($dbName = '')
{
$sql = "select tablename as Tables_in_test from pg_tables where schemaname ='public'";
$pdo = $this->linkID->query($sql);
$sql = "select tablename as Tables_in_test from pg_tables where schemaname ='public'";
// 调试开始
$this->debug(true);
$pdo = $this->linkID->query($sql);
// 调试结束
$this->debug(false, $sql);
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
$info = [];
foreach ($result as $key => $val) {
@@ -94,7 +102,8 @@ class Pgsql extends Connection
return [];
}
protected function supportSavepoint(){
protected function supportSavepoint()
{
return true;
}
}

View File

@@ -43,9 +43,13 @@ class Sqlite extends Connection
$this->initConnect(true);
list($tableName) = explode(' ', $tableName);
$sql = 'PRAGMA table_info( ' . $tableName . ' )';
$pdo = $this->linkID->query($sql);
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
$info = [];
// 调试开始
$this->debug(true);
$pdo = $this->linkID->query($sql);
// 调试结束
$this->debug(false, $sql);
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
$info = [];
if ($result) {
foreach ($result as $key => $val) {
$val = array_change_key_case($val);
@@ -73,7 +77,11 @@ class Sqlite extends Connection
$sql = "SELECT name FROM sqlite_master WHERE type='table' "
. "UNION ALL SELECT name FROM sqlite_temp_master "
. "WHERE type='table' ORDER BY name";
$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) {
@@ -93,7 +101,8 @@ class Sqlite extends Connection
return [];
}
protected function supportSavepoint(){
protected function supportSavepoint()
{
return true;
}
}

View File

@@ -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) {