blob: defc591a76d17c987d2ba63aac80512d2c3d178a [file] [log] [blame]
Chetan Gaonker7f4bf742016-05-04 15:56:08 -07001# -*- text -*-
2#
3# cui/sqlite/queries.conf -- Queries to update a sqlite CUI table.
4#
5# $Id: 41741eb70ae9c428ba5230aaf9d9b84f95c050a9 $
6
7post-auth {
8 query = "\
9 INSERT OR REPLACE INTO ${..cui_table} \
10 (clientipaddress, callingstationid, username, cui, lastaccounting) \
11 VALUES \
12 ('%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}', '%{Calling-Station-Id}', \
13 '%{User-Name}', '%{reply:Chargeable-User-Identity}', NULL)"
14
15}
16
17accounting {
18 reference = "%{tolower:type.%{Acct-Status-Type}.query}"
19 type {
20 start {
21 query = "\
22 UPDATE ${....cui_table} SET \
23 lastaccounting = CURRENT_TIMESTAMP \
24 WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
25 AND callingstationid = '%{Calling-Station-Id}' \
26 AND username = '%{User-Name}' \
27 AND cui = '%{Chargeable-User-Identity}'"
28 }
29 interim-update {
30 query ="\
31 UPDATE ${....cui_table} SET \
32 lastaccounting = CURRENT_TIMESTAMP \
33 WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
34 AND callingstationid = '%{Calling-Station-Id}' \
35 AND username = '%{User-Name}' \
36 AND cui = '%{Chargeable-User-Identity}'"
37 }
38 stop {
39 query ="\
40 DELETE FROM ${....cui_table} \
41 WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
42 AND callingstationid = '%{Calling-Station-Id}' \
43 AND username = '%{User-Name}' \
44 AND cui = '%{Chargeable-User-Identity}'"
45 }
46 }
47}