]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix Oracle insert error
authorThomas Müller <thomas.mueller@tmit.eu>
Mon, 14 Dec 2015 10:48:31 +0000 (11:48 +0100)
committerBjörn Schießle <bjoern@schiessle.org>
Tue, 15 Dec 2015 13:52:27 +0000 (14:52 +0100)
apps/dav/lib/carddav/carddavbackend.php
apps/dav/tests/unit/carddav/carddavbackendtest.php

index bbd76ae37acc79007a5445dc51ddb62019317702..7f7d458d560c26ec36527778fb93ab02cccd7d0c 100644 (file)
@@ -29,6 +29,7 @@ use Sabre\CardDAV\Backend\BackendInterface;
 use Sabre\CardDAV\Backend\SyncSupport;
 use Sabre\CardDAV\Plugin;
 use Sabre\DAV\Exception\BadRequest;
+use Sabre\VObject\Component\VCard;
 use Sabre\VObject\Reader;
 
 class CardDavBackend implements BackendInterface, SyncSupport {
@@ -431,7 +432,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
                $query = $this->db->getQueryBuilder();
                $query->insert('cards')
                        ->values([
-                               'carddata' => $query->createNamedParameter($cardData),
+                               'carddata' => $query->createNamedParameter($cardData, \PDO::PARAM_LOB),
                                'uri' => $query->createNamedParameter($cardUri),
                                'lastmodified' => $query->createNamedParameter(time()),
                                'addressbookid' => $query->createNamedParameter($addressBookId),
@@ -688,7 +689,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
         */
        public function search($addressBookId, $pattern, $searchProperties) {
                $query = $this->db->getQueryBuilder();
-               $query->selectDistinct('carddata', 'c')
+               $query->selectDistinct(['carddata', 'c'])
                                ->from($this->dbCardsTable, 'c')
                                ->leftJoin('c', $this->dbCardsPropertiesTable, 'cp', $query->expr()->eq('cp.cardid', 'c.id'));
                foreach ($searchProperties as $property) {
index 0e17d8a40ba6b24335cf25aa932bac2d1eb7e1b5..8feba950b72bedcde2fc9eae0e9c5adb87958f25 100644 (file)
@@ -20,6 +20,7 @@
  */
 namespace OCA\DAV\Tests\Unit\CardDAV;
 
+use InvalidArgumentException;
 use OCA\DAV\CardDAV\CardDavBackend;
 use OCA\DAV\Connector\Sabre\Principal;
 use OCP\IDBConnection;
@@ -126,6 +127,7 @@ class CardDavBackendTest extends TestCase {
 
        public function testCardOperations() {
 
+               /** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $backend */
                $backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')
                                ->setConstructorArgs([$this->db, $this->principal, $this->logger])
                                ->setMethods(['updateProperties', 'purgeProperties'])->getMock();
@@ -392,6 +394,7 @@ class CardDavBackendTest extends TestCase {
         * @param array $expected
         */
        public function testSearch($pattern, $expected) {
+               /** @var VCard $vCards */
                $vCards = [];
                $vCards[0] = new VCard();
                $vCards[0]->add(new Text($vCards[0], 'UID', 'uid'));
@@ -407,9 +410,9 @@ class CardDavBackendTest extends TestCase {
                                        ->values(
                                                        [
                                                                        'addressbookid' => $query->createNamedParameter(0),
-                                                                       'carddata' => $query->createNamedParameter($vCards[$i]->serialize()),
+                                                                       'carddata' => $query->createNamedParameter($vCards[$i]->serialize(), \PDO::PARAM_LOB),
                                                                        'uri' => $query->createNamedParameter('uri' . $i),
-                                                                       'lastmodified' => $query->createNamedParameter(5489543),
+                                                                       'lastmodified' => $query->createNamedParameter(time()),
                                                                        'etag' => $query->createNamedParameter('etag' . $i),
                                                                        'size' => $query->createNamedParameter(120),
                                                        ]