hi

in my application i sometimes must insert huge amount of pre-prepared data so i
don't want triggers to do any action while i am inserting them

for this reason i created one small table which is normally empty, however if it
contains record set to 1 triggers shoudl not do any action. to make this happen
i use triggers like this following example

CREATE TRIGGER sync_Activity_oninsert after insert on Activity
for each row
when (not exists(select * from sync_block where sub_block=1))
begin
        --action
end;

to block triggers i do: insert into sync_block values(1);
to enable them back i do: delete from sync_block;


this helped to stop triggers from doing any action, but they still launch and in
result import of data takes 2x more with triggers then without them.

is there any other, faster, way to temporarily disable triggers?

i found one more possibility, someone recommended it on this list in year 2005
that its possible to list all create trigger statements from database, drop
them, make action and recreate them back. this will work, but time for creating
so many triggers (yes, they are many) may be also very bad. in addition it
doesn't seem as very nice solution to me...

the most prefered way for me would be to use some pragma to disable triggers,
but looking to documentation i wasn't able to find any...

maybe someone has any other idea?



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to