I'm currently learning how to implement sqlite commands through C code and I've been trying to figure out the best way to ensure that no data can be inserted to a table (which will only happen during a certain period of time).
I have a database History
and in this database exists the table events
with the following schema:
CREATE TABLE events
(
id integer primary key autoincrement,
msg varchar(20) NOT NULL,
ago varchar(30) NOT NULL
);
I know a mySQL implementation would likely use INSTEAD OF INSERT
on the table, though I also know INSTEAD OF
can't be executed on tables, only views in sqlite. (To be honest I'm new to databases so I only kinda understand this concept).
Would anyone with some more database experience be able to help me with writing (or at the very least understanding the theory behind) a trigger that does not allow data to be inserted to the table?
Edit: This article is where I first got the idea that this would be possible
Best Answer
It will be something like
And the same for INSTEAD OF DELETE.