Browse Source

disable AutoCommit on db population

This greatly improves write speed for the sqlite-db.
master
René Wagner 3 months ago
parent
commit
6afd1659f5
Signed by: rwa GPG Key ID: 2B8BCD69606E7F19
  1. 3
      phosta

3
phosta

@ -162,7 +162,7 @@ sub populate
!$opt_v or say "### Exiftool command: $cmd";
my @lines = `$cmd`;
my $dbh = DBI->connect($dsn, '', '', { RaiseError => 1 }) or die $DBI::errstr;
my $dbh = DBI->connect($dsn, '', '', { RaiseError => 1, AutoCommit => 0 }) or die $DBI::errstr;
my $errorcount = 0;
foreach (@lines)
{
@ -193,6 +193,7 @@ sub populate
VALUES ('$file', '$maker', '$model', '$lensmake', '$lens', '$fl', '$fl35', '$apert', '$exposuretime', '$iso', '$flash', '$datetimeoriginal')";
my $rv = $dbh->do($stmt) or $errorcount++;
}
$dbh->commit();
$dbh->disconnect();
say sprintf('%5d', $errorcount). ' image files skipped due to errors';
say "Updated database $opt_D.";

Loading…
Cancel
Save