How to set multiple reply values via a single SQL query?

James Wood james.wood at purplewifi.net
Tue Mar 3 21:14:55 CET 2015


Hi

Is there any way to set multiple reply items via a single SQL query?

At the moment, I have a table called “settings” and within that I have a
number of columns like Session-Timeout. I am having to do multiple SQL
queries to pull these out, even though they are in the same table, which is
both introducing time and load on the server.

I am using:

update reply {
               Session-Timeout = "%{sql:SELECT `Session-Timeout` FROM
settings WHERE router_mac = \"%{Called-Station-Id}\"}"
               Idle-Timeout = "%{sql:SELECT `Idle-Timeout` FROM settings
WHERE router_mac = \"%{Called-Station-Id}\"}"
               Filter-Id = "%{sql:SELECT `Filter-Id` FROM settings WHERE
router_mac = \"%{Called-Station-Id}\"}"
}

Is there any way to do this in a single query? The SQL query above is
simplified as we join some other tables in (which is why we are not just
using entries in radreply) but that's a different topic.

Thanks,

James





More information about the Freeradius-Users mailing list