setting $dbh->{AutoCommit} = 0, and adding a new --commit arg.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
ba19a4ffc1
commit
b57c146b26
|
|
@ -22,6 +22,8 @@ my $reset;
|
|||
my $biblios;
|
||||
my $authorities;
|
||||
my $sysprefs;
|
||||
my $commit;
|
||||
|
||||
GetOptions(
|
||||
'd:s' => \$directory,
|
||||
'reset' => \$reset,
|
||||
|
|
@ -30,8 +32,12 @@ GetOptions(
|
|||
'b' => \$biblios,
|
||||
'a' => \$authorities,
|
||||
's' => \$sysprefs, # rebuild 'NoZebraIndexes' syspref
|
||||
'commit:f' => \$commit,
|
||||
);
|
||||
|
||||
my $commitnum = 1000;
|
||||
$commitnum = $commit if ($commit) ;
|
||||
|
||||
$directory = "export" unless $directory;
|
||||
my $dbh=C4::Context->dbh;
|
||||
$dbh->do("update systempreferences set value=1 where variable='NoZebra'");
|
||||
|
|
@ -83,9 +89,12 @@ if (!%index || $sysprefs ) {
|
|||
}
|
||||
$|=1;
|
||||
|
||||
$dbh->{AutoCommit} = 0;
|
||||
|
||||
print "***********************************\n";
|
||||
print "***** building BIBLIO indexes *****\n";
|
||||
print "***********************************\n";
|
||||
|
||||
my $sth;
|
||||
$sth=$dbh->prepare("select biblionumber from biblioitems order by biblionumber $limit");
|
||||
$sth->execute();
|
||||
|
|
@ -162,7 +171,11 @@ while (my ($biblionumber) = $sth->fetchrow) {
|
|||
}
|
||||
}
|
||||
}
|
||||
$dbh->commit() if (0 == $i % $commitnum);
|
||||
}
|
||||
$dbh->commit;
|
||||
|
||||
|
||||
print "\nInserting records...\n";
|
||||
$i=0;
|
||||
|
||||
|
|
@ -180,7 +193,11 @@ foreach my $key (keys %result) {
|
|||
$sth->execute($key,$index,$result{$key}->{$index});
|
||||
$dbh->commit() if (0 == $i % $commitnum);
|
||||
}
|
||||
$dbh->commit() if (0 == $i % $commitnum);
|
||||
}
|
||||
$dbh->commit;
|
||||
|
||||
|
||||
print "\nbiblios done\n";
|
||||
|
||||
print "\n***********************************\n";
|
||||
|
|
@ -268,7 +285,12 @@ while (my ($authid) = $sth->fetchrow) {
|
|||
}
|
||||
}
|
||||
}
|
||||
$dbh->commit() if (0 == $i % $commitnum);
|
||||
}
|
||||
$dbh->commit;
|
||||
|
||||
|
||||
|
||||
print "\nInserting...\n";
|
||||
$i=0;
|
||||
|
||||
|
|
@ -285,5 +307,7 @@ foreach my $key (keys %result) {
|
|||
$sth->execute($key,$index,$result{$key}->{$index});
|
||||
$dbh->commit() if (0 == $i % $commitnum);
|
||||
}
|
||||
$dbh->commit() if (0 == $i % $commitnum);
|
||||
}
|
||||
$dbh->commit;
|
||||
print "\nauthorities done\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue