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; }