diff options
author | ivan <ivan> | 2011-05-19 17:39:06 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-05-19 17:39:06 +0000 |
commit | f9d08a9be9e03f985de40b56b2b3b8b37d1c49bf (patch) | |
tree | 5b4945e0108a381c442b7795e3114d377ab2b30f | |
parent | cfbc0d9b853bfe96ba84c95812a99d7a619e7f9e (diff) |
calculate sum separately?
-rw-r--r-- | FS/bin/freeside-torrus-srvderive | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/FS/bin/freeside-torrus-srvderive b/FS/bin/freeside-torrus-srvderive index a89cf3901..23d2e44a9 100644 --- a/FS/bin/freeside-torrus-srvderive +++ b/FS/bin/freeside-torrus-srvderive @@ -203,14 +203,18 @@ while (1) { AND other.srv_date = '$srv_date' AND ABS( $cur - $other_date ) <= 60 "; + my $ssth = dbh->prepare($sum) or die $DBI::errstr; + $ssth->execute or die $ssth->errstr; #better recovery? + my $value = $ssth->fetchrow_arrayref->[0]; my $isql = " - INSERT INTO srvexport ( srv_date, srv_time, serviceid, value, intvl ) - VALUES ( ?, ?, ?, ($sum), ? ) + INSERT INTO srvexport (srv_date, srv_time, serviceid, value, intvl) + VALUES ( ?, ?, ?, ?, ? ) "; my @param = ( $srv_date, time2str('%X', $cur), #srv_time "$serviceid$dir", #serviceid + $value, 300, #intvl ... ); warn $isql. ' with param '. join(',',@param). "\n" |