Reorganise SQL files
[freeradius.git] / raddb / sql / cui / postgresql / queries.conf
1 # -*- text -*-
2
3 ##
4 ##  Queries to update the CUI table.
5 ##
6 postauth_query = "INSERT INTO ${cui_table} \
7         (clientipaddress, callingstationid, username, cui) \
8         VALUES \
9         ('%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}', '%{Calling-Station-Id}', '%{User-Name}', '%{reply:Chargeable-User-Identity}')";
10
11 accounting_start_query = "UPDATE ${cui_table} \
12         SET \
13                 lastaccounting = now() \
14         WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
15         AND callingstationid = '%{Calling-Station-Id}' \
16         AND username = '%{User-Name}' \
17         AND cui = '%{Chargeable-User-Identity}'";
18   
19 accounting_update_query = "UPDATE ${cui_table} \
20         SET \
21                 lastaccounting = now() \
22         WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
23         AND callingstationid = '%{Calling-Station-Id}' \
24         AND username = '%{User-Name}' \
25         AND cui = '%{Chargeable-User-Identity}'";
26
27 accounting_stop_query = "DELETE FROM ${cui_table} WHERE \
28         clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
29         AND callingstationid = '%{Calling-Station-Id}' \
30         AND username = '%{User-Name}' \
31         AND cui = '%{Chargeable-User-Identity}'";