diff options
author | gerv%gerv.net <> | 2004-01-22 16:10:53 +0000 |
---|---|---|
committer | gerv%gerv.net <> | 2004-01-22 16:10:53 +0000 |
commit | 89de356424ce5717e6b5e0dbbd65609b84df40a0 (patch) | |
tree | deaeaa09627903af7a00b4912235e7cda593a7d0 /collectstats.pl | |
parent | Bug 231391 - make "cumulate" option work on new charts, together with a few U... (diff) | |
download | bugzilla-89de356424ce5717e6b5e0dbbd65609b84df40a0.tar.gz bugzilla-89de356424ce5717e6b5e0dbbd65609b84df40a0.tar.bz2 bugzilla-89de356424ce5717e6b5e0dbbd65609b84df40a0.zip |
Bug 227155 - make sure running collectstats.pl twice in a day, or migrating data from old charts to new charts where there are duplicate entries, doesn't cause an SQL error. Patch by gerv; r,a=justdave.
Diffstat (limited to 'collectstats.pl')
-rwxr-xr-x | collectstats.pl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/collectstats.pl b/collectstats.pl index 002d5fba2..bc7b24884 100755 --- a/collectstats.pl +++ b/collectstats.pl @@ -453,6 +453,12 @@ sub CollectSeriesData { "(series_id, date, value) " . "VALUES (?, " . $dbh->quote($today) . ", ?)"); + # We delete from the table beforehand, to avoid SQL errors if people run + # collectstats.pl twice on the same day. + my $deletesth = $dbh->prepare("DELETE FROM series_data + WHERE series_id = ? AND date = " . + $dbh->quote($today)); + foreach my $series_id (keys %$serieses) { # We set up the user for Search.pm's permission checking - each series # runs with the permissions of its creator. @@ -470,6 +476,7 @@ sub CollectSeriesData { my $count = scalar(@$data) || 0; + $deletesth->execute($series_id); $sth->execute($series_id, $count); } } |