From 5b061cd99826a50305cb89a921c3b9f51898f883 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 23 Jun 2016 12:07:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E6=94=B9=E4=B8=BA=E9=BB=98=E8=AE=A4=20?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=86=99=20Connection=E7=B1=BBfieldCase?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=94=B9=E4=B8=BApublic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 4 ++-- library/think/db/Connection.php | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index ddeeb95e..450675dc 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -257,11 +257,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess list($type, $param) = explode(':', $type, 2); } switch ($type) { - case 'timestamp': + case 'datetime': $format = !empty($param) ? $param : $this->dateFormat; $value = date($format, $_SERVER['REQUEST_TIME']); break; - case 'datetime': + case 'timestamp': $value = $_SERVER['REQUEST_TIME']; break; } diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index 73669031..bfdafe6c 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -16,11 +16,11 @@ use PDOStatement; use think\App; use think\Collection; use think\Db; +use think\db\exception\BindParamException; use think\db\Query; use think\Debug; use think\Exception; use think\exception\PDOException; -use think\db\exception\BindParamException; use think\Log; abstract class Connection @@ -102,7 +102,7 @@ abstract class Connection // PDO连接参数 protected $params = [ - PDO::ATTR_CASE => PDO::CASE_LOWER, + PDO::ATTR_CASE => PDO::CASE_NATURAL, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, PDO::ATTR_STRINGIFY_FETCHES => false, @@ -188,7 +188,7 @@ abstract class Connection * @param array $info 字段信息 * @return array */ - protected function fieldCase($info) + public function fieldCase($info) { // 字段大小写转换 switch ($this->attrCase) { @@ -330,7 +330,7 @@ abstract class Connection } // 根据参数绑定组装最终的SQL语句 $this->queryStr = $this->getRealSql($sql, $bind); - + //释放前次的查询结果 if (!empty($this->PDOStatement)) { $this->free(); @@ -482,7 +482,7 @@ abstract class Connection if (!empty($class)) { // 返回指定数据集对象类 $result = new $class($result); - } elseif ('collection' == $this->resultSetType){ + } elseif ('collection' == $this->resultSetType) { // 返回数据集Collection对象 $result = new Collection($result); } @@ -551,7 +551,7 @@ abstract class Connection ++$this->transTimes; - if ($this->transTimes == 1) { + if (1 == $this->transTimes) { $this->linkID->beginTransaction(); } elseif ($this->transTimes > 1 && $this->supportSavepoint()) { $this->linkID->exec( @@ -570,7 +570,7 @@ abstract class Connection { $this->initConnect(true); - if ($this->transTimes == 1) { + if (1 == $this->transTimes) { $this->linkID->commit(); } @@ -587,7 +587,7 @@ abstract class Connection { $this->initConnect(true); - if ($this->transTimes == 1) { + if (1 == $this->transTimes) { $this->linkID->rollBack(); } elseif ($this->transTimes > 1 && $this->supportSavepoint()) { $this->linkID->exec(