SQL Unlang !

Phil Mayers p.mayers at imperial.ac.uk
Wed Mar 16 14:43:15 CET 2011


On 16/03/11 12:44, Suman Dash wrote:
>   I am looking forward for a short example on how to store a SQL query
> to a variable which can be used in next condition in UNLANG.
>
> I have no knowledge of unlang but i got a fair amount of idea with the
> condition checks , just need a little insight on the result stores .

FreeRadius comes with several "Tmp-X" variables defined (see 
dictionary.freeradius.internal) or you can define your own.

e.g.

authorize {
  ...
  update request {
    Tmp-Integer-0 := "%{sql: ...}"
  }
  update request {
    Tmp-Integer-1 := "%{sql: ...}"
  }
  update reply {
    Session-Timeout := "%{expr:%{Tmp-Integer-0} - %{Tmp-Integer-1}}"
  }
  ...

}

Or do the maths in the SQL query itself.



More information about the Freeradius-Users mailing list