Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix writing BLOBs to postgres with recent contacts interaction #22472

Merged
merged 1 commit into from
Aug 31, 2020
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
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';
}
ChristophWurst marked this conversation as resolved.
Show resolved Hide resolved
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