Re: [sqlite] Detecting real updates

2009-10-22 Thread Simon Slavin

On 22 Oct 2009, at 3:51pm, Marian Aldenhoevel wrote:

> Is there a way to have sqlite3 detect the actual changes after I did a
> number of INSERT OR UPDATE statements? Using a trigger maybe?
>
> If so I could keep the intermediate storage nicely organized and still
> not incur a lot of read-and-then-update overhead to detect the  
> changes.
>
> The alternative is to just prepare it in the format that would be sent
> over the link, record that in a blob and check on changes on that  
> single
> item. Losing the ability to easily query the data to check it  
> manually.

If you have a central unchanged copy then you just need to keep a  
journal of all your UPDATE INSERT and DELETE commands.  When you want  
to bring the other copy up-to-date, just download your journal to the  
embedded device, and play back your journal against it's own copy of  
the database.

Of course, if the amount of data is small enough, and the device never  
makes changes to it, don't even bother to do that.  Just download a  
fresh copy of the database each time you want to update.

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


[sqlite] Detecting real updates

2009-10-22 Thread Marian Aldenhoevel
Hi,

My application is downloading data from the internet, parses and 
transforms it and (currently) stores it in a sqlite3-database. The data 
parses out into a small variable number of records with just two fields 
each.

Whenever that data changes, either the number of records or the actual 
values in existing records, my application needs to forward the complete 
set to an embedded system over a serial link.

So the intermediate storage is mainly used to have a status-quo to 
compare against.

Is there a way to have sqlite3 detect the actual changes after I did a 
number of INSERT OR UPDATE statements? Using a trigger maybe?

If so I could keep the intermediate storage nicely organized and still 
not incur a lot of read-and-then-update overhead to detect the changes.

The alternative is to just prepare it in the format that would be sent 
over the link, record that in a blob and check on changes on that single 
item. Losing the ability to easily query the data to check it manually.

Ciao, MM
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users