Skip to content

Commit 6b64469

Browse files
[skip ci]
[skip ci]
1 parent 5c9feec commit 6b64469

File tree

1 file changed

+68
-2
lines changed

1 file changed

+68
-2
lines changed

informix-identity-trigger-proc.sql

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
--databse common_oltp
1+
database common_oltp
22
DROP PROCEDURE proc_user_update(varchar,decimal);
33
DROP PROCEDURE proc_user_update;
44
CREATE PROCEDURE informix.proc_user_update(
@@ -101,7 +101,7 @@ new_status_id DECIMAL(3,0)
101101
end procedure;
102102

103103

104-
--database informixoltp
104+
database informixoltp
105105
DROP PROCEDURE informix.proc_coder_update;
106106
CREATE PROCEDURE informix.proc_coder_update(
107107
v_oldcoder_id decimal(10,0),
@@ -136,3 +136,69 @@ v_oldcomp_country_code varchar(3), v_newcomp_country_code varchar(3)
136136
End if;
137137

138138
end procedure;
139+
140+
database tcs_catalog;
141+
DROP PROCEDURE proc_reliability_update;
142+
CREATE PROCEDURE informix.proc_reliability_update(
143+
p_user_id DECIMAL(10,0),
144+
p_phase_id decimal(3,0),
145+
old_rating decimal(5,4),
146+
new_rating decimal(5,4)
147+
)
148+
149+
if (USER != 'ifxsyncuser') then
150+
if (old_rating != new_rating) then
151+
insert into user_reliability_audit (column_name, old_value, new_value, user_id, phase_id)
152+
values ('RATING', old_rating, new_rating, p_user_id, p_phase_id);
153+
End If;
154+
155+
update user_reliability set modify_date = current where user_id = p_user_id and phase_id = p_phase_id;
156+
End if;
157+
end procedure;
158+
159+
DROP PROCEDURE proc_rating_update;
160+
CREATE PROCEDURE informix.proc_rating_update(
161+
p_user_id DECIMAL(10,0),
162+
p_phase_id decimal(3,0),
163+
old_rating decimal(10,0),
164+
new_rating decimal(10,0),
165+
old_vol decimal(10,0),
166+
new_vol decimal(10,0),
167+
old_num_ratings decimal(5,0),
168+
new_num_ratings decimal(5,0),
169+
old_last_rated_project_id decimal(12,0),
170+
new_last_rated_project_id decimal(12,0)
171+
)
172+
if (USER != 'ifxsyncuser') then
173+
if (old_rating != new_rating) then
174+
insert into user_rating_audit (column_name, old_value, new_value, user_id, phase_id)
175+
values ('RATING', old_rating, new_rating, p_user_id, p_phase_id);
176+
End If;
177+
178+
if (old_vol != new_vol) then
179+
insert into user_rating_audit (column_name, old_value, new_value, user_id, phase_id)
180+
values ('VOL', old_vol, new_vol, p_user_id, p_phase_id);
181+
End If;
182+
183+
if (old_num_ratings != new_num_ratings) then
184+
insert into user_rating_audit (column_name, old_value, new_value, user_id, phase_id)
185+
values ('NUM_RATINGS', old_num_ratings, new_num_ratings, p_user_id, p_phase_id);
186+
End If;
187+
188+
if (old_last_rated_project_id != new_last_rated_project_id) then
189+
insert into user_rating_audit (column_name, old_value, new_value, user_id, phase_id)
190+
values ('LAST_RATED_PROJECT_ID', old_last_rated_project_id, new_last_rated_project_id, p_user_id, p_phase_id);
191+
End If;
192+
193+
update user_rating set mod_date_time = current where user_id = p_user_id and phase_id = p_phase_id;
194+
End if;
195+
end procedure;
196+
197+
DROP PROCEDURE proc_contest_creation_update;
198+
CREATE PROCEDURE informix.proc_contest_creation_update (create_user VARCHAR(64), old_project_status_id INT, new_project_status_id INT)
199+
if (USER != 'ifxsyncuser') then
200+
if (old_project_status_id != new_project_status_id and new_project_status_id == 1) then
201+
insert into corona_event (corona_event_type_id,user_id) values (5, TO_NUMBER(create_user));
202+
end if;
203+
End if;
204+
end procedure;

0 commit comments

Comments
 (0)