2009/8/29 Wanadoo Hartwig <hartwig.wiesm...@wanadoo.nl>:
> The largest and last row id is 4. Why is SQLite returning 5? I think
> it has to do with the FTS3 module but still the trigger statement
> should shield the row ids from the trigger statement, or?
> Hartwig

CREATE TABLE Simple (ID integer primary key, Name text);
CREATE TABLE SimpleFTS (Name);
CREATE TRIGGER DeleteTrigger AFTER DELETE ON Simple FOR EACH ROW
   BEGIN
   DELETE FROM SimpleFTS WHERE (rowid=OLD.ID);
   END;
CREATE TRIGGER InsertTrigger AFTER INSERT ON Simple FOR EACH ROW
   BEGIN
   INSERT INTO SimpleFTS (rowid,Name) VALUES(NEW.ID,NEW.Name);
   END;
INSERT INTO Simple (Name) VALUES('one');
INSERT INTO Simple (Name) VALUES('two');
DELETE FROM Simple WHERE (ID = 1);
INSERT INTO Simple (Name) VALUES('three');
SELECT * FROM Simple;
2|two
3|three
SELECT last_insert_rowid() FROM Simple;
3
3

Perfect.

sqlite> CREATE VIRTUAL TABLE SimpleFTS USING FTS3 (Name);
SQL error: no such module: FTS3

What's FTS3? http://dotnetperls.com/sqlite-fts3 ?

<cite>Virtual tables are a new feature in SQLite (currently still only
available from the development version on CVS)</cite>
-- 
Kit
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to