mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
改进数据库驱动
This commit is contained in:
@@ -51,7 +51,7 @@ class Mysql extends Connection
|
|||||||
*/
|
*/
|
||||||
public function getFields($tableName)
|
public function getFields($tableName)
|
||||||
{
|
{
|
||||||
$this->initConnect(true);
|
$this->initConnect(false);
|
||||||
list($tableName) = explode(' ', $tableName);
|
list($tableName) = explode(' ', $tableName);
|
||||||
if (false === strpos($tableName, '`')) {
|
if (false === strpos($tableName, '`')) {
|
||||||
if (strpos($tableName, '.')) {
|
if (strpos($tableName, '.')) {
|
||||||
@@ -91,7 +91,7 @@ class Mysql extends Connection
|
|||||||
*/
|
*/
|
||||||
public function getTables($dbName = '')
|
public function getTables($dbName = '')
|
||||||
{
|
{
|
||||||
$this->initConnect(true);
|
$this->initConnect(false);
|
||||||
$sql = !empty($dbName) ? 'SHOW TABLES FROM ' . $dbName : 'SHOW TABLES ';
|
$sql = !empty($dbName) ? 'SHOW TABLES FROM ' . $dbName : 'SHOW TABLES ';
|
||||||
// 调试开始
|
// 调试开始
|
||||||
$this->debug(true);
|
$this->debug(true);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class Pgsql extends Connection
|
|||||||
*/
|
*/
|
||||||
public function getFields($tableName)
|
public function getFields($tableName)
|
||||||
{
|
{
|
||||||
$this->initConnect(true);
|
$this->initConnect(false);
|
||||||
list($tableName) = explode(' ', $tableName);
|
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 . '\');';
|
$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 . '\');';
|
||||||
// 调试开始
|
// 调试开始
|
||||||
@@ -78,7 +78,7 @@ class Pgsql extends Connection
|
|||||||
*/
|
*/
|
||||||
public function getTables($dbName = '')
|
public function getTables($dbName = '')
|
||||||
{
|
{
|
||||||
$this->initConnect(true);
|
$this->initConnect(false);
|
||||||
$sql = "select tablename as Tables_in_test from pg_tables where schemaname ='public'";
|
$sql = "select tablename as Tables_in_test from pg_tables where schemaname ='public'";
|
||||||
// 调试开始
|
// 调试开始
|
||||||
$this->debug(true);
|
$this->debug(true);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class Sqlite extends Connection
|
|||||||
*/
|
*/
|
||||||
public function getFields($tableName)
|
public function getFields($tableName)
|
||||||
{
|
{
|
||||||
$this->initConnect(true);
|
$this->initConnect(false);
|
||||||
list($tableName) = explode(' ', $tableName);
|
list($tableName) = explode(' ', $tableName);
|
||||||
$sql = 'PRAGMA table_info( ' . $tableName . ' )';
|
$sql = 'PRAGMA table_info( ' . $tableName . ' )';
|
||||||
// 调试开始
|
// 调试开始
|
||||||
@@ -76,7 +76,7 @@ class Sqlite extends Connection
|
|||||||
*/
|
*/
|
||||||
public function getTables($dbName = '')
|
public function getTables($dbName = '')
|
||||||
{
|
{
|
||||||
$this->initConnect(true);
|
$this->initConnect(false);
|
||||||
$sql = "SELECT name FROM sqlite_master WHERE type='table' "
|
$sql = "SELECT name FROM sqlite_master WHERE type='table' "
|
||||||
. "UNION ALL SELECT name FROM sqlite_temp_master "
|
. "UNION ALL SELECT name FROM sqlite_temp_master "
|
||||||
. "WHERE type='table' ORDER BY name";
|
. "WHERE type='table' ORDER BY name";
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class Sqlsrv extends Connection
|
|||||||
*/
|
*/
|
||||||
public function getFields($tableName)
|
public function getFields($tableName)
|
||||||
{
|
{
|
||||||
$this->initConnect(true);
|
$this->initConnect(false);
|
||||||
list($tableName) = explode(' ', $tableName);
|
list($tableName) = explode(' ', $tableName);
|
||||||
$sql = "SELECT column_name, data_type, column_default, is_nullable
|
$sql = "SELECT column_name, data_type, column_default, is_nullable
|
||||||
FROM information_schema.tables AS t
|
FROM information_schema.tables AS t
|
||||||
@@ -99,7 +99,7 @@ class Sqlsrv extends Connection
|
|||||||
*/
|
*/
|
||||||
public function getTables($dbName = '')
|
public function getTables($dbName = '')
|
||||||
{
|
{
|
||||||
$this->initConnect(true);
|
$this->initConnect(false);
|
||||||
$sql = "SELECT TABLE_NAME
|
$sql = "SELECT TABLE_NAME
|
||||||
FROM INFORMATION_SCHEMA.TABLES
|
FROM INFORMATION_SCHEMA.TABLES
|
||||||
WHERE TABLE_TYPE = 'BASE TABLE'
|
WHERE TABLE_TYPE = 'BASE TABLE'
|
||||||
|
|||||||
Reference in New Issue
Block a user