can't use placeholders in SELECT SUM(?)
authorivan <ivan>
Tue, 5 Nov 2002 23:34:11 +0000 (23:34 +0000)
committerivan <ivan>
Tue, 5 Nov 2002 23:34:11 +0000 (23:34 +0000)
FS/FS/cust_svc.pm

index e0d582b..7516be5 100644 (file)
@@ -477,14 +477,14 @@ sub attribute_since_sqlradacct {
       $str2time = 'extract(epoch from ';
     }
 
-    my $sth = $dbh->prepare("SELECT SUM(?)
+    my $sth = $dbh->prepare("SELECT SUM($attrib)
                                FROM radacct
                                WHERE UserName = ?
                                  AND $str2time AcctStopTime ) >= ?
                                  AND $str2time AcctStopTime ) <  ?
                                  AND AcctStopTime IS NOT NULL"
     ) or die $dbh->errstr;
-    $sth->execute($attrib, $username, $start, $end) or die $sth->errstr;
+    $sth->execute($username, $start, $end) or die $sth->errstr;
 
     $sum += $sth->fetchrow_arrayref->[0];