SQL Counter Escape String !

Suman Dash suman at clydontech.com
Tue Mar 15 05:54:45 CET 2011


Please anyone advice me the way to escape run-time variables in
freeradius. I am using STR_TO_DATE and freeradius run-time variable is
over-riding the mysql time variables

SELECT STR_TO_DATE('14 Mar 2012 21:37:23','%d %M %Y %H:%i:%s') gives
2012-03-14 21:37:23 in MySQL

Whereas in freeradius

SELECT STR_TO_DATE('14 Mar 2012 21:37:23','%d %M %Y %H:%i:%s') gives

'14 0 2011 20:001122334455:_

14 = Current Date

0 = MTU

2011 = Current Year

001122334455 = Calling-Station-ID

_ = Speed

I have tried escaping as per the thread
http://freeradius.1045715.n5.nabble.com/Changing-the-format-of-a-date-attribute-tt2775323.html#a2775328

But no luck ..

My Entire Counter is :

query = "SELECT SUM(acctsessiontime) FROM tbl_acct where \
                username = 'suman' AND acctstarttime BETWEEN \
                (SELECT STR_TO_DATE((SELECT value FROM tbl_check \
                WHERE username = 'suman' AND attribute =
'Activation'), '%d %M %Y %H:%i:%s')) \
                AND (SELECT STR_TO_DATE((SELECT value FROM tbl_check
WHERE username = 'suman' \
                AND attribute = 'Expiration'), '%d %M %Y %H:%i:%s'))"

The Above Query Ends Up Showing 14 0 2011 23:001122334455:_


Any help in this matter will be highly appreciated !

Cheers !



More information about the Freeradius-Users mailing list