From 013a2e0d507ed31d78fbdc2f88cfceab2be5b802 Mon Sep 17 00:00:00 2001 From: Jianxuan Li Date: Fri, 1 May 2015 15:16:28 +0800 Subject: [PATCH] add new feature --- Westdc/Db/Dbh.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Westdc/Db/Dbh.php b/Westdc/Db/Dbh.php index b518729..431a381 100644 --- a/Westdc/Db/Dbh.php +++ b/Westdc/Db/Dbh.php @@ -2,6 +2,7 @@ namespace Westdc\Db; use Westdc\Helpers\Assist as view; +use Westdc\Helpers\Assist; class Dbh { @@ -81,7 +82,7 @@ class Dbh foreach($data as $k=>$v) { - if(is_int($v) || is_float($v) || is_bool($v)) + if(is_int($v) || is_float($v) || is_bool($v) || $v === "NULL") { $ups[] = '"'.$k.'"='.$v; }else{ @@ -122,6 +123,7 @@ class Dbh } }else{ $sql = "UPDATE \"".$table."\" SET $fields $wheresql RETURNING id"; + //exit($sql); try{ $sth = $this->db->prepare($sql); if($sth->execute()) @@ -136,7 +138,7 @@ class Dbh { return false; }else{ - echo view::Dump('Caught exception: '. $e->getMessage(). "\n"."SQL:".$sql,false); + echo Assist::Dump('Caught exception: '. $e->getMessage(). "\n"."SQL:".$sql,false); } } }