From 2dcd1c2d78a6924f2d82d52286f90eba2435e2b3 Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Tue, 23 Jun 2015 14:19:30 +0200 Subject: [PATCH] DbObject: Add pg escape for checksum --- library/Director/Data/Db/DbObject.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/Director/Data/Db/DbObject.php b/library/Director/Data/Db/DbObject.php index 68c10153..5160f2b2 100644 --- a/library/Director/Data/Db/DbObject.php +++ b/library/Director/Data/Db/DbObject.php @@ -554,6 +554,14 @@ abstract class DbObject if ($this->autoincKeyName !== null) { unset($properties[$this->autoincKeyName]); } + if ($this->connection->getDbType() === 'pgsql') { + foreach ($properties as $key => $value) { + if (preg_match('/checksum$/', $key)) { + $properties[$key] = new \Zend_Db_Expr("'" . pg_escape_bytea($value) . "'"); + } + } + } + return $this->db->insert($this->table, $properties); }