2011/4/4 Nico Williams <n...@cryptonector.com>:
> You're missing something: FTS4 is a virtual table

In triggers code we can't know about virtual tables! So in triggers we
may get wrong results?..

As example (this _does not_ work now):

CREATE TRIGGER view_job_update instead of update on view_job
begin
  insert into job_record
(record_version,user_id,id,users,routes,forms,ts_from,ts_to,name,state)
    values (OLD.record_version+1, NEW.user_id, OLD.id, NEW.users,
NEW.routes, NEW.forms, NEW.ts_from, NEW.ts_to, NEW.name, NEW.state);
  insert into job (id,current_id,ts,ts_from,ts_to,name)
    select id,rowid,ts,ts_from,ts_to,name from job_record where
rowid=last_insert_rowid();
  delete from job_fts where rowid=last_insert_rowid();
  insert into job_fts (rowid,задание,дата,автор,состояние)
    select id,name,date('now','localtime'),user,state from view_job
where id=last_insert_rowid();
end;

-- 
Best regards, Alexey Pechnikov.
http://pechnikov.tel/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to