Head of trunk certainly fixes it ...

SQLite version 3.18.0 2017-03-15 19:11:29
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> select sqlite_source_id();
2017-03-15 19:11:29 
b1b1aa8b69aa80c83aec3380565f0b4ec0b6a6e033537becee098872da362e9a
sqlite> CREATE TABLE IF NOT EXISTS Foo(
   ...>     id_foo INTEGER PRIMARY KEY AUTOINCREMENT,
   ...>     bar TEXT
   ...>     );
sqlite>
sqlite> CREATE VIRTUAL TABLE IF NOT EXISTS FooFts
   ...> USING FTS4(bar);
sqlite>
sqlite> CREATE TRIGGER IF NOT EXISTS insert_fts
   ...> AFTER INSERT ON Foo
   ...> WHEN new.bar IS NOT NULL
   ...>     BEGIN
   ...>         INSERT INTO FooFts(rowid, bar) VALUES(new.id_foo, new.bar);
   ...>     END;
sqlite>
sqlite>
sqlite> BEGIN;
sqlite>     INSERT INTO Foo(id_foo) VALUES(NULL);
sqlite>     SELECT last_insert_rowid();
1
sqlite>     INSERT INTO Foo(id_foo) VALUES(NULL);
sqlite>     SELECT last_insert_rowid();
2
sqlite> COMMIT;
sqlite>     SELECT last_insert_rowid();
2
sqlite>
sqlite>     BEGIN;
sqlite>     INSERT INTO Foo(id_foo, bar) VALUES(NULL, "otter");
sqlite>     COMMIT;
sqlite>     SELECT last_insert_rowid();
3
sqlite>
sqlite> SELECT * FROM sqlite_sequence;
Foo|3
sqlite>
sqlite>

> -----Original Message-----
> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> On Behalf Of Richard Hipp
> Sent: Wednesday, 15 March, 2017 18:01
> To: SQLite mailing list
> Subject: Re: [sqlite] last_insert_rowid and FTS in 3.17
> 
> On 3/15/17, Hugo Beauzée-Luyssen <h...@beauzee.fr> wrote:
> > Hi, I'm having some issues with last_insert_rowid starting with 3.17
> > Basically it seems to be returning the row inserted by a trigger,
> > instead of the explicitly inserted row.
> 
> Please try the latest pre-release snapshot at
> https://www.sqlite.org/download.html and let us know whether or not it
> fixes your problem.
> --
> D. Richard Hipp
> d...@sqlite.org
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to