修复多次连接数据库导致事务执行失败的问题
This commit is contained in:
parent
8da633a984
commit
10ec74c2f7
|
@ -121,7 +121,7 @@ class Database
|
||||||
*/
|
*/
|
||||||
public static function table($table, $pk = '', $prefix = '')
|
public static function table($table, $pk = '', $prefix = '')
|
||||||
{
|
{
|
||||||
$ident = md5($prefix . $table);
|
$ident = $prefix . $table;
|
||||||
if (!isset(self::$instance[$ident])) {
|
if (!isset(self::$instance[$ident])) {
|
||||||
self::$instance[$ident] = new self($table, $pk, $prefix);
|
self::$instance[$ident] = new self($table, $pk, $prefix);
|
||||||
}
|
}
|
||||||
|
@ -136,8 +136,11 @@ class Database
|
||||||
*/
|
*/
|
||||||
private function setDriver(DatabaseIfs $driver, $config)
|
private function setDriver(DatabaseIfs $driver, $config)
|
||||||
{
|
{
|
||||||
|
if (!self::$driver) {
|
||||||
self::$driver = $driver->connect($config);
|
self::$driver = $driver->connect($config);
|
||||||
}
|
}
|
||||||
|
return self::$driver;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取表名
|
* 获取表名
|
||||||
|
|
Loading…
Reference in New Issue