Описание
(Нет описания для триггера ILT$INVOICESUPDATE)
Определение
CREATE TRIGGER ILT$INVOICESUPDATE FOR INVOICES
ACTIVE AFTER UPDATE POSITION 1000
AS
declare variable TableOperationID Integer;
declare variable TableID Integer;
declare variable FieldID Integer;
declare variable FieldName char(31);
declare variable INVOICEDATEID Integer;
declare variable STATIONIDID Integer;
declare variable REGISTERIDID Integer;
declare variable SENDERIDID Integer;
declare variable FORWARDERIDID Integer;
begin /*
if ( ((old.INVOICEDATE is null and new.INVOICEDATE is not null) or (old.INVOICEDATE is not null
and new.INVOICEDATE is null) or (old.INVOICEDATE is not null and new.INVOICEDATE is not null
and old.INVOICEDATE <> new.INVOICEDATE)) or ((old.STATIONID is null and new.STATIONID is
not null) or (old.STATIONID is not null and new.STATIONID is null) or (old.STATIONID is not null and
new.STATIONID is not null and old.STATIONID <> new.STATIONID)) or ((old.REGISTERID is null
and new.REGISTERID is not null) or (old.REGISTERID is not null and new.REGISTERID is null) or
(old.REGISTERID is not null and new.REGISTERID is not null and old.REGISTERID <>
new.REGISTERID)) or ((old.SENDERID is null and new.SENDERID is not null) or (old.SENDERID
is not null and new.SENDERID is null) or (old.SENDERID is not null and new.SENDERID is not null
and old.SENDERID <> new.SENDERID)) or ((old.FORWARDERID is null and
new.FORWARDERID is not null) or (old.FORWARDERID is not null and new.FORWARDERID is
null) or (old.FORWARDERID is not null and new.FORWARDERID is not null and
old.FORWARDERID <> new.FORWARDERID)))
then begin
TableOperationID = gen_id(gen_ilt$tableoperation_id, 1);
select tableid
from ilt$tables
where ilt$tables.tablename = 'INVOICES'
into :TableID;
insert into ilt$tableoperation (tableoperationid, tableid, recordid, operationid)
values (:TableOperationID, :TableID, new.INVOICEID, 2);
for
select fieldid, fieldname
from ilt$fields
where tableid = :tableid
into :fieldid, :FieldName
do begin
if (:fieldname = 'INVOICEDATE') then INVOICEDATEid = :fieldid;
else if (:fieldname = 'STATIONID') then STATIONIDid = :fieldid;
else if (:fieldname = 'REGISTERID') then REGISTERIDid = :fieldid;
else if (:fieldname = 'SENDERID') then SENDERIDid = :fieldid;
else if (:fieldname = 'FORWARDERID') then FORWARDERIDid = :fieldid;
end
if ((old.INVOICEDATE is null and new.INVOICEDATE is not null) or (old.INVOICEDATE is not null
and new.INVOICEDATE is null) or (old.INVOICEDATE is not null and new.INVOICEDATE is not null
and old.INVOICEDATE <> new.INVOICEDATE))
then insert into ilt$fielddate (tableoperationid, fieldid, fieldvalue)
values (:TableOperationID, :INVOICEDATEid, new.INVOICEDATE);
if ((old.STATIONID is null and new.STATIONID is not null) or (old.STATIONID is not null and
new.STATIONID is null) or (old.STATIONID is not null and new.STATIONID is not null and
old.STATIONID <> new.STATIONID))
then insert into ilt$fieldinteger (tableoperationid, fieldid, fieldvalue)
values (:TableOperationID, :STATIONIDid, new.STATIONID);
if ((old.REGISTERID is null and new.REGISTERID is not null) or (old.REGISTERID is not null and
new.REGISTERID is null) or (old.REGISTERID is not null and new.REGISTERID is not null and
old.REGISTERID <> new.REGISTERID))
then insert into ilt$fieldinteger (tableoperationid, fieldid, fieldvalue)
values (:TableOperationID, :REGISTERIDid, new.REGISTERID);
if ((old.SENDERID is null and new.SENDERID is not null) or (old.SENDERID is not null and
new.SENDERID is null) or (old.SENDERID is not null and new.SENDERID is not null and
old.SENDERID <> new.SENDERID))
then insert into ilt$fieldinteger (tableoperationid, fieldid, fieldvalue)
values (:TableOperationID, :SENDERIDid, new.SENDERID);
if ((old.FORWARDERID is null and new.FORWARDERID is not null) or (old.FORWARDERID is not
null and new.FORWARDERID is null) or (old.FORWARDERID is not null and new.FORWARDERID
is not null and old.FORWARDERID <> new.FORWARDERID))
then insert into ilt$fieldinteger (tableoperationid, fieldid, fieldvalue)
values (:TableOperationID, :FORWARDERIDid, new.FORWARDERID);
end */
END