Skip to content

Commit 42f080d

Browse files
miaulalalaclaude
andcommitted
fix(user_status): use IQueryBuilder::MAX_IN_PARAMETERS for IN-list chunking
Replaces the app-local MAX_IN_CHUNK constant with the public constant, as requested in review. Both hold 1000, so behaviour is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Anna Larch <anna@nextcloud.com>
1 parent 8204069 commit 42f080d

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

apps/user_status/lib/Db/UserStatusMapper.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020
*/
2121
class UserStatusMapper extends QBMapper {
2222

23-
/**
24-
* Oracle rejects an IN list with more than 1000 expressions, so anything
25-
* built from an unbounded set of ids has to be split into chunks.
26-
*/
27-
private const MAX_IN_CHUNK = 1000;
28-
2923
/**
3024
* @param IDBConnection $db
3125
*/
@@ -290,7 +284,7 @@ public function findStatusesWithoutBackupFlagIds(): array {
290284
*/
291285
public function normalizeBackupFlagByIds(array $ids): int {
292286
$updated = 0;
293-
foreach (array_chunk($ids, self::MAX_IN_CHUNK) as $chunk) {
287+
foreach (array_chunk($ids, IQueryBuilder::MAX_IN_PARAMETERS) as $chunk) {
294288
$qb = $this->db->getQueryBuilder();
295289
$qb->update($this->tableName)
296290
->set('is_backup', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL))
@@ -307,7 +301,7 @@ public function normalizeBackupFlagByIds(array $ids): int {
307301
*/
308302
public function deleteByIds(array $ids): int {
309303
$deleted = 0;
310-
foreach (array_chunk($ids, self::MAX_IN_CHUNK) as $chunk) {
304+
foreach (array_chunk($ids, IQueryBuilder::MAX_IN_PARAMETERS) as $chunk) {
311305
$qb = $this->db->getQueryBuilder();
312306
$qb->delete($this->tableName)
313307
->where($qb->expr()->in('id', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY)));

0 commit comments

Comments
 (0)