|
No. Insert Trigger act between the trigger program and the database; they have their own contractual obligations. A Read Trigger is between the HLL and the database. That is what makes them totally different.What does this mean? From the app pgm point of view, all of these triggers -- READ, INSERT, UPDATE, DELETE -- are between it and the database.
I have obviously not been articulating well, the flaws in a change capable trigger, since all that comes from it is the repeated argument that "anything can mess with the data, so a Read Trigger should be able to as well." So maybe a theoretical example, assuming the added Read Trigger is change capable:
create table qgpl. T (i int, c char)
addpftrg qgpl/T *after *read pgm(plusone)
-- plusone returns a value one greater than in field i
insert into table qgpl.T values(1, DEFAULT)
call read4upd /* open T for upd, read, upd C='', close */
-- trigger program is called, set i = 2 as /desired/
-- Does the row update to the value 2 or stay 1 ?
-- Well, to pass the row with that value to the program,
-- the buffer was just updated to have the value 2
-- So the program updates without changing the value i,
-- yet the value in the table for i is now 2
The same table now, with the value 2:
select i from qgpl.T where i <= 2 into :ii
The fetched value ii does not meet the selection logic; i.e. ii=3 whereas all coded logic is with respect to selecting only values that were /less than or equal to two/. Where is the logic in that? This is much worse for /native/ programs, where logic is more likely to be deferred to the application and HLL run-time.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.