From f2a1b2c507731ec46ee195cf78f2fc46d8b5394f Mon Sep 17 00:00:00 2001 From: antzucaro Date: Tue, 15 Nov 2011 20:01:26 -0500 Subject: [PATCH] Change to unix encoding. --- triggers/games_ins_trg.sql | 66 ++++++++++++------------ triggers/player_game_stats_ins_trg.sql | 66 ++++++++++++------------ triggers/player_weapon_stats_ins_trg.sql | 66 ++++++++++++------------ 3 files changed, 99 insertions(+), 99 deletions(-) mode change 100755 => 100644 triggers/games_ins_trg.sql mode change 100755 => 100644 triggers/player_game_stats_ins_trg.sql mode change 100755 => 100644 triggers/player_weapon_stats_ins_trg.sql diff --git a/triggers/games_ins_trg.sql b/triggers/games_ins_trg.sql old mode 100755 new mode 100644 index e893c39..5eada1b --- a/triggers/games_ins_trg.sql +++ b/triggers/games_ins_trg.sql @@ -1,33 +1,33 @@ -CREATE OR REPLACE FUNCTION games_ins() -RETURNS TRIGGER AS $$ -BEGIN - IF (NEW.create_dt >= DATE '2011-04-01' AND NEW.create_dt < DATE '2011-07-01') THEN - INSERT INTO games_2011Q2 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2011-07-01' AND NEW.create_dt < DATE '2011-10-01') THEN - INSERT INTO games_2011Q3 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2011-10-01' AND NEW.create_dt < DATE '2012-01-01') THEN - INSERT INTO games_2011Q4 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-01-01' AND NEW.create_dt < DATE '2012-04-01') THEN - INSERT INTO games_2012Q1 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-04-01' AND NEW.create_dt < DATE '2012-07-01') THEN - INSERT INTO games_2012Q2 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-07-01' AND NEW.create_dt < DATE '2012-10-01') THEN - INSERT INTO games_2012Q3 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-10-01' AND NEW.create_dt < DATE '2013-01-01') THEN - INSERT INTO games_2012Q4 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2013-01-01' AND NEW.create_dt < DATE '2013-04-01') THEN - INSERT INTO games_2013Q1 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2013-04-01' AND NEW.create_dt < DATE '2013-07-01') THEN - INSERT INTO games_2013Q2 VALUES (NEW.*); - ELSE - RAISE EXCEPTION 'Date out of range. Fix the games_ins() trigger!'; - END IF; - RETURN NULL; -END; -$$ -LANGUAGE plpgsql; - -DROP TRIGGER IF EXISTS games_ins_trg ON xonstat.games; -CREATE TRIGGER games_ins_trg - BEFORE INSERT on xonstat.games - FOR EACH ROW EXECUTE PROCEDURE games_ins(); +CREATE OR REPLACE FUNCTION games_ins() +RETURNS TRIGGER AS $$ +BEGIN + IF (NEW.create_dt >= DATE '2011-04-01' AND NEW.create_dt < DATE '2011-07-01') THEN + INSERT INTO games_2011Q2 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2011-07-01' AND NEW.create_dt < DATE '2011-10-01') THEN + INSERT INTO games_2011Q3 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2011-10-01' AND NEW.create_dt < DATE '2012-01-01') THEN + INSERT INTO games_2011Q4 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-01-01' AND NEW.create_dt < DATE '2012-04-01') THEN + INSERT INTO games_2012Q1 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-04-01' AND NEW.create_dt < DATE '2012-07-01') THEN + INSERT INTO games_2012Q2 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-07-01' AND NEW.create_dt < DATE '2012-10-01') THEN + INSERT INTO games_2012Q3 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-10-01' AND NEW.create_dt < DATE '2013-01-01') THEN + INSERT INTO games_2012Q4 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2013-01-01' AND NEW.create_dt < DATE '2013-04-01') THEN + INSERT INTO games_2013Q1 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2013-04-01' AND NEW.create_dt < DATE '2013-07-01') THEN + INSERT INTO games_2013Q2 VALUES (NEW.*); + ELSE + RAISE EXCEPTION 'Date out of range. Fix the games_ins() trigger!'; + END IF; + RETURN NULL; +END; +$$ +LANGUAGE plpgsql; + +DROP TRIGGER IF EXISTS games_ins_trg ON xonstat.games; +CREATE TRIGGER games_ins_trg + BEFORE INSERT on xonstat.games + FOR EACH ROW EXECUTE PROCEDURE games_ins(); diff --git a/triggers/player_game_stats_ins_trg.sql b/triggers/player_game_stats_ins_trg.sql old mode 100755 new mode 100644 index e321a30..beb3f94 --- a/triggers/player_game_stats_ins_trg.sql +++ b/triggers/player_game_stats_ins_trg.sql @@ -1,33 +1,33 @@ -CREATE OR REPLACE FUNCTION player_game_stats_ins() -RETURNS TRIGGER AS $$ -BEGIN - IF (NEW.create_dt >= DATE '2011-04-01' AND NEW.create_dt < DATE '2011-07-01') THEN - INSERT INTO player_game_stats_2011Q2 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2011-07-01' AND NEW.create_dt < DATE '2011-10-01') THEN - INSERT INTO player_game_stats_2011Q3 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2011-10-01' AND NEW.create_dt < DATE '2012-01-01') THEN - INSERT INTO player_game_stats_2011Q4 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-01-01' AND NEW.create_dt < DATE '2012-04-01') THEN - INSERT INTO player_game_stats_2012Q1 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-04-01' AND NEW.create_dt < DATE '2012-07-01') THEN - INSERT INTO player_game_stats_2012Q2 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-07-01' AND NEW.create_dt < DATE '2012-10-01') THEN - INSERT INTO player_game_stats_2012Q3 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-10-01' AND NEW.create_dt < DATE '2013-01-01') THEN - INSERT INTO player_game_stats_2012Q4 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2013-01-01' AND NEW.create_dt < DATE '2013-04-01') THEN - INSERT INTO player_game_stats_2013Q1 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2013-04-01' AND NEW.create_dt < DATE '2013-07-01') THEN - INSERT INTO player_game_stats_2013Q2 VALUES (NEW.*); - ELSE - RAISE EXCEPTION 'Date out of range. Fix the player_game_stats_ins() trigger!'; - END IF; - RETURN NULL; -END; -$$ -LANGUAGE plpgsql; - -DROP TRIGGER IF EXISTS player_game_stats_ins_trg ON xonstat.player_game_stats; -CREATE TRIGGER player_game_stats_ins_trg - BEFORE INSERT on xonstat.player_game_stats - FOR EACH ROW EXECUTE PROCEDURE player_game_stats_ins(); +CREATE OR REPLACE FUNCTION player_game_stats_ins() +RETURNS TRIGGER AS $$ +BEGIN + IF (NEW.create_dt >= DATE '2011-04-01' AND NEW.create_dt < DATE '2011-07-01') THEN + INSERT INTO player_game_stats_2011Q2 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2011-07-01' AND NEW.create_dt < DATE '2011-10-01') THEN + INSERT INTO player_game_stats_2011Q3 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2011-10-01' AND NEW.create_dt < DATE '2012-01-01') THEN + INSERT INTO player_game_stats_2011Q4 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-01-01' AND NEW.create_dt < DATE '2012-04-01') THEN + INSERT INTO player_game_stats_2012Q1 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-04-01' AND NEW.create_dt < DATE '2012-07-01') THEN + INSERT INTO player_game_stats_2012Q2 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-07-01' AND NEW.create_dt < DATE '2012-10-01') THEN + INSERT INTO player_game_stats_2012Q3 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-10-01' AND NEW.create_dt < DATE '2013-01-01') THEN + INSERT INTO player_game_stats_2012Q4 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2013-01-01' AND NEW.create_dt < DATE '2013-04-01') THEN + INSERT INTO player_game_stats_2013Q1 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2013-04-01' AND NEW.create_dt < DATE '2013-07-01') THEN + INSERT INTO player_game_stats_2013Q2 VALUES (NEW.*); + ELSE + RAISE EXCEPTION 'Date out of range. Fix the player_game_stats_ins() trigger!'; + END IF; + RETURN NULL; +END; +$$ +LANGUAGE plpgsql; + +DROP TRIGGER IF EXISTS player_game_stats_ins_trg ON xonstat.player_game_stats; +CREATE TRIGGER player_game_stats_ins_trg + BEFORE INSERT on xonstat.player_game_stats + FOR EACH ROW EXECUTE PROCEDURE player_game_stats_ins(); diff --git a/triggers/player_weapon_stats_ins_trg.sql b/triggers/player_weapon_stats_ins_trg.sql old mode 100755 new mode 100644 index fbaf451..d1b21ae --- a/triggers/player_weapon_stats_ins_trg.sql +++ b/triggers/player_weapon_stats_ins_trg.sql @@ -1,33 +1,33 @@ -CREATE OR REPLACE FUNCTION player_weapon_stats_ins() -RETURNS TRIGGER AS $$ -BEGIN - IF (NEW.create_dt >= DATE '2011-04-01' AND NEW.create_dt < DATE '2011-07-01') THEN - INSERT INTO player_weapon_stats_2011Q2 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2011-07-01' AND NEW.create_dt < DATE '2011-10-01') THEN - INSERT INTO player_weapon_stats_2011Q3 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2011-10-01' AND NEW.create_dt < DATE '2012-01-01') THEN - INSERT INTO player_weapon_stats_2011Q4 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-01-01' AND NEW.create_dt < DATE '2012-04-01') THEN - INSERT INTO player_weapon_stats_2012Q1 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-04-01' AND NEW.create_dt < DATE '2012-07-01') THEN - INSERT INTO player_weapon_stats_2012Q2 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-07-01' AND NEW.create_dt < DATE '2012-10-01') THEN - INSERT INTO player_weapon_stats_2012Q3 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2012-10-01' AND NEW.create_dt < DATE '2013-01-01') THEN - INSERT INTO player_weapon_stats_2012Q4 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2013-01-01' AND NEW.create_dt < DATE '2013-04-01') THEN - INSERT INTO player_weapon_stats_2013Q1 VALUES (NEW.*); - ELSIF (NEW.create_dt >= DATE '2013-04-01' AND NEW.create_dt < DATE '2013-07-01') THEN - INSERT INTO player_weapon_stats_2013Q2 VALUES (NEW.*); - ELSE - RAISE EXCEPTION 'Date out of range. Fix the player_weapon_stats_ins() trigger!'; - END IF; - RETURN NULL; -END; -$$ -LANGUAGE plpgsql; - -DROP TRIGGER IF EXISTS player_weapon_stats_ins_trg ON xonstat.player_weapon_stats; -CREATE TRIGGER player_weapon_stats_ins_trg - BEFORE INSERT on xonstat.player_weapon_stats - FOR EACH ROW EXECUTE PROCEDURE player_weapon_stats_ins(); +CREATE OR REPLACE FUNCTION player_weapon_stats_ins() +RETURNS TRIGGER AS $$ +BEGIN + IF (NEW.create_dt >= DATE '2011-04-01' AND NEW.create_dt < DATE '2011-07-01') THEN + INSERT INTO player_weapon_stats_2011Q2 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2011-07-01' AND NEW.create_dt < DATE '2011-10-01') THEN + INSERT INTO player_weapon_stats_2011Q3 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2011-10-01' AND NEW.create_dt < DATE '2012-01-01') THEN + INSERT INTO player_weapon_stats_2011Q4 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-01-01' AND NEW.create_dt < DATE '2012-04-01') THEN + INSERT INTO player_weapon_stats_2012Q1 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-04-01' AND NEW.create_dt < DATE '2012-07-01') THEN + INSERT INTO player_weapon_stats_2012Q2 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-07-01' AND NEW.create_dt < DATE '2012-10-01') THEN + INSERT INTO player_weapon_stats_2012Q3 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2012-10-01' AND NEW.create_dt < DATE '2013-01-01') THEN + INSERT INTO player_weapon_stats_2012Q4 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2013-01-01' AND NEW.create_dt < DATE '2013-04-01') THEN + INSERT INTO player_weapon_stats_2013Q1 VALUES (NEW.*); + ELSIF (NEW.create_dt >= DATE '2013-04-01' AND NEW.create_dt < DATE '2013-07-01') THEN + INSERT INTO player_weapon_stats_2013Q2 VALUES (NEW.*); + ELSE + RAISE EXCEPTION 'Date out of range. Fix the player_weapon_stats_ins() trigger!'; + END IF; + RETURN NULL; +END; +$$ +LANGUAGE plpgsql; + +DROP TRIGGER IF EXISTS player_weapon_stats_ins_trg ON xonstat.player_weapon_stats; +CREATE TRIGGER player_weapon_stats_ins_trg + BEFORE INSERT on xonstat.player_weapon_stats + FOR EACH ROW EXECUTE PROCEDURE player_weapon_stats_ins(); -- 2.39.2