Hi,

 

I am in a situation where-in there are multiple connections to a single
sqlite database. When one connection updates the database other
connections would like to get the information about the change
(asynchronously, for example when user wants he will use some refresh
like command of the application). I tried it by doing the following.

1. Create a table

create table updatelog (cid text)

2. The I create the trigger:

create trigger updateaddresstrigger update on address

begin

insert into updatelog values (NEW.cid);

end;

The table address has a column cid.

On refresh I query the updatelog to get the cid of all changed
addresses.

 

The problem here is when do I delete the data from updatelog, since if I
don't do so then at every refresh, I will be updating the cid address
which is already updated. What I want to make sure that a cid entry is
removed only for the connection which has refreshed but is still
available for connections that have not yet refreshed.

 

I basically want to create trigger, and then associate the action from
the application which connects to the database. Something like in my
application I would do:

 

sqlite3_open();

And run a command like this one

create temp table updatalog (cid text)

attach trigger updateaddresstrigger update on address (not a valid
command but I just want to express what kind of solution I am looking
for)

begin

insert into updatelog values (NEW.cid);

end;

 

The on refresh I would like to `

delete from updatelog

 

Doing this, I can have every connection have its own updatelog table 

 

Prakash Reddy Bande

Altair Engg. Inc,

Troy, MI

 

Reply via email to