Take the 2-minute tour ×

I have a trigger on a table that I dont want to trigger during specific contexts.

In order to do this, I plan on:

  1. locking the database
  2. dropping the trigger
  3. performing my operations
  4. adding the trigger
  5. unlocking the database

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?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Perform your work in a transaction by using the BEGIN TRANSACTION and COMMIT TRANSACTION SQL:

DROP TRIGGER dbname.triggername;
(do other stuff)
share|improve this answer
add comment

Use sqlite3_db_config() with SQLITE_DBCONFIG_ENABLE_TRIGGER to temporarily disable triggers.

share|improve this answer
add comment

Your Answer


