If you can add a field that you can put a source string in you can do this:
create table dml (dmlstuff text, source text); create trigger before insert on dml for each row when new.source not like 'p2p' begin select raise(rollback,'Not p2p source'); end; sqlite> insert into dml values('dml1','p2p'); sqlite> select * from dml; dml1|p2p sqlite> insert into dml values('dml2','other'); Error: Not p2p source sqlite> select * from dml; dml1|p2p Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Frans Knibbe [frans.kni...@geodan.nl] Sent: Friday, September 02, 2011 4:21 AM To: sqlite-users@sqlite.org Subject: EXT :[sqlite] Track DML (from certain clients only) Hello all, I am trying to use SQLite as a data store for a P2P (peer to peer) system. There could be several applications reading from and writing to the database. One of these is the P2P module. It reads local additions to the database (only INSERTs are allowed, rows are never DELETEd or UPDATEd) and distributes to to other peers. The P2P module also insert data it receives from other peers. I would like to be able to distinguish data that has been written by the P2P module from data that has been written by other local applications. The latter data need to be handled by the P2P module, the former not (otherwise the data would de replicated over and over again). I thought I could make use of a table that stores all DML statements from all applications except the P2P module. The P2P module could use that table as a task list, and periodically check if there is any unhandled DML in that table. All other applications could be made to write their DML to that table, but that is not very elegant. I would rather like this to be done automatically. Is it possible to create a process (a trigger maybe) that monitors all DML statements and writes them to a table, except when the statement is issued by a specific application? Or are there smarter ways of doing what I am trying to do? Thanks in advance! Frans _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users