I believe we found the issue (affecting the new feature that allows individual blacklist/whitelist for a domain be inherited from the default ALL DOMAINS, even if the domain itself is not configured to inherit the default settings. We also modified the triggers to avoid the issue you are having with the error "Subquery returns more than 1 row".
The next (patched) version of SpamFilter will be executing this script on MySQL to address this (we're using LIMIT 1 in the SQL statement you identified as being an issue to limit the results to 1 row only).
DROP TRIGGER trWL_AuthorizedTOEmails_AU;
-- GO --
delimiter //
CREATE TRIGGER trWL_AuthorizedTOEmails_AU
AFTER UPDATE ON tblWL_AuthorizedTOEmails
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblwl_authorizedtoemails' )) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblwl_authorizedtoemails');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_authorizedtoemails' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_authorizedtoemailsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_authorizedtoemailsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_authorizedtoemails')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_authorizedtoemails');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_AuthorizedTOEmails_AI;
-- GO --
delimiter //
CREATE TRIGGER trWL_AuthorizedTOEmails_AI
AFTER INSERT ON tblWL_AuthorizedTOEmails
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblwl_authorizedtoemails' )) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblwl_authorizedtoemails');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_authorizedtoemails' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_authorizedtoemailsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_authorizedtoemailsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_authorizedtoemails')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_authorizedtoemails');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_AuthorizedTOEmails_AD;
-- GO --
delimiter //
CREATE TRIGGER trWL_AuthorizedTOEmails_AD
AFTER DELETE ON tblWL_AuthorizedTOEmails
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblwl_authorizedtoemails' )) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblwl_authorizedtoemails');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_authorizedtoemails' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_authorizedtoemailsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_authorizedtoemailsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_authorizedtoemails')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_authorizedtoemails');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_Keywords_AU;
-- GO --
delimiter //
CREATE TRIGGER trWL_Keywords_AU
AFTER UPDATE ON tblWL_Keywords
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblwl_keywords')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblwl_keywords');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_keywords' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_keywordsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_keywordsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_keywords')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_keywords');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_Keywords_AI;
-- GO --
delimiter //
CREATE TRIGGER trWL_Keywords_AI
AFTER INSERT ON tblWL_Keywords
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblwl_keywords')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblwl_keywords');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_keywords' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_keywordsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_keywordsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_keywords')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_keywords');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_Keywords_AD;
-- GO --
delimiter //
CREATE TRIGGER trWL_Keywords_AD
AFTER DELETE ON tblWL_Keywords
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblwl_keywords')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblwl_keywords');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_keywords' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_keywordsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_keywordsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_keywords')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_keywords');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_EmailsFrom_AU;
-- GO --
delimiter //
CREATE TRIGGER trWL_EmailsFrom_AU
AFTER UPDATE ON tblWL_EmailsFrom
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblwl_emailsfrom')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblwl_emailsfrom');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_emailsfrom' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_emailsfromusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_emailsfromusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_emailsfrom')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_emailsfrom');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_EmailsFrom_AI;
-- GO --
delimiter //
CREATE TRIGGER trWL_EmailsFrom_AI
AFTER INSERT ON tblWL_EmailsFrom
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblwl_emailsfrom')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblwl_emailsfrom');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_emailsfrom' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_emailsfromusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_emailsfromusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_emailsfrom')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_emailsfrom');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_EmailsFrom_AD;
-- GO --
delimiter //
CREATE TRIGGER trWL_EmailsFrom_AD
AFTER DELETE ON tblWL_EmailsFrom
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblwl_emailsfrom')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblwl_emailsfrom');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_emailsfrom' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_emailsfromusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_emailsfromusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_emailsfrom')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_emailsfrom');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_EmailsTO_AU;
-- GO --
delimiter //
CREATE TRIGGER trWL_EmailsTO_AU
AFTER UPDATE ON tblWL_EmailsTO
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblwl_emailsto')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblwl_emailsto');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_emailsto' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_emailstousedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_emailstousedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_emailsto')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_emailsto');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_EmailsTO_AI;
-- GO --
delimiter //
CREATE TRIGGER trWL_EmailsTO_AI
AFTER INSERT ON tblWL_EmailsTO
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblwl_emailsto')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblwl_emailsto');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_emailsto' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_emailstousedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_emailstousedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_emailsto')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_emailsto');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_EmailsTO_AD;
-- GO --
delimiter //
CREATE TRIGGER trWL_EmailsTO_AD
AFTER DELETE ON tblWL_EmailsTO
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblwl_emailsto')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblwl_emailsto');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_emailsto' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_emailstousedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_emailstousedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_emailsto')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_emailsto');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_DomainsIPs_AU;
-- GO --
delimiter //
CREATE TRIGGER trWL_DomainsIPs_AU
AFTER UPDATE ON tblWL_DomainsIPs
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblwl_domainsips')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblwl_domainsips');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_domainsips' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_domainsipsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_domainsipsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_domainsips')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_domainsips');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_DomainsIPs_AI;
-- GO --
delimiter //
CREATE TRIGGER trWL_DomainsIPs_AI
AFTER INSERT ON tblWL_DomainsIPs
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblwl_domainsips')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblwl_domainsips');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_domainsips' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_domainsipsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_domainsipsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_domainsips')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_domainsips');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trWL_DomainsIPs_AD;
-- GO --
delimiter //
CREATE TRIGGER trWL_DomainsIPs_AD
AFTER DELETE ON tblWL_DomainsIPs
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblwl_domainsips')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblwl_domainsips');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblwl_domainsips' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.wl_domainsipsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.wl_domainsipsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblwl_domainsips')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblwl_domainsips');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_Domains_AU;
-- GO --
delimiter //
CREATE TRIGGER trBL_Domains_AU
AFTER UPDATE ON tblBL_Domains
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_domains')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_domains');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_domains' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_domainsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_domainsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_domains')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_domains');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_Domains_AI;
-- GO --
delimiter //
CREATE TRIGGER trBL_Domains_AI
AFTER INSERT ON tblBL_Domains
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblbl_domains')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblbl_domains');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_domains' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_domainsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_domainsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_domains')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_domains');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_Domains_AD;
-- GO --
delimiter //
CREATE TRIGGER trBL_Domains_AD
AFTER DELETE ON tblBL_Domains
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_domains')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_domains');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_domains' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_domainsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_domainsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_domains')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_domains');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_EmailsFrom_AU;
-- GO --
delimiter //
CREATE TRIGGER trBL_EmailsFrom_AU
AFTER UPDATE ON tblBL_EmailsFrom
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_emailsfrom')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_emailsfrom');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_emailsfrom' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_emailsfromusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_emailsfromusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_emailsfrom')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_emailsfrom');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_EmailsFrom_AI;
-- GO --
delimiter //
CREATE TRIGGER trBL_EmailsFrom_AI
AFTER INSERT ON tblBL_EmailsFrom
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblbl_emailsfrom')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblbl_emailsfrom');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_emailsfrom' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_emailsfromusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_emailsfromusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_emailsfrom')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_emailsfrom');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_EmailsFrom_AD;
-- GO --
delimiter //
CREATE TRIGGER trBL_EmailsFrom_AD
AFTER DELETE ON tblBL_EmailsFrom
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_emailsfrom')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_emailsfrom');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_emailsfrom' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_emailsfromusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_emailsfromusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_emailsfrom')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_emailsfrom');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_EmailsTO_AU;
-- GO --
delimiter //
CREATE TRIGGER trBL_EmailsTO_AU
AFTER UPDATE ON tblBL_EmailsTO
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_emailsto')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_emailsto');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_emailsto' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_emailstousedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_emailstousedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_emailsto')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_emailsto');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_EmailsTO_AI;
-- GO --
delimiter //
CREATE TRIGGER trBL_EmailsTO_AI
AFTER INSERT ON tblBL_EmailsTO
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblbl_emailsto')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblbl_emailsto');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_emailsto' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_emailstousedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_emailstousedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_emailsto')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_emailsto');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_EmailsTO_AD;
-- GO --
delimiter //
CREATE TRIGGER trBL_EmailsTO_AD
AFTER DELETE ON tblBL_EmailsTO
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_emailsto')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_emailsto');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_emailsto' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_emailstousedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_emailstousedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_emailsto')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_emailsto');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_MAPS_AU;
-- GO --
delimiter //
CREATE TRIGGER trBL_MAPS_AU
AFTER UPDATE ON tblBL_MAPS
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_maps')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_maps');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_maps' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_mapsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_mapsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_maps')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_maps');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_MAPS_AI;
-- GO --
delimiter //
CREATE TRIGGER trBL_MAPS_AI
AFTER INSERT ON tblBL_MAPS
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblbl_maps')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblbl_maps');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_maps' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_mapsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_mapsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_maps')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_maps');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_MAPS_AD;
-- GO --
delimiter //
CREATE TRIGGER trBL_MAPS_AD
AFTER DELETE ON tblBL_MAPS
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_maps')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_maps');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_maps' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_mapsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_mapsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_maps')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_maps');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_Keywords_AU;
-- GO --
delimiter //
CREATE TRIGGER trBL_Keywords_AU
AFTER UPDATE ON tblBL_Keywords
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_keywords')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_keywords');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_keywords' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_keywordsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_keywordsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_keywords')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_keywords');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_Keywords_AI;
-- GO --
delimiter //
CREATE TRIGGER trBL_Keywords_AI
AFTER INSERT ON tblBL_Keywords
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblbl_keywords')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblbl_keywords');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_keywords' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_keywordsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_keywordsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_keywords')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_keywords');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_Keywords_AD;
-- GO --
delimiter //
CREATE TRIGGER trBL_Keywords_AD
AFTER DELETE ON tblBL_Keywords
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_keywords')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_keywords');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_keywords' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_keywordsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_keywordsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_keywords')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_keywords');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_Attachments_AU;
-- GO --
delimiter //
CREATE TRIGGER trBL_Attachments_AU
AFTER UPDATE ON tblBL_Attachments
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_attachments')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_attachments');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_attachments' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_attachmentsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_attachmentsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_attachments')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_attachments');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_Attachments_AI;
-- GO --
delimiter //
CREATE TRIGGER trBL_Attachments_AI
AFTER INSERT ON tblBL_Attachments
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblbl_attachments')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblbl_attachments');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_attachments' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_attachmentsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_attachmentsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_attachments')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_attachments');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_Attachments_AD;
-- GO --
delimiter //
CREATE TRIGGER trBL_Attachments_AD
AFTER DELETE ON tblBL_Attachments
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_attachments')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_attachments');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_attachments' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_attachmentsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_attachmentsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_attachments')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_attachments');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_SURBL_AU;
-- GO --
delimiter //
CREATE TRIGGER trBL_SURBL_AU
AFTER UPDATE ON tblBL_SURBL
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_surbl')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_surbl');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_surbl' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_surblusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_surblusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_surbl')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_surbl');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_SURBL_AI;
-- GO --
delimiter //
CREATE TRIGGER trBL_SURBL_AI
AFTER INSERT ON tblBL_SURBL
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblbl_surbl')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblbl_surbl');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_surbl' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_surblusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_surblusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_surbl')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_surbl');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_SURBL_AD;
-- GO --
delimiter //
CREATE TRIGGER trBL_SURBL_AD
AFTER DELETE ON tblBL_SURBL
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_surbl')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_surbl');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_surbl' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_surblusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_surblusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_surbl')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_surbl');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_IPs_AU;
-- GO --
delimiter //
CREATE TRIGGER trBL_IPs_AU
AFTER UPDATE ON tblBL_IPs
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_ips')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_ips');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_ips' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_ipsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_ipsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_ips')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_ips');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_IPs_AI;
-- GO --
delimiter //
CREATE TRIGGER trBL_IPs_AI
AFTER INSERT ON tblBL_IPs
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblbl_ips')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblbl_ips');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_ips' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_ipsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_ipsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_ips')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_ips');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_IPs_AD;
-- GO --
delimiter //
CREATE TRIGGER trBL_IPs_AD
AFTER DELETE ON tblBL_IPs
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_ips')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_ips');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_ips' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_ipsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_ipsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_ips')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_ips');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_HoneypotEmails_AU;
-- GO --
delimiter //
CREATE TRIGGER trBL_HoneypotEmails_AU
AFTER UPDATE ON tblBL_HoneypotEmails
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_honeypotemails')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_honeypotemails');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_honeypotemails' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_honeypotemailsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_honeypotemailsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_honeypotemails')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_honeypotemails');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_HoneypotEmails_AI;
-- GO --
delimiter //
CREATE TRIGGER trBL_HoneypotEmails_AI
AFTER INSERT ON tblBL_HoneypotEmails
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = NEW.DomainID) AND (r.TableName = 'tblbl_honeypotemails')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (NEW.DomainID, 1, 'tblbl_honeypotemails');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_honeypotemails' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_honeypotemailsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_honeypotemailsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_honeypotemails')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_honeypotemails');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER trBL_HoneypotEmails_AD;
-- GO --
delimiter //
CREATE TRIGGER trBL_HoneypotEmails_AD
AFTER DELETE ON tblBL_HoneypotEmails
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tblbl_honeypotemails')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tblbl_honeypotemails');
END IF;
BEGIN
DECLARE tmp_id INT;
INSERT INTO tblreloadtableinfo (domainid, updatetable, tablename) SELECT s.domainid, 1, 'tblbl_honeypotemails' FROM tbl_localdomains d INNER JOIN tbl_filtersettings s
ON d.id = s.domainid WHERE (d.usedefaults=0) AND (s.bl_honeypotemailsusedefaults = 1);
SET tmp_id = (select s.domainid from tbl_localdomains d inner join tbl_filtersettings s on d.id = s.domainid where (d.usedefaults=0) and (s.bl_honeypotemailsusedefaults = 1) LIMIT 1);
if not exists (select * from tblreloadtableinfo r where (r.domainid = tmp_id) and (r.tablename = 'tblbl_honeypotemails')) then
insert into tblreloadtableinfo (domainid, updatetable, tablename) values(tmp_id, 1, 'tblbl_honeypotemails');
end if;
END;
END;
//
delimiter ;
-- GO --
DROP TRIGGER tr_FilterSettings_AU;
-- GO --
delimiter //
CREATE TRIGGER tr_FilterSettings_AU
AFTER UPDATE ON tbl_FilterSettings
FOR EACH ROW
BEGIN
IF NOT EXISTS (SELECT * FROM tblReloadTableInfo r WHERE (r.DomainID = OLD.DomainID) AND (r.TableName = 'tbl_FilterSettings')) THEN
INSERT INTO tblReloadTableInfo (DomainID, UpdateTable, TableName) VALUES (OLD.DomainID, 1, 'tbl_FilterSettings');
END IF;
BEGIN
if (OLD.bl_domainsusedefaults <> NEW.bl_domainsusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblbl_domains');
end if;
if (OLD.bl_emailsfromusedefaults <> NEW.bl_emailsfromusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblbl_emailsfrom');
end if;
if (OLD.bl_emailstousedefaults <> NEW.bl_emailstousedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblbl_emailsto');
end if;
if (OLD.bl_countriesusedefaults <> NEW.bl_countriesusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblbl_countries');
end if;
if (OLD.bl_mapsusedefaults <> NEW.bl_mapsusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblbl_maps');
end if;
if (OLD.bl_keywordsusedefaults <> NEW.bl_keywordsusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblbl_keywords');
end if;
if (OLD.bl_attachmentsusedefaults <> NEW.bl_attachmentsusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblbl_attachments');
end if;
if (OLD.bl_surblusedefaults <> NEW.bl_surblusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblbl_surbl');
end if;
if (OLD.bl_ipsusedefaults <> NEW.bl_ipsusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblbl_ips');
end if;
if (OLD.bl_honeypotemailsusedefaults <> NEW.bl_honeypotemailsusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblbl_honeypotemails');
end if;
if (OLD.wl_domainsipsusedefaults <> NEW.wl_domainsipsusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblwl_domainsips');
end if;
if (OLD.wl_emailstousedefaults <> NEW.wl_emailstousedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblwl_emailsto');
end if;
if (OLD.wl_emailsfromusedefaults <> NEW.wl_emailsfromusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblwl_emailsfrom');
end if;
if (OLD.wl_authorizedtoemailsusedefaults <> NEW.wl_authorizedtoemailsusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblwl_authorizedtoemails');
end if;
if (OLD.wl_keywordsusedefaults <> NEW.wl_keywordsusedefaults) then insert into tblreloadtableinfo (domainid, updatetable, tablename) VALUES (NEW.domainid, 1, 'tblwl_keywords');
end if;
END;
END;
//
delimiter ;
-- GO --