Bug 12488: Make bulkmarcimport.pl -d use DELETE instead of TRUNCATE
authorMagnus Enger <magnus@libriotech.no>
Mon, 11 Feb 2019 10:07:21 +0000 (11:07 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 25 Feb 2019 13:29:39 +0000 (13:29 +0000)
commit1e65ab6f7fe986979efedea4577f29b8c1e3723e
treeae1b45f52358b3226d70354ec4e843d1267f4a44
parent620d3df46204f34c7e4adebdb95f3e1086bd3ce8
Bug 12488: Make bulkmarcimport.pl -d use DELETE instead of TRUNCATE

On MySQL >= 5.5 bulkmarcimport.pl with the -d (delete) switch gives
an error like "Cannot truncate a table referenced in a foreign
key constraint". This patch proposes to replace the offending
TRUNCATE with DELETE. Auto incerement counters are reset to 1 to
preserve the functionality from TRUNCATE.

To test:
- Make sure you havae a test database with some records and items
- Run bulkmarcimport.pl with the -d switch
- Observe the error described above
- Apply this patch
- Run bulkmarcimport.pl with the -d switch again
- Observe the lack of an error
- Verify that the newly imported records and items have biblionumber
  and itemnumbers starting with 1

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit b7b4694666657f57aaf61d091ed34c9f754a11e3)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
misc/migration_tools/bulkmarcimport.pl