开发者

SQLite3 fts3 AUTOINCREMENT not working

开发者 https://www.devze.com 2023-02-25 12:26 出处:网络
I am trying to create a virtual table in sqlite3 using fts3 and having a column as autoincrement but when inserting values, the column is not getting populated.

I am trying to create a virtual table in sqlite3 using fts3 and having a column as autoincrement but when inserting values, the column is not getting populated. Code:

CREATE VIRTUAL TABLE contact
USING fts4(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT);

WHen inserting : insert into contact (name) values ('abc') the 'id' field is not开发者_StackOverflow getting incremented and the data in the table looks only

|abc

Is autoincrement not supported in fts3 of sqlite3 ?

Regards,

John


I found the answer to this question in another question here

The short answer is to use the column "rowid" (Special column) for id's of fts3 tables. Not sure if you can reference the rowid column as i haven't tried that.

Hope this solves your problem. :)


When creating an FTS 'Virtual Table' it ignores everything but the column names (e.g. auto increment, primary key, unique, and even Integer). Everything to an FTS table is just text. It reads those keywords in without error, but they are just 'sugary syntax' per the documentation.

http://www.sqlite.org/fts3.html

0

精彩评论

暂无评论...
验证码 换一张
取 消