Hi List.
What i need is a Table which is quite simple
CRATE TABLE entry (
id INTEGER,
parent_id INTEGER,
name TEXT,
PRIMARY KEY(parent_id, name)
);
Now the problem is, i want the id get incremented by every INSERT. I tried
some things like AUTOINCREMENT (which has no effect at all, since id is
not a primary key) and UNIQUE.
Right now i see only one solution for this.
1. create a trigger on the INSERT of the entry table. this trigger will
INSERT a row into a second table, which has the following scheme
CREATE TABLE sequence (
id INTEGER PRIMARY KEY
);
2. create another trigger on the INSERT of the sequence table. this
trigger will UPDATE the id in the entry table and set the entry.id to the
new generated sequence.id
Don't know if this will actually work, i didn't try it by now. I hope
there is an easier solution.
Thanks in advance
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/