Freeradius+MySql (Authorization Query) - regexp

2003-12-22 Thread Kiran
Hi 

I am using the following query for authorization and I
am getting the error 1064 from MySql (PARSE ERROR).
But when I am giving the same query replacing the
variables with values, I am getting the output. Can
someone explain me why.

(select id,UserName,Attribute,Value,op from
${authreply_table} where username='%{SQL-User-Name}')
union (select id,UserName, Attribute,
concat('h323-credit-time=',round(substring(value,20)/(tas_rate+charge))*60)
Value,op from ${authreply_table}, pb_tariffs,surcharge
where \%{Called-Station-Id}\ regexp
concat(^,de_prefix) and value like
'h323-credit-amount=%' and username='%{SQL-User-Name}'
and dnis='%{Calling-Station-Id}' order by de_prefix
desc limit 1)


I am getting the error after adding 'regexp' to the
query.

Thanks,
Kiran


Yahoo! Messenger - Communicate instantly...Ping 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: Freeradius+MySql (Authorization Query) - regexp

2003-12-22 Thread Alan DeKok
=?iso-8859-1?q?Kiran?= [EMAIL PROTECTED] wrote:
 I am using the following query for authorization and I
 am getting the error 1064 from MySql (PARSE ERROR).
 But when I am giving the same query replacing the
 variables with values, I am getting the output. Can
 someone explain me why.

  Look at the SQL debug log file.  It will have the queries with the
variables replaced by values.

 (select id,UserName,Attribute,Value,op from
 ${authreply_table} where username='%{SQL-User-Name}')
 union (select id,UserName, Attribute,
 concat('h323-credit-time=',round(substring(value,20)/(tas_rate+charge))*60)
 Value,op from ${authreply_table}, pb_tariffs,surcharge
 where \%{Called-Station-Id}\ regexp
 concat(^...


  A double quote inside of a double-quoted string?

 I am getting the error after adding 'regexp' to the
 query.

  Then what you added is the source of the problem.

  Alan DeKok.

   

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html