Hi Thomas. Below is a toy "records" table example which illustrates the
INSTEAD OF pattern.
---
CREATE TABLE records(rowid INTEGER PRIMARY KEY, data INTEGER, change_date
TEXT DEFAULT CURRENT_TIMESTAMP);
CREATE VIEW instead_of_records AS SELECT * FROM records;
CREATE TRIGGER
Thomas, SQLite has the INSTEAD OF trigger to intercept/modify/compose NEW
values:
https://www.sqlite.org/lang_createtrigger.html#instead_of_trigger
I've found most situations are well handled by the INSTEAD OF trigger. It
is powerful and somewhat comparable in functionality to stored procedure
Other DBMS support the following construct in a trigger:
CREATE TRIGGER name BEFORE UPDATE ON table
FOR EACH ROW
BEGIN
SET NEW.column = anyvalue
END;
In SQLite, the NEW record appearently is read-only.
Support for changeable NEW records would however be graceful as it
automatically prevents
3 matches
Mail list logo