## DB connection
my %dbAttr = (
PrintError=>0,# turn off error reporting via warn()
- RaiseError=>1 # turn on error reporting via die()
+ RaiseError=>1, # turn on error reporting via die()
+ AutoCommit=>0 # manually use transactions
);
my $dbDsn = "DBI:mysql:database=".$config->get("DB_NAME").";host=".$config->get("DB_HOST").";port=".$config->get("DB_PORT");
my $dbh = DBI->connect($dbDsn,$config->get("DB_USER"),$config->get("DB_PASS"), \%dbAttr);
while(my @row = $query->fetchrow_array) {
$baseUrls{$row[0]} = $row[1];
}
-#$query->finish();
# get the string to ignore
while(my @row = $query->fetchrow) {
push(@urlStringsToIgnore, $row[0])
}
-#$query->finish();
## prepare linkExtor
sayLog $queryStr if $DEBUG;
$query = $dbh->prepare($queryStr);
my $md5 = Digest::MD5->new;
+ my $counter = 0;
foreach my $link (@links) {
sayLog $link if ($DEBUG);
$query->execute($digest, $link, $url->scheme."://".$url->host);
$md5->reset;
+ $counter++;
+
+ if($counter >= 100) {
+ $counter = 0;
+ $dbh->commit();
+ }
+
#sayLog $digest if ($DEBUG);
#sayLog $url->scheme if ($DEBUG);
#sayLog $url->host if ($DEBUG);
#sayLog "Inserted: $link" if($DEBUG);
}
- #$query->finish();
+ $dbh->commit();
}