From: Nicolas Boisselier Date: Thu, 27 Oct 2016 13:16:52 +0000 (+0100) Subject: field.quote for boolean, function string X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=630c7dcd684f61e4fc31a12649dbd8dd601f0f59;p=nb.git field.quote for boolean, function string --- diff --git a/lib/php/db/field.php b/lib/php/db/field.php index 19ea29db..965c9ffd 100644 --- a/lib/php/db/field.php +++ b/lib/php/db/field.php @@ -168,6 +168,10 @@ class field extends nb { if ($value === null) return 'NULL'; if ($force_quote or $this->string()) { + if ($value === '') { + if (strpos($this->type,'time') !== false) return 'NULL'; + if (strpos($this->type,'date') !== false) return 'NULL'; + } if (!($db = $this->db())) return "'".preg_replace("/'/","\\'",$value)."'"; return $db->quote($value);