mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
数据库查询的数据集类型设置改为字符串
This commit is contained in:
@@ -39,12 +39,6 @@ use think\db\Query;
|
|||||||
*/
|
*/
|
||||||
class Db
|
class Db
|
||||||
{
|
{
|
||||||
// 数组数据集
|
|
||||||
const RESULTSET_ARRAY = 1;
|
|
||||||
// 对象数据集
|
|
||||||
const RESULTSET_COLLECTION = 2;
|
|
||||||
// 自定义对象数据集
|
|
||||||
const RESULTSET_CLASS = 3;
|
|
||||||
// 数据库连接实例
|
// 数据库连接实例
|
||||||
private static $instance = [];
|
private static $instance = [];
|
||||||
// 查询次数
|
// 查询次数
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ abstract class Connection
|
|||||||
protected $linkWrite;
|
protected $linkWrite;
|
||||||
|
|
||||||
// 查询结果类型
|
// 查询结果类型
|
||||||
protected $resultSetType = Db::RESULTSET_ARRAY;
|
protected $resultSetType = 'array';
|
||||||
// 查询结果类型
|
// 查询结果类型
|
||||||
protected $fetchType = PDO::FETCH_ASSOC;
|
protected $fetchType = PDO::FETCH_ASSOC;
|
||||||
// 字段属性大小写
|
// 字段属性大小写
|
||||||
@@ -485,13 +485,11 @@ abstract class Connection
|
|||||||
return new $class($result);
|
return new $class($result);
|
||||||
}
|
}
|
||||||
switch ($this->resultSetType) {
|
switch ($this->resultSetType) {
|
||||||
case Db::RESULTSET_COLLECTION:
|
case 'collection':
|
||||||
// 返回数据集Collection对象
|
// 返回数据集Collection对象
|
||||||
$result = new Collection($result);
|
$result = new Collection($result);
|
||||||
break;
|
break;
|
||||||
case Db::RESULTSET_CLASS:
|
case 'array':
|
||||||
break;
|
|
||||||
case Db::RESULTSET_ARRAY:
|
|
||||||
default:
|
default:
|
||||||
// 返回二维数组
|
// 返回二维数组
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user