Debian Codegraph @

raddb/mods-config/sql/counter/mysql/monthlycounter.conf

raw symbols SCIP
1 #
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 #
7 query = "\
8 SELECT SUM(acctsessiontime - GREATEST((%%b - UNIX_TIMESTAMP(acctstarttime)), 0)) \
9 FROM radacct \
10 WHERE username='%{${key}}' \
11 AND UNIX_TIMESTAMP(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 > FROM_UNIXTIME('%%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) \
31 # FROM radacct \
32 # WHERE username='%{${key}}' \
33 # AND acctstarttime BETWEEN FROM_UNIXTIME('%%b') \
34 # AND FROM_UNIXTIME('%%e')"