From 5a612058ef9fc3001bb8c94506b22fc68453f188 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 11 Aug 2016 14:00:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BConnection=E7=B1=BBconnect?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= =?UTF-8?q?=20=E6=94=B9=E8=BF=9BQuery=E7=B1=BB=E4=B8=80=E5=A4=84=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Connection.php | 2 +- library/think/db/Query.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index 784f858a..40263e49 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -286,7 +286,7 @@ abstract class Connection Log::record($e->getMessage(), 'error'); return $this->connect($autoConnection, $linkNum); } else { - throw new Exception($e->getMessage()); + throw $e; } } } diff --git a/library/think/db/Query.php b/library/think/db/Query.php index 5ddd89c0..dcf735b9 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -747,7 +747,7 @@ class Query } if (isset($this->options['field'])) { - $field = array_merge($this->options['field'], $field); + $field = $this->options['field'] + $field; } $this->options['field'] = $field; return $this; @@ -1415,8 +1415,10 @@ class Query { $types = $this->getFieldsType($options); $bind = []; - foreach ($types as $key => $type) { - $bind[$key] = $this->getFieldBindType($type); + if ($types) { + foreach ($types as $key => $type) { + $bind[$key] = $this->getFieldBindType($type); + } } return $bind; }