Re: [sqlite] Are triggers the best way to store the modification time?

2010-09-08 Thread Drake Wilson
Quoth Oliver Schneider , on 2010-09-09 00:12:43 +: > > Can't you just include the modified value within your UPDATE or > > INSERT statement? Or is the modified column in a separate table? > > Guess I'll do that. SQLite is just so convenient even from command line, > that I thought it'd be bett

Re: [sqlite] Are triggers the best way to store the modification time?

2010-09-08 Thread Oliver Schneider
On 2010-09-09 00:15, Igor Tandetnik wrote: > This updates all the rows in the table, not just the one for which the > trigger was fired. You want something along the lines of > > UPDATE file SET modified=julianday('now') > where file.rowid = new.rowid; Ouch. Thanks for shedding some light on this

Re: [sqlite] Are triggers the best way to store the modification time?

2010-09-08 Thread Igor Tandetnik
Oliver Schneider wrote: > Hmm, strange. These are the triggers I used: > > CREATE TRIGGER IF NOT EXISTS file_change AFTER UPDATE OF hash,name,path > ON file > BEGIN >UPDATE file SET modified=julianday('now'); > END; This updates all the rows in the table, not just the one for which the tri

Re: [sqlite] Are triggers the best way to store the modification time?

2010-09-08 Thread Oliver Schneider
Thanks for your reply. > Can't you just include the modified value within your UPDATE or > INSERT statement? Or is the modified column in a separate table? Guess I'll do that. SQLite is just so convenient even from command line, that I thought it'd be better to automate that part to figure out if

Re: [sqlite] Are triggers the best way to store the modification time?

2010-09-07 Thread Nick Shaw
Oliver Schneider wrote: > I'm having a table of file names along with hashes and so on. In order > to make sure that we keep a record, I had put a trigger on UPDATE and > INSERT which would set the column 'modified' (REAL, Julian day) to the > time of the change. However, this slows down any INSERT

[sqlite] Are triggers the best way to store the modification time?

2010-09-07 Thread Oliver Schneider
Hi, I'm having a table of file names along with hashes and so on. In order to make sure that we keep a record, I had put a trigger on UPDATE and INSERT which would set the column 'modified' (REAL, Julian day) to the time of the change. However, this slows down any INSERTs (even those seemingly unr