Допродажи (сопутствующие товары) к синхронизации — различия между версиями
Olgav (обсуждение | вклад) (Новая страница: «<pre> ALTER TABLE ACCOMPANY ADD D$SRVUPDDT DM_DATETIME; ALTER TABLE ACCOMPANY ADD D$UUID DM_UUID; ALTER TABLE ACCOMPANY ADD CONSTRAINT UNQ1_ACCOMPANY UNIQUE (D$…») |
Olgav (обсуждение | вклад) |
||
Строка 1: | Строка 1: | ||
− | < | + | <nowiki> |
ALTER TABLE ACCOMPANY | ALTER TABLE ACCOMPANY | ||
ADD D$SRVUPDDT DM_DATETIME; | ADD D$SRVUPDDT DM_DATETIME; | ||
Строка 77: | Строка 77: | ||
SET TERM ; ^ | SET TERM ; ^ | ||
− | </ | + | </nowiki> |
Версия 18:06, 27 марта 2017
ALTER TABLE ACCOMPANY ADD D$SRVUPDDT DM_DATETIME; ALTER TABLE ACCOMPANY ADD D$UUID DM_UUID; ALTER TABLE ACCOMPANY ADD CONSTRAINT UNQ1_ACCOMPANY UNIQUE (D$UUID); SET SQL DIALECT 3; SET TERM ^ ; CREATE OR ALTER TRIGGER ACCOMPANY_BD_DISTR FOR ACCOMPANY ACTIVE BEFORE DELETE POSITION 0 AS begin update or insert into g$distribute (TABLENAME,UUID,SOPER,FROM_PROFILE_ID) values ('ACCOMPANY',old.d$uuid,2,null) matching (TABLENAME,UUID); end ^ SET TERM ; ^ SET SQL DIALECT 3; SET TERM ^ ; CREATE OR ALTER TRIGGER ACCOMPANY_BU_DISTR FOR ACCOMPANY ACTIVE BEFORE UPDATE POSITION 0 AS begin if (new.d$srvupddt=old.d$srvupddt) then update or insert into g$distribute (TABLENAME,UUID,SOPER,FROM_PROFILE_ID) values ('ACCOMPANY',new.d$uuid,1,null) matching (TABLENAME,UUID); end ^ SET TERM ; ^ SET SQL DIALECT 3; SET TERM ^ ; CREATE OR ALTER TRIGGER ACCOMPANY_BI_DISTR FOR ACCOMPANY ACTIVE BEFORE INSERT POSITION 0 AS begin if (new.d$uuid is null) then begin new.d$uuid=UUID_TO_CHAR(GEN_UUID()); new.d$srvupddt='2000-01-01'; update or insert into g$distribute (TABLENAME,UUID,SOPER,FROM_PROFILE_ID) values ('ACCOMPANY',new.d$uuid,0,null) matching (TABLENAME,UUID); end end ^ SET TERM ; ^