From d8e1d3eec7cb950186732afbebb9669409c6afe1 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 27 Jan 2016 21:56:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Driver=E7=B1=BB=E7=9A=84getBi?= =?UTF-8?q?ndSql=E6=96=B9=E6=B3=95=20=E5=BC=82=E5=B8=B8=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8Dsql=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Driver.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/think/db/Driver.php b/library/think/db/Driver.php index acc1a7c3..0f974b24 100644 --- a/library/think/db/Driver.php +++ b/library/think/db/Driver.php @@ -192,7 +192,7 @@ abstract class Driver $this->debug(false); return $this->getResult(); } catch (\PDOException $e) { - throw new Exception($e->getMessage()); + throw new Exception($this->getError()); } } @@ -241,7 +241,7 @@ abstract class Driver } return $this->numRows; } catch (\PDOException $e) { - throw new Exception($e->getMessage()); + throw new Exception($this->getError()); } } @@ -256,11 +256,11 @@ abstract class Driver { if ($bind) { foreach ($bind as $key => $val) { - $val = is_array($val) ? $val[0] : $val; + $val = $this->parseValue(is_array($val) ? $val[0] : $val); // 判断占位符 $sql = is_numeric($key) ? substr_replace($sql, $val, strpos($sql, '?'), 1) : - str_replace(':' . $key, $this->parseValue($val), $sql); + str_replace(':' . $key, $val, $sql); } } return $sql;