]> git.xonotic.org Git - xonotic/xonstatdb.git/commitdiff
Complete trigger definition.
authorAnt Zucaro <azucaro@gmail.com>
Tue, 18 Nov 2014 02:39:48 +0000 (21:39 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Tue, 18 Nov 2014 02:39:48 +0000 (21:39 -0500)
scripts/gen_trigger.shl

index f02a73a977d2e9946f0b810ae865707a53843dbe..1746278b84ac2444d6d8387dccb358e1bb0e13d9 100755 (executable)
@@ -32,8 +32,15 @@ do
 done
 
 printf "\tELSE\n"
-printf "\t\tRAISE EXCEPTION 'Date out of range. Fix the %s_ins() trigger!\n" $table
-printf "\tEND IF\n"
+printf "\t\tRAISE EXCEPTION 'Date out of range. Fix the %s_ins() trigger!';\n" $table
+printf "\tEND IF;\n"
 printf "\tRETURN NULL;\n"
 
 printf "END\n"
+printf "\$\$\n"
+printf "LANGUAGE plpgsql;\n\n"
+
+printf "DROP TRIGGER IF EXISTS %s_ins_trg ON xonstat.games;\n" $table
+printf "CREATE TRIGGER %s_ins_trg\n" $table
+printf "BEFORE INSERT on xonstat.%s\n" $table
+printf "FOR EACH ROW EXECUTE PROCEDURE %s_ins();\n" $table