]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix writing BLOBs to postgres with recent contacts interaction 22472/head
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Fri, 28 Aug 2020 12:30:33 +0000 (14:30 +0200)
committerChristoph Wurst <christoph@winzerhof-wurst.at>
Fri, 28 Aug 2020 12:30:33 +0000 (14:30 +0200)
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
apps/contactsinteraction/lib/Db/RecentContact.php
lib/public/AppFramework/Db/Entity.php
lib/public/AppFramework/Db/QBMapper.php

index 475de0934197860627cb5d4413d5e42e313e54f0..e6c379d0aa15b6fa55bc7e8883da0f3103321273 100644 (file)
@@ -66,7 +66,7 @@ class RecentContact extends Entity {
                $this->addType('uid', 'string');
                $this->addType('email', 'string');
                $this->addType('federatedCloudId', 'string');
-               $this->addType('card', 'string');
+               $this->addType('card', 'blob');
                $this->addType('lastContact', 'int');
        }
 }
index 954b8787c4c6400106c067ed8bea157610b13c17..34719c82aea7601207a6f095719594687fbbf60e 100644 (file)
@@ -110,7 +110,12 @@ abstract class Entity {
 
                        // 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 {
index 9b396965706d75b8107a40c82e0311c5cd421a9c..ebbe92e7875f7c73a4e1844645e88f21377e2af6 100644 (file)
@@ -230,6 +230,8 @@ abstract class QBMapper {
                        case 'bool':
                        case 'boolean':
                                return IQueryBuilder::PARAM_BOOL;
+                       case 'blob':
+                               return IQueryBuilder::PARAM_LOB;
                }
 
                return IQueryBuilder::PARAM_STR;