Le 18/09/2014 03:51, Robin Sheat a écrit :
While I have your attention, we should be more careful about how the dry run stuff is actually done. I've found one script that gives you a different count if you're in dry run mode (e.g. it'll say "0 actions done") which is strictly correct, but means you don't know if it's 0 because something's wrong, or because it's in dry run mode. Unless there's a good reason, it's best to do everything in a commit, so something like:
$dbi->begin_work; ...do stuff... print "$count actions done.\n"; if ($dry_run) { $dbi->rollback; print "Changes NOT committed.\n"; } else { $dbi->commit; } mmm... I agree with this point, BUT, for large changes, MySQL really does really not well with a huge single transactions. In this case, the only way is to do smaller transactions.
-- Paul Poulain, Associé-gérant / co-owner BibLibre, expert du logiciel libre pour les bibliothèques BibLibre, Open Source software for libraries expert