android - How can I create a trigger between normal table and fts3 table? -
i have been having issues switching between fts3 tables , normal database tables. application simple , allows user add together contacts database , can search contacts match search query (why used fts table) , result displayed on list onitemclicklistener. when click item, error. have traced error database (if utilize normal database works, if utilize fts doesn't). have decided utilize both types of databases , wondering if show me how trigger created sync databases.
my first database contact (database name) , table called contacts. sec database table contacts_fts. searching col_name, need in contacts_fts table? wondering if check see if trigger valid?
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 " + col_id + " = old.col_id;" + " end;";
i think alternative "external content" table available fts4 , not fts3.
external content fts4 tables
try using fts4 table instead of fts3.
android database triggers fts3
No comments:
Post a Comment