Reputation: 14251
I have a trigger on a table that I dont want to trigger during specific contexts.
In order to do this, I plan on:
Locking the database is necessary so that any operations that other threads attempt to perform will halt until the triggers are back in place. How do I do this from the C code?
Upvotes: 2
Views: 343
Reputation: 180010
Use sqlite3_db_config()
with SQLITE_DBCONFIG_ENABLE_TRIGGER
to temporarily disable triggers.
Upvotes: 0
Reputation: 231063
Perform your work in a transaction by using the BEGIN TRANSACTION
and COMMIT TRANSACTION
SQL:
BEGIN TRANSACTION;
DROP TRIGGER dbname.triggername;
(do other stuff)
CREATE TRIGGER ...;
COMMIT TRANSACTION;
Upvotes: 2