0

TRIGGERを正しく作成していることを誰かが確認できるかどうか疑問に思っていました。検索を使用できるようにするために、通常のテーブルを FTS テーブルに同期しています。しかし、検索ごとに空のカーソルを取得しており、通常のデータベースでしか機能しないため、何らかの理由で FTS を単独で使用することはできません。

public static final String DATABASE_NAME = "CONTACT";
public static final String DATABASE_TABLE = "CONTACTS";
private static final String DATABASE_TABLE_FTS = "CONTACTS_FTS";
private static final int DATABASE_VERSION = 20;
private Context ourContext;
private DbHelper DBHelper;
private static SQLiteDatabase db;
private static final String DATABASE_CREATE = 
        "CREATE TABLE " + DATABASE_TABLE + " (" +
         COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
         COL_NAME + " TEXT NOT NULL, " + 
         COL_EMAIL + " TEXT NOT NULL, " +
         COL_CELL + " TEXT NOT NULL, " + 
         COL_ARRIVAL + " TEXT NOT NULL, " +
         COL_DEPARTURE + " TEXT NOT NULL, " + 
         COL_FLIGHT_NUMBER + " TEXT NOT NULL, " +
         COL_HOTEL_ROOM_NUMBER + " TEXT NOT NULL, " + 
         COL_EVENT1 + " TEXT NOT NULL, " +
         COL_EVENT2 + " TEXT NOT NULL, " + 
         COL_EVENT1_ROOM + " TEXT NOT NULL, " +
         COL_EVENT2_ROOM + " TEXT NOT NULL);";

private static final String DATABASE_CREATE_FTS = 
        "CREATE VIRTUAL TABLE " + DATABASE_TABLE_FTS + " USING fts3(" +
        "content=" + "\"CONTACTS\", " + 
        COL_NAME + ");";

private static final String Trigger = 
        "CREATE TRIGGER contacts_Trigger " + 
        "AFTER INSERT "+ "ON " + DATABASE_TABLE +
        " BEGIN " +
        "INSERT " + DATABASE_TABLE_FTS + " SET " + COL_NAME + " = new.COL_NAME WHERE " + COL_ID + " = old.COL_ID;" +
        " END;";
4

0 に答える 0