Fixed onoff query
authorAlan T. DeKok <aland@freeradius.org>
Thu, 10 Feb 2011 13:41:38 +0000 (14:41 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 11 Feb 2011 10:10:18 +0000 (11:10 +0100)
raddb/sql/oracle/dialup.conf

index e94da68..1c95da3 100644 (file)
        #                               (alternate in case first query doesn't
        #                                affect any existing rows in the table)
        #######################################################################
-       accounting_onoff_query = "UPDATE ${acct_table1} SET AcctStopTime=TO_DATE('%S','yyyy-mm-dd hh24:mi:ss'), AcctSessionTime=((%S - AcctStartTime)*86400), AcctTerminateCause='%{Acct-Terminate-Cause}', AcctStopDelay = %{Acct-Delay-Time:-0} WHERE AcctStopTime IS NULL AND NASIPAddress = '%{NAS-IP-Address}' AND AcctStartTime <= TO_DATE('%S','yyyy-mm-dd hh24:mi:ss')"
+       accounting_onoff_query = "UPDATE ${acct_table1} SET AcctStopTime=TO_DATE('%S','yyyy-mm-dd hh24:mi:ss'), AcctSessionTime=round((TO_DATE('%S','yyyy-mm-dd hh24:mi:ss')-TO_DATE(TO_CHAR(acctstarttime, 'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss'))*86400), AcctTerminateCause='%{Acct-Terminate-Cause}', AcctStopDelay = %{Acct-Delay-Time:-0} WHERE AcctStopTime IS NULL AND NASIPAddress = '%{NAS-IP-Address}' AND AcctStartTime <= TO_DATE('%S','yyyy-mm-dd hh24:mi:ss')"
 
 accounting_update_query = "UPDATE ${acct_table1} \
     SET FramedIPAddress = NULLIF('%{Framed-IP-Address}', ''), \