Create Table Using FTS4 giving Error

149 views Asked by At

I found a nice query using MATCH keyword, but it requires fts4. So, I'm trying to create a Table using fts4 like below,

 static {
        mCreateEntries.add("CREATE TABLE " + Tables.LOCATION_DETAILS
                + " USING fts4(" + ConfigContract.LocationDetails.LOCATION_ID
                + " INTEGER NOT NULL,"
                + ConfigContract.LocationDetails.LANGUAGE_ID
                + " INTEGER NOT NULL,"
                + ConfigContract.LocationDetails.LOCATION_NAME
                + " TEXT NOT NULL" + ")");
}

But, I'm getting the below exception,

 java.lang.RuntimeException: Unable to get provider com.sample.database.Provider: android.database.sqlite.SQLiteException: near "USING": syntax error (code 1): , while compiling: CREATE TABLE location_details USING fts4(location_id INTEGER NOT NULL,language_id INTEGER NOT NULL,location_name TEXT NOT NULL)

Am I doing anything wrong? please advice me,

Thanks in advance.

1

There are 1 answers

0
CL. On BEST ANSWER

To use USING to create a virtual table, you have to use CREATE VIRTUAL TABLE:

    mCreateEntries.add("CREATE VIRTUAL TABLE " + Tables.LOCATION_DETAILS
            + " USING fts4(" + ...