[Koha-devel] Conventions for CLI scripts
Paul Poulain
paul.poulain at biblibre.com
Tue Oct 21 09:56:43 CEST 2014
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
More information about the Koha-devel
mailing list