Fix writing BLOBs to postgres with recent contacts interaction

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2020-08-28 14:30:33 +02:00 committed by backportbot[bot]
parent 4ef423913d
commit 7ada6e5ab0
3 changed files with 9 additions and 2 deletions

View File

@ -66,7 +66,7 @@ class RecentContact extends Entity {
$this->addType('uid', 'string'); $this->addType('uid', 'string');
$this->addType('email', 'string'); $this->addType('email', 'string');
$this->addType('federatedCloudId', 'string'); $this->addType('federatedCloudId', 'string');
$this->addType('card', 'string'); $this->addType('card', 'blob');
$this->addType('lastContact', 'int'); $this->addType('lastContact', 'int');
} }
} }

View File

@ -110,7 +110,12 @@ abstract class Entity {
// if type definition exists, cast to correct type // if type definition exists, cast to correct type
if ($args[0] !== null && array_key_exists($name, $this->_fieldTypes)) { if ($args[0] !== null && array_key_exists($name, $this->_fieldTypes)) {
settype($args[0], $this->_fieldTypes[$name]); $type = $this->_fieldTypes[$name];
if ($type === 'blob') {
// (B)LOB is treated as string when we read from the DB
$type = 'string';
}
settype($args[0], $type);
} }
$this->$name = $args[0]; $this->$name = $args[0];
} else { } else {

View File

@ -230,6 +230,8 @@ abstract class QBMapper {
case 'bool': case 'bool':
case 'boolean': case 'boolean':
return IQueryBuilder::PARAM_BOOL; return IQueryBuilder::PARAM_BOOL;
case 'blob':
return IQueryBuilder::PARAM_LOB;
} }
return IQueryBuilder::PARAM_STR; return IQueryBuilder::PARAM_STR;