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