SQL query difficulties

Dave Aldwinckle daldwinc at uwaterloo.ca
Tue Dec 9 20:33:36 CET 2014

Hi Alan,

Good eye. I corrected the typo, but still had a problem.

Updated line:

if("%{sql:SELECT COUNT(macaddress) FROM `radmacauthgroup` WHERE 
macaddress = '%{User-Name}'}" > 0 ){

I went back and re-read the sql module. Turns out I forgot to set the 
proper sql driver and dialect. Its all working now.


On 09/12/14 01:35 PM, Alan DeKok wrote:
> On Dec 9, 2014, at 12:08 PM, Dave Aldwinckle <daldwinc at uwaterloo.ca> wrote:
>> When I run an SQL query from freeradius, I get no results. When I copy and paste the query into mysql, there is a result. Configs and debug below; help is appreciated.
>> ...
>>                 if("%{sql:SELECT COUNT(macaddress) FROM `radmacauthgroup` WHERE macaddress = '%{User-Name}'" > 0){
>    That query has a typo.  It *should* be caught, but the parser isn’t (yet) smart enough to look that deeply into strings.
>    You’re missing a closing brace at the end of the string: … ‘%{User-Name}’}"
>    I’ll see if I can add a test case to catch this.
>    Alan DeKok.
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

More information about the Freeradius-Users mailing list