Hi, I hope this question isn't a noob one like my last one ...

I have two db, the main one is used from mine sw (call this db A), the other
is used from another sw (call this db B).
I open A, attach B, create a temp trigger in A triggered by insert into a
table in B and writing in a table in A

If I insert into the table in B the trigger is triggered but if the sw
(working on B) insert the same thing in the same table the trigger do
nothing.

db A
CREATE TABLE original(id integer primary key, data text);

db B
attach database 'A.db' as A;
CREATE TABLE sync(id integer primary key, original_id integer, flag
integer);
CREATE TRIGGER to_sync after insert on A.original
begin
  insert into sync (original_id,flag) values(new.id,1);
end;

running from B
sqlite> insert into original(data) values("test");
sqlite> select * from original;
1|test
sqlite> select * from sync;
1|1|1

if I open another instance of sqlite3 for A running another insert
sqlite> insert into original (data) values("test2");

in B I see
sqlite> select * from original;
1|test
2|test2
sqlite> select * from sync;
1|1|1

It's possible to get the trigger run when insert is lunched from another
session ?

--
[image: Just A Little Bit Of
Geekness]<http://feeds.feedburner.com/%7Er/JustALittleBitOfGeekness/%7E6/1>
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza.
(Larry Wall).
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to