add new feature

This commit is contained in:
Jianxuan Li 2015-05-01 15:16:28 +08:00
parent 9717bdbbf1
commit 013a2e0d50
1 changed files with 4 additions and 2 deletions

View File

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