On Fri, Dec 19, 2008 at 8:28 PM, <tnt@kalik.net> wrote:
sqlcounter_expand: 'SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='%{User-Name}'' [noresetcounter] expand: SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='%{User-Name}' -> SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='jose' sqlcounter_expand: '%{sql:SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='jose'}' [noresetcounter] sql_xlat [noresetcounter] expand: %{User-Name} -> jose [noresetcounter] sql_set_user escaped user --> 'jose' [noresetcounter] expand: SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='jose' -> SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='jose' rlm_sql (sql): Reserving sql socket id: 2 [noresetcounter] row[0] returned NULL rlm_sql (sql): Released sql socket id: 2 [noresetcounter] expand: %{sql:SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='jose'} -> rlm_sqlcounter: No integer found in string "" ++[noresetcounter] returns noop
OK, I see the problem. As first aid change the query to:
SELECT COALESCE(SUM(AcctSessionTime) FROM radacct WHERE
UserName='%{User-Name},0)
For some reason code doesn't treat null as 0.
Ivan Kalik Kalik Informatika ISP
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Thank you sir, i tried your query but it's gives me syntax error but from your reply my senior person told me that try running below query which is working perfectly for me. query is below: "SELECT IFNULL(SUM(AcctSessionTime),0) FROM radacct WHERE UserName='%{%k}'" but one thing i wanted to ask you why NAS-IP-Addres is always shown as 0.0.0.0 in my case nas ip address is 192.168.2.5. do i need to make any other configuration.