DELIMITER |
CREATE TRIGGER radius_upd AFTER UPDATE ON radacct_1[INDENT]FOR EACH ROW[/INDENT][INDENT]BEGIN[/INDENT][INDENT][INDENT]IF NEW.AcctStopTime IS NOT NULL THEN[/INDENT][/INDENT][INDENT][INDENT]INSERT INTO radacct (`RadAcctId`, `AcctSessionId`, `AcctUniqueId`, `UserName`, `GroupName`, `Realm`, `NASIPAddress`, `NASPortId`, `NASPortType`, `AcctStartTime`, `AcctStopTime`, `AcctSessionTime`, `AcctAuthentic`, `ConnectInfo_start`, `ConnectInfo_stop`, `AcctInputOctets`, `AcctOutputOctets`, `CalledStationId`, `CallingStationId`, `AcctTerminateCause`, `ServiceType`, `FramedProtocol`, `FramedIPAddress`, `AcctStartDelay`, `AcctStopDelay`, `xascendsessionsvrkey`) VALUES (NEW.RadAcctId, NEW.AcctSessionId, NEW.AcctUniqueId, NEW.UserName, NEW.GroupName, NEW.Realm, NEW.NASIPAddress, NEW.NASPortId, NEW.NASPortType, NEW.AcctStartTime, NEW.AcctStopTime, NEW.AcctSessionTime, NEW.AcctAuthentic, NEW.ConnectInfo_start, NEW.ConnectInfo_stop, NEW.AcctInputOctets, NEW.AcctOutputOctets, NEW.CalledStationId, NEW.CallingStationId, NEW.AcctTerminateCause, NEW.ServiceType, NEW.FramedProtocol, NEW.FramedIPAddress, NEW.AcctStartDelay, NEW.AcctStopDelay, NEW.xascendsessionsvrkey);[/INDENT][/INDENT][INDENT][INDENT][COLOR=Red][B]DELETE FROM radacct_1 WHERE OLD.RadAcctId = NEW.RadAcctId;[/B][/COLOR][/INDENT][/INDENT][INDENT][INDENT]END IF;[/INDENT][/INDENT][INDENT]END;[/INDENT]|
DELIMITER ;