View Single Post
Old 09-04-2012, 06:11 AM   #57
Xosen
Junior Member
Xosen began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Aug 2012
Device: Sony PRS-T1
Hi!

Ok, it seems I have solved the problem. For whatever reason, the original trigger simply does not work for me, and I don't really understand how it works for everyone else :P

Here is the trigger with some tweaks so that it will work with books in both storages. It has the problem of seeing the current book twice, but it's an improvement. I'll try to solve that later.

Code:
CREATE TRIGGER recently_opened_trigger AFTER UPDATE OF reading_time ON books
BEGIN
   UPDATE books SET added_date = new.reading_time WHERE new.reading_time NOT NULL AND _id = old._id;
END
UPDATE: After some thought, I don't think it's possible to prevent the current book from showing twice in the home, because of the impossibility of updating both databases when the next book is read.

Last edited by Xosen; 09-04-2012 at 12:38 PM.
Xosen is offline   Reply With Quote