Bug 31222: Reduce query size for batchMod
authorNick Clemens <nick@bywatersolutions.com>
Fri, 22 Jul 2022 14:47:36 +0000 (14:47 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 17 Aug 2022 18:51:23 +0000 (15:51 -0300)
commit7343e404b7b486c52a150613f308e452f4f5da05
tree2cfb0e2f16cd0c407178fe1386613e26ac8f3efd
parent89e65657b106570b717dede6476a6d6f65511b67
Bug 31222: Reduce query size for batchMod

The object search is currently:
Koha::Items->search({ barcode => \@contentlist }

Which generate code like:
barcode = 1 OR barcode = 2 OR barcode = 3 ....

This can get quite large

We can reduce the query size by using -in:
Koha::Items->search({ barcode => { -in => \@contentlist } }

Which generates code like:
barcode in ( 1, 2, 3 )

To test:
1 - Apply patch
2 - Perform batch modifications
3 - Confirm nothing has changed

Signed-off-by: Rachael Laritz <rachael.laritz@inlibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
tools/batchMod.pl