IF NOT ISNULL(OLDVAL("cena")) AND cena>1.1*OLDVAL("cena") =MESSAGEBOX("Maximální zvýšení ceny je 10%") RETURN .F. ENDIFVšimněte si testu na NULL - pro nově přidané věty má totiž položka hodnotu NULL. Kdy se bude trigger nebo ověřovací pravidlo volat (a zda je tedy nutné testovat i hodnotu cena=0 po přidání věty) závisí na režimu bufferování a na tom, zda se jedná o tabulku nebo pohled.
NO BUFFERING | DBF ROW/TABLE BUFF | VIEW ROW BUFF | VIEW TABLE BUFF | |
APPEND BLANK ... | Field Validation Record Validation Primary Key Test Insert Trigger |
Nic | Nic | Nic |
REPLACE | Field Validation Record Validation Primary Key Test Update Trigger |
Field Validation | View Field Validation | View Field Validation |
INSERT INTO ... | Field Validation Record Validation Primary Key Test Insert Trigger |
Field Validation | View Field Validation | View Field Validation |
DELETE | Delete Trigger | Nic | Nic | Nic |
RECALL | Field Validation Record Validation Primary Key Test Insert Trigger |
Nic | Nic | Nic |
SKIP 1 | Nic | Record Validation Primary Key Test… Trigger |
[View Field Validation, pokud předcházel RECALL] Field Validation Record Validation Primary Key Test Insert Trigger |
[View Field Validation, pokud předcházel RECALL] |
TABLE-UPDATE | * | Record Validation Primary Key Test… Trigger |
Field Validation Record Validation Primary Key Test Insert Trigger |
Field Validation Record Validation Primary Key Test Insert Trigger |
USE | Nic | je-li potřeba: Record Validation Primary Key Test Pokud ROW:… Trigger |
[View Field Validation, je-li třeba] Field Validation Record Validation Primary Key Test |
Nic |
lcTriggerVal = DBGETPROP("MyTable", "Table", "DeleteTrigger") * Probíhá zpracování bez triggeru ... CREATE TRIGGER ON MyTable FOR DELETE AS (lctriggerVal)
Zdraví vás
Milan Kosina, kosina@vol.cz