On Mon, 11 Aug 2008 13:16:45 +0300, you wrote:

>Hello,
>
>I am working on a syncing project and I do have a lot of triggers to 
>read/write foreign keys.
>And while I do the sync of one table the triggers are causing a strange effect 
>(as the other table is not yet synced).
>Is there a pragma to disable triggers on the sqlite database?

Perhaps you can solve the problem with "INSTEAD OF" triggers
on one or more views. Yes, that's possible: a view is
`virtually` updatable when you define triggers for all
statements that will be used to update the view.
It is a very powerful mechanism.

The updatable view can be (almost) any select or join and
has to contain all columns of all tables that you need to
update with the INSERT | UPDATE view_name statements. All
foreign key contraints would be handled by the INSTEAD OF
triggers if all your updates are performed on those views
instead of tables.

sql-statement ::=       
        CREATE [TEMP | TEMPORARY] TRIGGER 
        [IF NOT EXISTS] trigger-name 
        INSTEAD OF database-event 
        ON [database-name .] view-name
        trigger-action

database-event ::=      
        DELETE | INSERT | UPDATE | UPDATE OF 
        column-list

http://www.sqlite.org/lang_createtrigger.html

>Regards,
>Marton

I hope this helps.
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to