Skip to content

Commit 5c9feec

Browse files
[skip ci]
[skip ci]
1 parent 8aed869 commit 5c9feec

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

informix-identity-trigger-proc.sql

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,66 @@
11
--databse common_oltp
2+
DROP PROCEDURE proc_user_update(varchar,decimal);
3+
DROP PROCEDURE proc_user_update;
4+
CREATE PROCEDURE informix.proc_user_update(
5+
new_handle varchar(50),
6+
user_id decimal(10,0))
7+
if (USER != 'ifxsyncuser') then
8+
UPDATE user SET handle_lower = lower(new_handle), modify_date = current WHERE user.user_id = user_id;
9+
End if;
10+
end procedure;
11+
create procedure "informix".proc_user_update(
12+
user_id DECIMAL(10,0),
13+
old_first_name VARCHAR(64),
14+
new_first_name VARCHAR(64),
15+
old_last_name VARCHAR(64),
16+
new_last_name VARCHAR(64),
17+
old_handle VARCHAR(50),
18+
new_handle VARCHAR(50),
19+
old_status VARCHAR(3),
20+
new_status VARCHAR(3),
21+
old_activation_code VARCHAR(32),
22+
new_activation_code VARCHAR(32),
23+
old_middle_name VARCHAR(64),
24+
new_middle_name VARCHAR(64),
25+
old_timezone_id decimal(5,0),
26+
new_timezone_id decimal(5,0)
27+
)
28+
29+
if ((old_first_name != new_first_name) or (old_last_name != new_last_name ) or (old_middle_name != new_middle_name )) then
30+
insert into audit_user (column_name, old_value, new_value,
31+
user_id)
32+
values ('NAME', NVL(old_first_name, '') || ' ' || NVL(old_middle_name, '') || ' ' || NVL(old_last_name, ''),
33+
NVL(new_first_name, '') || ' ' || NVL(new_middle_name,
34+
'') || ' ' || NVL(new_last_name, ''), user_id);
35+
End if;
36+
37+
if (old_handle != new_handle) then
38+
insert into audit_user (column_name, old_value, new_value,
39+
user_id)
40+
values ('HANDLE', old_handle, new_handle, user_id);
41+
End If;
42+
43+
if (old_status != new_status) then
44+
insert into audit_user (column_name, old_value, new_value,
45+
user_id)
46+
values ('STATUS', old_status, new_status, user_id);
47+
End If;
48+
49+
if (old_activation_code != new_activation_code) then
50+
insert into audit_user (column_name, old_value, new_value,
51+
user_id)
52+
values ('ACTIVATION_CODE', old_activation_code, new_activation_code, user_id);
53+
End If;
54+
55+
if (old_timezone_id != new_timezone_id) then
56+
insert into audit_user (column_name, old_value, new_value,
57+
user_id)
58+
values ('TIMEZONE_ID', old_timezone_id, new_timezone_id, user_id);
59+
End If;
60+
if (USER != 'ifxsyncuser') then
61+
UPDATE user SET handle_lower = lower(new_handle), modify_date = current WHERE user.user_id = user_id;
62+
End if;
63+
end procedure;
264

365
DROP PROCEDURE informix.proc_email_update;
466
CREATE PROCEDURE informix.proc_email_update(

0 commit comments

Comments
 (0)