mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进数据集对象的返回 由Query类select方法返回数据集对象 Connection类getResult方法不再进行数据集对象转换
This commit is contained in:
@@ -13,7 +13,6 @@ namespace think\db;
|
||||
|
||||
use PDO;
|
||||
use PDOStatement;
|
||||
use think\Collection;
|
||||
use think\Db;
|
||||
use think\db\exception\BindParamException;
|
||||
use think\Debug;
|
||||
@@ -547,11 +546,6 @@ abstract class Connection
|
||||
}
|
||||
$result = $this->PDOStatement->fetchAll($this->fetchType);
|
||||
$this->numRows = count($result);
|
||||
|
||||
if ('collection' == $this->resultSetType) {
|
||||
// 返回数据集Collection对象
|
||||
$result = new Collection($result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2312,6 +2312,9 @@ class Query
|
||||
}
|
||||
// 模型数据集转换
|
||||
$resultSet = (new $model)->toCollection($resultSet);
|
||||
} elseif ('collection' == $this->connection->getConfig('resultset_type')) {
|
||||
// 返回Collection对象
|
||||
$resultSet = new Collection($resultSet);
|
||||
}
|
||||
// 返回结果处理
|
||||
if (!empty($options['fail']) && count($resultSet) == 0) {
|
||||
|
||||
Reference in New Issue
Block a user