I then updated queries in all the scripts I could find that updated the called_count column... I've tested my query and I know it works: e.g. $stmt = "UPDATE vicidial_list set status='$stage',daily_called_count = (daily_called_count + ('$called_count'-called_count)), called_count='$called_count',user='$user' where lead_id='$lead_id';";
Problem is it doesn't seem to ever be happening... So I can only conclude that I must have missed an important script somewhere that does updates of called_count...
Here are the scripts I've modified the queries in:
- Code: Select all
AST_VDauto_dial.pl
AST_VDauto_dial_FILL.pl
VICIDIAL_rebuild_list_statuses.pl
vcd_db_query.php
I also proposed simply adding a trigger like so:
- Code: Select all
DELIMITER $$
CREATE TRIGGER `increment_daily_called_count` BEFORE UPDATE ON `vicidial_list`
FOR EACH ROW begin
if (NEW.called_count != OLD.called_count) then
set NEW.daily_called_count = OLD.daily_called_count+(NEW.called_count-OLD.called_count);
end if;
end
$$
DELIMITER ;
but my boss is concerned that the trigger will add too much overhead.
So two questions:
1. What am I missing?
2. Is the trigger solution valid or is my boss correct in his concerns?