From c9155c016dab28c891ea62f1504e0c7c6c48c13d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 14 Jun 2016 14:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9B=86=E7=B1=BB=E5=9E=8B=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=94=B9=E4=B8=BA=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Db.php | 6 ------ library/think/db/Connection.php | 8 +++----- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/library/think/Db.php b/library/think/Db.php index a75764b7..06ba04c7 100644 --- a/library/think/Db.php +++ b/library/think/Db.php @@ -39,12 +39,6 @@ use think\db\Query; */ class Db { - // 数组数据集 - const RESULTSET_ARRAY = 1; - // 对象数据集 - const RESULTSET_COLLECTION = 2; - // 自定义对象数据集 - const RESULTSET_CLASS = 3; // 数据库连接实例 private static $instance = []; // 查询次数 diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index ab18a719..f927acd0 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -50,7 +50,7 @@ abstract class Connection protected $linkWrite; // 查询结果类型 - protected $resultSetType = Db::RESULTSET_ARRAY; + protected $resultSetType = 'array'; // 查询结果类型 protected $fetchType = PDO::FETCH_ASSOC; // 字段属性大小写 @@ -485,13 +485,11 @@ abstract class Connection return new $class($result); } switch ($this->resultSetType) { - case Db::RESULTSET_COLLECTION: + case 'collection': // 返回数据集Collection对象 $result = new Collection($result); break; - case Db::RESULTSET_CLASS: - break; - case Db::RESULTSET_ARRAY: + case 'array': default: // 返回二维数组 }