can you tell what files you need??
and the code i am giving is form sql configurations file to simulate this

according to your instruction i changed the file like

sql sql2{
sql_user_name = "%{sql_inst2:select s.* from (select @user:=BINARY '%{User-Name}' p) parm , upm s}"
}

and in
sql sql_gowifi{
sql_user_name = "%{sql2:select s.* from (select @user:=BINARY '%{User-Name}' p) parm , upm s}"
}

i am calling module sql_gowifi form authorize section of sites-enabled/default