diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/caldav/caldavbackend.php | 4 | ||||
-rw-r--r-- | apps/dav/lib/carddav/carddavbackend.php | 4 | ||||
-rw-r--r-- | apps/dav/tests/unit/carddav/carddavbackendtest.php | 7 | ||||
-rw-r--r-- | apps/files_external/service/dbconfigservice.php | 58 |
4 files changed, 37 insertions, 36 deletions
diff --git a/apps/dav/lib/caldav/caldavbackend.php b/apps/dav/lib/caldav/caldavbackend.php index 7f6810fb1e2..70dbccb8745 100644 --- a/apps/dav/lib/caldav/caldavbackend.php +++ b/apps/dav/lib/caldav/caldavbackend.php @@ -607,7 +607,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->values([ 'calendarid' => $query->createNamedParameter($calendarId), 'uri' => $query->createNamedParameter($objectUri), - 'calendardata' => $query->createNamedParameter($calendarData, \PDO::PARAM_LOB), + 'calendardata' => $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB), 'lastmodified' => $query->createNamedParameter(time()), 'etag' => $query->createNamedParameter($extraData['etag']), 'size' => $query->createNamedParameter($extraData['size']), @@ -646,7 +646,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $query = $this->db->getQueryBuilder(); $query->update('calendarobjects') - ->set('calendardata', $query->createNamedParameter($calendarData, \PDO::PARAM_LOB)) + ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) ->set('lastmodified', $query->createNamedParameter(time())) ->set('etag', $query->createNamedParameter($extraData['etag'])) ->set('size', $query->createNamedParameter($extraData['size'])) diff --git a/apps/dav/lib/carddav/carddavbackend.php b/apps/dav/lib/carddav/carddavbackend.php index 61bdec52479..a109e8bde4a 100644 --- a/apps/dav/lib/carddav/carddavbackend.php +++ b/apps/dav/lib/carddav/carddavbackend.php @@ -489,7 +489,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $query = $this->db->getQueryBuilder(); $query->insert('cards') ->values([ - 'carddata' => $query->createNamedParameter($cardData, \PDO::PARAM_LOB), + 'carddata' => $query->createNamedParameter($cardData, IQueryBuilder::PARAM_LOB), 'uri' => $query->createNamedParameter($cardUri), 'lastmodified' => $query->createNamedParameter(time()), 'addressbookid' => $query->createNamedParameter($addressBookId), @@ -542,7 +542,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $etag = md5($cardData); $query = $this->db->getQueryBuilder(); $query->update('cards') - ->set('carddata', $query->createNamedParameter($cardData, \PDO::PARAM_LOB)) + ->set('carddata', $query->createNamedParameter($cardData, IQueryBuilder::PARAM_LOB)) ->set('lastmodified', $query->createNamedParameter(time())) ->set('size', $query->createNamedParameter(strlen($cardData))) ->set('etag', $query->createNamedParameter($etag)) diff --git a/apps/dav/tests/unit/carddav/carddavbackendtest.php b/apps/dav/tests/unit/carddav/carddavbackendtest.php index 401041d6e39..2f96fc5da90 100644 --- a/apps/dav/tests/unit/carddav/carddavbackendtest.php +++ b/apps/dav/tests/unit/carddav/carddavbackendtest.php @@ -26,6 +26,7 @@ use InvalidArgumentException; use OCA\DAV\CardDAV\AddressBook; use OCA\DAV\CardDAV\CardDavBackend; use OCA\DAV\Connector\Sabre\Principal; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use Sabre\DAV\PropPatch; use Sabre\VObject\Component\VCard; @@ -480,7 +481,7 @@ class CardDavBackendTest extends TestCase { ->values( [ 'addressbookid' => $query->createNamedParameter(0), - 'carddata' => $query->createNamedParameter($vCards[$i]->serialize(), \PDO::PARAM_LOB), + 'carddata' => $query->createNamedParameter($vCards[$i]->serialize(), IQueryBuilder::PARAM_LOB), 'uri' => $query->createNamedParameter('uri' . $i), 'lastmodified' => $query->createNamedParameter(time()), 'etag' => $query->createNamedParameter('etag' . $i), @@ -558,7 +559,7 @@ class CardDavBackendTest extends TestCase { ->values( [ 'addressbookid' => $query->createNamedParameter(1), - 'carddata' => $query->createNamedParameter('carddata', \PDO::PARAM_LOB), + 'carddata' => $query->createNamedParameter('carddata', IQueryBuilder::PARAM_LOB), 'uri' => $query->createNamedParameter('uri'), 'lastmodified' => $query->createNamedParameter(5489543), 'etag' => $query->createNamedParameter('etag'), @@ -586,7 +587,7 @@ class CardDavBackendTest extends TestCase { ->values( [ 'addressbookid' => $query->createNamedParameter($i), - 'carddata' => $query->createNamedParameter('carddata' . $i, \PDO::PARAM_LOB), + 'carddata' => $query->createNamedParameter('carddata' . $i, IQueryBuilder::PARAM_LOB), 'uri' => $query->createNamedParameter('uri' . $i), 'lastmodified' => $query->createNamedParameter(5489543), 'etag' => $query->createNamedParameter('etag' . $i), diff --git a/apps/files_external/service/dbconfigservice.php b/apps/files_external/service/dbconfigservice.php index 07f9942e05c..16d5de2665f 100644 --- a/apps/files_external/service/dbconfigservice.php +++ b/apps/files_external/service/dbconfigservice.php @@ -65,7 +65,7 @@ class DBConfigService { $builder = $this->connection->getQueryBuilder(); $query = $builder->select(['mount_id', 'mount_point', 'storage_backend', 'auth_backend', 'priority', 'type']) ->from('external_mounts', 'm') - ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))); + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))); $mounts = $this->getMountsFromQuery($query); if (count($mounts) > 0) { return $mounts[0]; @@ -83,7 +83,7 @@ class DBConfigService { $builder = $this->connection->getQueryBuilder(); $query = $builder->select(['mount_id', 'mount_point', 'storage_backend', 'auth_backend', 'priority', 'type']) ->from('external_mounts') - ->where($builder->expr()->eq('type', $builder->expr()->literal(self::MOUNT_TYPE_ADMIN, \PDO::PARAM_INT))); + ->where($builder->expr()->eq('type', $builder->expr()->literal(self::MOUNT_TYPE_ADMIN, IQueryBuilder::PARAM_INT))); return $this->getMountsFromQuery($query); } @@ -91,7 +91,7 @@ class DBConfigService { $query = $builder->select(['m.mount_id', 'mount_point', 'storage_backend', 'auth_backend', 'priority', 'm.type']) ->from('external_mounts', 'm') ->innerJoin('m', 'external_applicable', 'a', 'm.mount_id = a.mount_id') - ->where($builder->expr()->eq('a.type', $builder->createNamedParameter($type, \PDO::PARAM_INT))); + ->where($builder->expr()->eq('a.type', $builder->createNamedParameter($type, IQueryBuilder::PARAM_INT))); if (is_null($value)) { $query = $query->andWhere($builder->expr()->isNull('a.value')); @@ -126,7 +126,7 @@ class DBConfigService { public function getAdminMountsFor($type, $value) { $builder = $this->connection->getQueryBuilder(); $query = $this->getForQuery($builder, $type, $value); - $query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_ADMIN, \PDO::PARAM_INT))); + $query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_ADMIN, IQueryBuilder::PARAM_INT))); return $this->getMountsFromQuery($query); } @@ -141,15 +141,15 @@ class DBConfigService { public function getAdminMountsForMultiple($type, array $values) { $builder = $this->connection->getQueryBuilder(); $params = array_map(function ($value) use ($builder) { - return $builder->createNamedParameter($value, \PDO::PARAM_STR); + return $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR); }, $values); $query = $builder->select(['m.mount_id', 'mount_point', 'storage_backend', 'auth_backend', 'priority', 'm.type']) ->from('external_mounts', 'm') ->innerJoin('m', 'external_applicable', 'a', 'm.mount_id = a.mount_id') - ->where($builder->expr()->eq('a.type', $builder->createNamedParameter($type, \PDO::PARAM_INT))) + ->where($builder->expr()->eq('a.type', $builder->createNamedParameter($type, IQueryBuilder::PARAM_INT))) ->andWhere($builder->expr()->in('a.value', $params)); - $query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_ADMIN, \PDO::PARAM_INT))); + $query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_ADMIN, IQueryBuilder::PARAM_INT))); return $this->getMountsFromQuery($query); } @@ -164,7 +164,7 @@ class DBConfigService { public function getUserMountsFor($type, $value) { $builder = $this->connection->getQueryBuilder(); $query = $this->getForQuery($builder, $type, $value); - $query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_PERSONAl, \PDO::PARAM_INT))); + $query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_PERSONAl, IQueryBuilder::PARAM_INT))); return $this->getMountsFromQuery($query); } @@ -186,11 +186,11 @@ class DBConfigService { $builder = $this->connection->getQueryBuilder(); $query = $builder->insert('external_mounts') ->values([ - 'mount_point' => $builder->createNamedParameter($mountPoint, \PDO::PARAM_STR), - 'storage_backend' => $builder->createNamedParameter($storageBackend, \PDO::PARAM_STR), - 'auth_backend' => $builder->createNamedParameter($authBackend, \PDO::PARAM_STR), - 'priority' => $builder->createNamedParameter($priority, \PDO::PARAM_INT), - 'type' => $builder->createNamedParameter($type, \PDO::PARAM_INT) + 'mount_point' => $builder->createNamedParameter($mountPoint, IQueryBuilder::PARAM_STR), + 'storage_backend' => $builder->createNamedParameter($storageBackend, IQueryBuilder::PARAM_STR), + 'auth_backend' => $builder->createNamedParameter($authBackend, IQueryBuilder::PARAM_STR), + 'priority' => $builder->createNamedParameter($priority, IQueryBuilder::PARAM_INT), + 'type' => $builder->createNamedParameter($type, IQueryBuilder::PARAM_INT) ]); $query->execute(); return (int)$this->connection->lastInsertId('external_mounts'); @@ -204,19 +204,19 @@ class DBConfigService { public function removeMount($mountId) { $builder = $this->connection->getQueryBuilder(); $query = $builder->delete('external_mounts') - ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))); + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))); $query->execute(); $query = $builder->delete('external_applicable') - ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))); + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))); $query->execute(); $query = $builder->delete('external_config') - ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))); + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))); $query->execute(); $query = $builder->delete('external_options') - ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))); + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))); $query->execute(); } @@ -229,7 +229,7 @@ class DBConfigService { $query = $builder->update('external_mounts') ->set('mount_point', $builder->createNamedParameter($newMountPoint)) - ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))); + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))); $query->execute(); } @@ -243,7 +243,7 @@ class DBConfigService { $query = $builder->update('external_mounts') ->set('auth_backend', $builder->createNamedParameter($newAuthBackend)) - ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))); + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))); $query->execute(); } @@ -265,9 +265,9 @@ class DBConfigService { if ($count === 0) { $builder = $this->connection->getQueryBuilder(); $query = $builder->update('external_config') - ->set('value', $builder->createNamedParameter($value, \PDO::PARAM_STR)) - ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))) - ->andWhere($builder->expr()->eq('key', $builder->createNamedParameter($key, \PDO::PARAM_STR))); + ->set('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR)) + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))) + ->andWhere($builder->expr()->eq('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR))); $query->execute(); } } @@ -287,9 +287,9 @@ class DBConfigService { if ($count === 0) { $builder = $this->connection->getQueryBuilder(); $query = $builder->update('external_options') - ->set('value', $builder->createNamedParameter(json_encode($value), \PDO::PARAM_STR)) - ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))) - ->andWhere($builder->expr()->eq('key', $builder->createNamedParameter($key, \PDO::PARAM_STR))); + ->set('value', $builder->createNamedParameter(json_encode($value), IQueryBuilder::PARAM_STR)) + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))) + ->andWhere($builder->expr()->eq('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR))); $query->execute(); } } @@ -305,13 +305,13 @@ class DBConfigService { public function removeApplicable($mountId, $type, $value) { $builder = $this->connection->getQueryBuilder(); $query = $builder->delete('external_applicable') - ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, \PDO::PARAM_INT))) - ->andWhere($builder->expr()->eq('type', $builder->createNamedParameter($type, \PDO::PARAM_INT))); + ->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))) + ->andWhere($builder->expr()->eq('type', $builder->createNamedParameter($type, IQueryBuilder::PARAM_INT))); if (is_null($value)) { $query = $query->andWhere($builder->expr()->isNull('value')); } else { - $query = $query->andWhere($builder->expr()->eq('value', $builder->createNamedParameter($value, \PDO::PARAM_STR))); + $query = $query->andWhere($builder->expr()->eq('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR))); } $query->execute(); @@ -354,7 +354,7 @@ class DBConfigService { $builder = $this->connection->getQueryBuilder(); $fields[] = 'mount_id'; $placeHolders = array_map(function ($id) use ($builder) { - return $builder->createPositionalParameter($id, \PDO::PARAM_INT); + return $builder->createPositionalParameter($id, IQueryBuilder::PARAM_INT); }, $mountIds); $query = $builder->select($fields) ->from($table) |