Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix writing BLOBs to postgres with recent contacts interaction
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Aug 28, 2020
commit 3bc54bfd062d9396f438a295ebc1dd16cbed0e5e
2 changes: 1 addition & 1 deletion apps/contactsinteraction/lib/Db/RecentContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function __construct() {
$this->addType('uid', 'string');
$this->addType('email', 'string');
$this->addType('federatedCloudId', 'string');
$this->addType('card', 'string');
$this->addType('card', 'blob');
$this->addType('lastContact', 'int');
}
}
7 changes: 6 additions & 1 deletion lib/public/AppFramework/Db/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ protected function setter($name, $args) {

// if type definition exists, cast to correct type
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];
} else {
Expand Down
2 changes: 2 additions & 0 deletions lib/public/AppFramework/Db/QBMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ protected function getParameterTypeForProperty(Entity $entity, string $property)
case 'bool':
case 'boolean':
return IQueryBuilder::PARAM_BOOL;
case 'blob':
return IQueryBuilder::PARAM_LOB;
}

return IQueryBuilder::PARAM_STR;
Expand Down