On Jul 1, 2012, at 9:11 AM, Navaneeth.K.N wrote:

> Now, repeating a "pattern" and "id" combination is an error to me. There
> should be always one "pattern" to "id" combination. If this was not a
> virtual table, I'd have solved the problem by creating a primary key on
> both "pattern" and "id". But this trick is not working on FTS tables.

Perhaps you could try the following setup:

(1) Create a regular table to hold your unique patterns, using an unique 
constraint

create table foo
( 
  id integer not null constraint foo_pk primary key,
  bar text,
  constraint  foo_uk unique( bar ) 
)

(2) Create a FTS table with external content [1] to search the above

create virtual table foo_bar using fts4
(
  content = "foo",
  bar text
)

That way the regular table provide an unique constraint, and the FTS the search.

As always, YMMV.


[1] http://www.sqlite.org/fts3.html#section_6_2_2
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to