blob: 6befdcc616f742c97dddf02a021fb7ad4925d62c [file] [log] [blame]
Chetan Gaonker7f4bf742016-05-04 15:56:08 -07001#
2# This query properly handles calls that span from the
3# previous reset period into the current period but
4# involves more work for the SQL server than those
5# below
6#
7query = "\
8 SELECT SUM(acctsessiontime - GREATEST((%b - strftime('%%s', acctstarttime)), 0)) \
9 FROM radacct \
10 WHERE username = '%{${key}}' \
11 AND (strftime('%%s', acctstarttime) + acctsessiontime) > %b"
12
13#
14# This query ignores calls that started in a previous
15# reset period and continue into into this one. But it
16# is a little easier on the SQL server
17#
18#query = "\
19# SELECT SUM(acctsessiontime) \
20# FROM radacct \
21# WHERE \username = '%{${key}}' \
22# AND acctstarttime > %b"
23
24#
25# This query is the same as above, but demonstrates an
26# additional counter parameter '%e' which is the
27# timestamp for the end of the period
28#
29#query = "\
30# SELECT SUM(acctsessiontime) FROM radacct \
31# WHERE username = '%{${key}}' \
32# AND acctstarttime BETWEEN %b \
33# AND %e"