diff --git a/src/Common/Classes/Mysqli.php b/src/Common/Classes/Mysqli.php index 9d40e14..59743af 100644 --- a/src/Common/Classes/Mysqli.php +++ b/src/Common/Classes/Mysqli.php @@ -126,7 +126,11 @@ public function insertAll($tableName, $data = []) */ public function fetch(QueryBuilder $Builder, string $modelName = '') { - $this->config->setFetchMode(true); + // 如果之前非fetch模式,使用新配置重新创建链接 + if ( ! $this->config->isFetchMode()) { + $this->config->setFetchMode(true); + $this->close(); + } $this->connect(); /** @var Cursor $Cursor */