approcah for selective synchronization
682067Feb 24 2009 — edited Feb 27 2009hi,
In my application I have a senario in which I want to restrict the client to update or add a new row to a tables with a condition that the user can only update record if the primary key of the particular table is present in one check_out table.
Here i have two tables EMP_TABLE and CHECK_OUT table.
Now I will bring only the data present in the check_out table to my client.For this my publication item consist of the following query
SELECT FROM MASTER.EMP_TABLE WHERE ID IN(SELECT ID FROM MASTER.CHECK_OUT)*
It is 'server wins'
In the client database the table emp_table is created with data present in the check_out table.During synchronization I want to restrict the client to update/add any row on the server which is not present in the check_out table.
My sync program is as follows,
// Performing Synchronization
try{
SyncOption syncOpt = new SyncOption();
syncOpt.setUser(SyncUserName);
syncOpt.setPassword(SyncPassword);
syncOpt.setSyncParam("noNewPubs");
syncOpt.setTransportParam(TransportParam);
syncOpt.setTransportType(TransportType);
syncOpt.save();
Sync sc = new Sync(syncOpt);
syncOpt.setSyncFlag("","",(short)0);
syncOpt.setSyncFlag("EMP_PUB","EMP_TABLE",(short)1);
syncOpt.load();
sc.doSync();
out.println("Synchronization is performed>>>>>>>>>>>>>>>>>>>>>>>>>");
}catch(SyncException ex){
out.println("Error Code during Synchronization>>>>>>>>>>" + ex.getErrorCode());
out.println("Error Message during Synchronization>>>>>>>" + ex.getErrorMessage());
ex.printStackTrace();
}
When I execute this program the data from my client gets synchronized, however my CHECK_OUT table does not restrict me from updating data in EMP_TABLE whose id is not present in CHECK_OUT table.
Please suggest an approach to solve this problem.
Thanks!!!