At 13:05 04/08/2007 +0000, [EMAIL PROTECTED] wrote:
2.8.x support triggers.
Good to know :-) So I don't have to upgrade everyone to 3.x then. I did
try to create a self-incrementing timestamp column with 2.8.x but it
doesn't seem to be handle more than one such column:
============
C:\sqlite>sqlite database.db
SQLite version 2.8.13
Enter ".help" for instructions
sqlite> create table mytable (id INTEGER AUTO PRIMARY KEY, name
VARCHAR(50), timestamp INTEGER AUTO);
sqlite> insert into mytable values (NULL,'Bart',NULL);
sqlite> select * from mytable;
1|Bart|
============
So, I guess the solution is to write a trigger. Problem is, I've never used
triggers before, so I don't really know how to get around to fetching the
previous value of a timestamp column and increment it whenever a record is
updated:
CREATE TRIGGER update_timestamp UPDATE ON mytable
BEGIN
UPDATE mytable SET timestamp = old.timestamp + 1;
END;
Thanks for any tip
G.
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------