diff --git a/db/sql/mapper.php b/db/sql/mapper.php index 4353fc4a..25854af2 100644 --- a/db/sql/mapper.php +++ b/db/sql/mapper.php @@ -464,7 +464,7 @@ function insert() { } if ($field['changed'] && $key!=$inc) { $fields.=($actr?',':'').$this->db->quotekey($key); - $values.=($actr?',':'').'?'; + $values.=($actr?',':'').($field['type'] === 'geometry' ? 'ST_GeomFromText(?)' : '?'); $args[$actr+1]=[$field['value'],$field['pdo_type']]; ++$actr; $ckeys[]=$key; @@ -527,7 +527,7 @@ function update() { return $this; foreach ($this->fields as $key=>$field) if ($field['changed']) { - $pairs.=($pairs?',':'').$this->db->quotekey($key).'=?'; + $pairs.=($pairs?',':'').$this->db->quotekey($key).($field['type'] === 'geometry' ? '=ST_GeomFromText(?)' : '=?'); $args[++$ctr]=[$field['value'],$field['pdo_type']]; } if ($pairs) { @@ -566,7 +566,7 @@ function updateAll($filter=NULL) { $pairs=''; foreach ($this->fields as $key=>$field) if ($field['changed']) { - $pairs.=($pairs?',':'').$this->db->quotekey($key).'=?'; + $pairs.=($pairs?',':'').$this->db->quotekey($key).($field['type'] === 'geometry' ? '=ST_GeomFromText(?)' : '=?'); $args[++$ctr]=[$field['value'],$field['pdo_type']]; } if ($filter)