|
@@ -109,7 +109,7 @@ abstract class Connection
|
|
|
// Query类
|
|
|
'query' => '\\think\\db\\Query',
|
|
|
// 是否需要断线重连
|
|
|
- 'break_reconnect' => false,
|
|
|
+ 'break_reconnect' => true,
|
|
|
];
|
|
|
|
|
|
// PDO连接参数
|
|
@@ -313,11 +313,21 @@ abstract class Connection
|
|
|
* 释放查询结果
|
|
|
* @access public
|
|
|
*/
|
|
|
- public function free()
|
|
|
+ public function free_old()
|
|
|
{
|
|
|
$this->PDOStatement = null;
|
|
|
}
|
|
|
|
|
|
+ public function free()
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $this->PDOStatement = null;
|
|
|
+ } catch (Exception $e) {
|
|
|
+ Log::write("has error when free PDOStatement maybe mysql gone away,skip it:" . $e->getMessage(), log::DEBUG);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取PDO对象
|
|
|
* @access public
|