views:

41

answers:

1

Hello,

When I insert a row into a full-text search database declared like:

CREATE VIRTUAL TABLE foo USING fts3 (bar);

the SQLiteDatabase.insert() method returns an incorrect rowid. If the table is declared like:

CREATE TABLE foo (bar VARCHAR(10));

it returns the correct rowid value. The problem is when I query the database soon after the insert using the rowid returned from the method, the returned Cursor has no records. It works correctly for the first insert into the database only. For subsequent inserts, an incorrect rowid is returned.

Is there anything I need to do to get the correct rowid from the SQLiteDatabase.insert() method?

I'm using Android SDK version 2.1update1.

Thanks, Dan

A: 

From SQLite Full-Text Search:

Your table must contain at least 1 TEXT field.

PS: +1: I didn't know about Virtual Tables. Thanks.

Macarse
In SQLite, all FTS3 columns are of type TEXT. Type specifications for columns are ignored (http://www.sqlite.org/fts3.html#section_1_1).FTS3 is an implementation of virtual tables.
Dan
@user376859: Oh, good point. Did you check the sample code from the link?
Macarse