diff --git a/lib/ClustersBackend/FaceRecognitionBackend.php b/lib/ClustersBackend/FaceRecognitionBackend.php index dc5d93f6..1e5cba6d 100644 --- a/lib/ClustersBackend/FaceRecognitionBackend.php +++ b/lib/ClustersBackend/FaceRecognitionBackend.php @@ -253,12 +253,12 @@ class FaceRecognitionBackend extends Backend // By default hides individual faces when they have no name. if (!$show_singles) { - $query->having($query->expr()->gt($count, $query->createNamedParameter(1))); + $query->having($query->expr()->gt($count, $query->expr()->literal(1, \PDO::PARAM_INT))); } // By default it shows the people who were not hidden if (!$show_hidden) { - $query->andWhere($query->expr()->eq('frp.is_visible', $query->createNamedParameter(true))); + $query->andWhere($query->expr()->eq('frp.is_visible', $query->expr()->literal(true, \PDO::PARAM_BOOL))); } // ORDER by number of faces in cluster and id for response stability. diff --git a/lib/ClustersBackend/PlacesBackend.php b/lib/ClustersBackend/PlacesBackend.php index ca623aca..75992f58 100644 --- a/lib/ClustersBackend/PlacesBackend.php +++ b/lib/ClustersBackend/PlacesBackend.php @@ -72,7 +72,7 @@ class PlacesBackend extends Backend $query->select('e.osm_id', $count)->from('memories_planet', 'e'); // WHERE these are not special clusters (e.g. timezone) - $query->where($query->expr()->gt('e.admin_level', $query->createNamedParameter(0, \PDO::PARAM_INT))); + $query->where($query->expr()->gt('e.admin_level', $query->expr()->literal(0, \PDO::PARAM_INT))); // WHERE there are items with this osm_id $query->innerJoin('e', 'memories_places', 'mp', $query->expr()->eq('mp.osm_id', 'e.osm_id')); diff --git a/lib/ClustersBackend/TagsBackend.php b/lib/ClustersBackend/TagsBackend.php index c1db033d..a228436f 100644 --- a/lib/ClustersBackend/TagsBackend.php +++ b/lib/ClustersBackend/TagsBackend.php @@ -61,7 +61,7 @@ class TagsBackend extends Backend $tagId = $this->getSystemTagId($query, $tagName); $query->innerJoin('m', 'systemtag_object_mapping', 'stom', $query->expr()->andX( - $query->expr()->eq('stom.objecttype', $query->createNamedParameter('files')), + $query->expr()->eq('stom.objecttype', $query->expr()->literal('files')), $query->expr()->eq('stom.objectid', 'm.objectid'), $query->expr()->eq('stom.systemtagid', $query->createNamedParameter($tagId)), )); @@ -74,12 +74,12 @@ class TagsBackend extends Backend // SELECT visible tag name and count of photos $count = $query->func()->count($query->createFunction('DISTINCT m.fileid'), 'count'); $query->select('st.id', 'st.name', $count)->from('systemtag', 'st')->where( - $query->expr()->eq('visibility', $query->createNamedParameter(1)), + $query->expr()->eq('visibility', $query->expr()->literal(1, \PDO::PARAM_INT)), ); // WHERE there are items with this tag $query->innerJoin('st', 'systemtag_object_mapping', 'stom', $query->expr()->andX( - $query->expr()->eq('stom.objecttype', $query->createNamedParameter('files')), + $query->expr()->eq('stom.objecttype', $query->expr()->literal('files')), $query->expr()->eq('stom.systemtagid', 'st.id'), )); @@ -121,7 +121,7 @@ class TagsBackend extends Backend 'systemtag_object_mapping', 'stom' )->where( - $query->expr()->eq('stom.objecttype', $query->createNamedParameter('files')), + $query->expr()->eq('stom.objecttype', $query->expr()->literal('files')), $query->expr()->eq('stom.systemtagid', $query->createNamedParameter($tagId)), ); @@ -147,7 +147,7 @@ class TagsBackend extends Backend $res = $sqb->select('id')->from('systemtag')->where( $sqb->expr()->andX( $sqb->expr()->eq('name', $sqb->createNamedParameter($tagName)), - $sqb->expr()->eq('visibility', $sqb->createNamedParameter(1)), + $sqb->expr()->eq('visibility', $sqb->expr()->literal(1, \PDO::PARAM_INT)), ) )->executeQuery()->fetchOne(); diff --git a/lib/Db/AlbumsQuery.php b/lib/Db/AlbumsQuery.php index 600607f6..dd1fd26d 100644 --- a/lib/Db/AlbumsQuery.php +++ b/lib/Db/AlbumsQuery.php @@ -198,7 +198,7 @@ class AlbumsQuery ->innerJoin('pa', $this->collaboratorsTable(), 'pc', $query->expr()->andX( $query->expr()->eq('pc.album_id', 'pa.album_id'), $query->expr()->eq('collaborator_id', $query->createNamedParameter($token)), - $query->expr()->eq('collaborator_type', $query->createNamedParameter(3)), // = TYPE_LINK + $query->expr()->eq('collaborator_type', $query->expr()->literal(3, \PDO::PARAM_INT)), // = TYPE_LINK )) ; diff --git a/lib/Db/TimelineQueryFilters.php b/lib/Db/TimelineQueryFilters.php index 0dd60f83..d5e843ff 100644 --- a/lib/Db/TimelineQueryFilters.php +++ b/lib/Db/TimelineQueryFilters.php @@ -33,7 +33,7 @@ trait TimelineQueryFilters public function transformVideoFilter(IQueryBuilder &$query, bool $aggregate) { - $query->andWhere($query->expr()->eq('m.isvideo', $query->createNamedParameter('1'))); + $query->andWhere($query->expr()->eq('m.isvideo', $query->expr()->literal(true, \PDO::PARAM_BOOL))); } public function transformLimit(IQueryBuilder &$query, bool $aggregate, int $limit) @@ -59,9 +59,9 @@ trait TimelineQueryFilters return $query->createFunction( $query->getConnection()->getQueryBuilder()->select('id')->from('vcategory', 'vc')->where( $query->expr()->andX( - $query->expr()->eq('type', $query->createNamedParameter('files')), + $query->expr()->eq('type', $query->expr()->literal('files')), $query->expr()->eq('uid', $query->createNamedParameter(Util::getUID())), - $query->expr()->eq('category', $query->createNamedParameter(ITags::TAG_FAVORITE)), + $query->expr()->eq('category', $query->expr()->literal(ITags::TAG_FAVORITE)), ) )->getSQL() ); diff --git a/lib/Db/TimelineQuerySingleItem.php b/lib/Db/TimelineQuerySingleItem.php index 79f05a15..0f03b60a 100644 --- a/lib/Db/TimelineQuerySingleItem.php +++ b/lib/Db/TimelineQuerySingleItem.php @@ -88,7 +88,7 @@ trait TimelineQuerySingleItem ->from('memories_places', 'mp') ->innerJoin('mp', 'memories_planet', 'e', $qb->expr()->eq('mp.osm_id', 'e.osm_id')) ->where($qb->expr()->eq('mp.fileid', $qb->createNamedParameter($id, \PDO::PARAM_INT))) - ->andWhere($qb->expr()->gt('e.admin_level', $qb->createNamedParameter(0, \PDO::PARAM_INT))) + ->andWhere($qb->expr()->gt('e.admin_level', $qb->expr()->literal(0, \PDO::PARAM_INT))) ->orderBy('e.admin_level', 'DESC') ; diff --git a/lib/Db/TimelineWriteMap.php b/lib/Db/TimelineWriteMap.php index a64c1306..b2ee5e89 100644 --- a/lib/Db/TimelineWriteMap.php +++ b/lib/Db/TimelineWriteMap.php @@ -122,7 +122,7 @@ trait TimelineWriteMap $query = $this->connection->getQueryBuilder(); $query->insert('memories_mapclusters') ->values([ - 'point_count' => $query->createNamedParameter(1, IQueryBuilder::PARAM_INT), + 'point_count' => $query->expr()->literal(1, IQueryBuilder::PARAM_INT), 'lat_sum' => $query->createNamedParameter($lat, IQueryBuilder::PARAM_STR), 'lon_sum' => $query->createNamedParameter($lon, IQueryBuilder::PARAM_STR), ]) diff --git a/lib/Db/TimelineWriteOrphans.php b/lib/Db/TimelineWriteOrphans.php index f6828590..9539206d 100644 --- a/lib/Db/TimelineWriteOrphans.php +++ b/lib/Db/TimelineWriteOrphans.php @@ -80,7 +80,7 @@ trait TimelineWriteOrphans $query = $this->connection->getQueryBuilder(); $query->select(...$fields) ->from('memories') - ->where($query->expr()->eq('orphan', $query->createNamedParameter(true, IQueryBuilder::PARAM_BOOL))) + ->where($query->expr()->eq('orphan', $query->expr()->literal(true, IQueryBuilder::PARAM_BOOL))) ->setMaxResults($count) ; diff --git a/lib/Db/TimelineWritePlaces.php b/lib/Db/TimelineWritePlaces.php index ba0e35f3..99905384 100644 --- a/lib/Db/TimelineWritePlaces.php +++ b/lib/Db/TimelineWritePlaces.php @@ -158,7 +158,7 @@ trait TimelineWritePlaces $query->select('name') ->from('memories_planet') ->where($query->expr()->in('osm_id', $query->createNamedParameter($osmIds, IQueryBuilder::PARAM_INT_ARRAY))) - ->andWhere($query->expr()->eq('admin_level', $query->createNamedParameter(-7, IQueryBuilder::PARAM_INT))) + ->andWhere($query->expr()->eq('admin_level', $query->expr()->literal(-7, IQueryBuilder::PARAM_INT))) ; // Get name of timezone diff --git a/lib/Service/Index.php b/lib/Service/Index.php index 10ffb55a..18f63e8e 100644 --- a/lib/Service/Index.php +++ b/lib/Service/Index.php @@ -155,7 +155,7 @@ class Index $query->leftJoin('f', $table, $alias, $query->expr()->andX( $query->expr()->eq('f.fileid', "{$alias}.fileid"), $query->expr()->eq('f.mtime', "{$alias}.mtime"), - $query->expr()->eq("{$alias}.orphan", $query->createNamedParameter(false, IQueryBuilder::PARAM_BOOL)) + $query->expr()->eq("{$alias}.orphan", $query->expr()->literal(false, IQueryBuilder::PARAM_BOOL)) )); $query->andWhere($query->expr()->isNull("{$alias}.fileid"));