使用FTS4创建表给出错误

时间:2014-12-01 13:09:19

标签: android sqlite fts4

我使用 MATCH 关键字找到了一个不错的查询,但它需要fts4。所以,我正在尝试使用fts4创建一个表,如下所示,

 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" + ")");
}

但是,我得到了以下异常,

 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)

我做错了吗?请指教我,

提前致谢。

1 个答案:

答案 0 :(得分:1)

要使用USING创建虚拟表,您必须使用CREATE VIRTUAL TABLE

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