using System; using System.Collections.Generic; using System.Text; using Scimore.Data.ScimoreClient; namespace varioustest { class Program { static void Main(string[] args) { ScimoreConnection cn = new ScimoreConnection("Data Source=localhost; Port=1000;"); cn.Open(); ScimoreTableSynchronize sync = new ScimoreTableSynchronize(); if(sync.Synchronize(cn, "127.0.0.1:999","test.testm2","test.testm2",null)) { MergeConflict c; while( (c = sync.ReadNextConflict()) != null ) { //c.Resolve(ScimoreMergeType.AUTO); // changes from publisher always wins //continue; int id; int amount1; int amount2; int amount3; // read old values in subs ScimoreCommand cmd = new ScimoreCommand(); cmd.Connection = cn; cmd.CommandText = c.MakeSQL(0); // read old row in subscriber ScimoreDataReader r = cmd.ExecuteReader(); r.Read(); id = r.GetInt32(0); amount1 = r.GetInt32(1); cmd.CommandText = c.MakeSQL(1); // read new row in subsriber r = cmd.ExecuteReader(); r.Read(); amount2 = r.GetInt32(1); cmd.CommandText = c.MakeSQL(2); // read new row in publisher r = cmd.ExecuteReader(); r.Read(); amount3 = r.GetInt32(1); int delta = amount2 - amount1; int final = amount3 + delta; // execute on publisher c.ExecutePublisher(String.Format("update test.testm2 set v={0} where id={1}",final,id)); // execute on subscriber cmd.CommandText = String.Format("update test.testm2 set v={0} where id={1}",final,id); cmd.ExecuteNonQuery(); c.Resolve(ScimoreMergeType.CUSTOM); } } sync.Commit(); } } }