From f321e45b4e5fb617022e8ddd71e5c44e1b0ae1bb Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Thu, 27 Oct 2016 12:23:40 +0100 Subject: [PATCH] field.quote for boolean, function string --- lib/php/db/field.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/php/db/field.php b/lib/php/db/field.php index 35cc575c..19ea29db 100644 --- a/lib/php/db/field.php +++ b/lib/php/db/field.php @@ -44,6 +44,12 @@ class field extends nb { return $this->autoincrement; } + public function string() { + if ($this->numeric()) return false; + if (strpos($this->type,'bool') !== false) return false; + return true; + } + public function numeric() { return preg_match('/signed|(snall )?int|float|decimal|numeric|number|currency/i',$this->type) ? true : false; } @@ -161,7 +167,7 @@ class field extends nb { public function quote($value,$force_quote=false) { if ($value === null) return 'NULL'; - if ($force_quote or !$this->numeric()) { + if ($force_quote or $this->string()) { if (!($db = $this->db())) return "'".preg_replace("/'/","\\'",$value)."'"; return $db->quote($value); -- 2.47.3