Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get row ID of an SQLite FTS3 table

I have created an SQLite FTS3 table that I am using within the Android development platform (target is 2.2 and minVersion is 8). For example, I created the table as follows:

create virtual table person using fts3(first,last);

I know that when I insert data into this table, I long is returned, which is the row ID of the record inserted. How do I get the row ID from this table? If I perform:

select * from person

I get -1 for Cursor.getColumnColumnIndex("rowid");. Also, Cursor.getColumnNames() only shows the two columns ('first' and 'last') and not the 'rowid'. Any suggestikns on how to solve this problem?

like image 744
jake Avatar asked Apr 09 '11 09:04

jake


People also ask

How do I find the row ID in SQLite?

The rowid of a rowid table can be accessed (or changed) by reading or writing to any of the "rowid" or "oid" or "_rowid_" columns.

What is FTS3?

FTS3 and FTS4 are SQLite virtual table modules that allows full-text searches to be performed on a set of documents. An FTS entity table always has a column named rowid that is the equivalent of an INTEGER PRIMARY KEY index.

What is FTS SQLite?

FTS5 is an SQLite virtual table module that provides full-text search functionality to database applications.


1 Answers

Try using:

select rowid,* from person

Rowid is a hidden field and is not included in "*".

like image 189
compcentral Avatar answered Oct 18 '22 00:10

compcentral