В сообщении от Thursday 19 June 2008 00:22:37 Dennis Cote написал(а): > Alexey Pechnikov wrote: > > I'm replicating my database using sqlite dump and load or sql queries. > > I'm not sure that rowid is not different after that. > > If you assign each row an id (and even better make it an integer primary > key) and use those id columns to link related records then all your > links will survive across a dump and reload sequence. > > However, that shouldn't matter for the a single session with a loaded > database. Your "other question" is returning timestamp based on some > criteria, it could simply return a rowid instead of a timestamp. The > rowid is valid for the entire session with the database. > > > Can I do it from tcl? And how use index? > > I'm not sure how you handle floating point values in TCL since it is > typeless. It may not be possible to avoid the conversions. This is even > more reason to use ranges to locate records by time, and rowids to > locate specific records.
I have same database on host A and host B. On _both_ hosts I can insert/update/delete/select rows and periodically synchronize databases. CREATE TABLE photos ( name TEXT NOT NULL, filename TEXT NOT NULL, hostname TEXT NOT NULL DEFAULT 'A', save_date REAL COLLATE BINARY, update_date REAL COLLATE BINARY, delete_date REAL COLLATE BINARY ); CREATE TRIGGER photos_delete before delete on photos begin update photos set delete_date = julianday('now') where rowid=old.rowid and delete_date IS NULL; select RAISE (IGNORE); end; CREATE TRIGGER photos_insert after insert on photos begin update photos set save_date = coalesce(save_date, julianday('now')) where rowid=new.rowid; end; CREATE TRIGGER photos_update after update on photos begin update photos set update_date = julianday('now') where rowid=old.rowid; end; For replication I can select all rows updated by selected period and send it to other hosts. ROWID can duplicate on host A and host B for different rows. But the chances of timestamp unique are good. So, I select item by save_date form host A or host B equally. P.S. Yes, multy-master replication is very complex but very helpfull... I try use simple way. Are exists any better choices? _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users