SqlDescription desc = obj.getDescription();
conn.setAutoCommit(false);
try {
for (int i=0; i < rows.size(); i++) {
SqlRow row = (SqlRow)rows.get(i);
ClientProperty oldRowProp = new ClientProperty(ReplicationConstants.OLD_CONTENT_ATTR, null, null, row.toXml("", false));
row.setAttribute(oldRowProp);
try {
I_Parser parser = new SqlInfoParser();
parser.init(this.info);
int ret = desc.update(conn, row, parser);
if (ret != 1)
throw new Exception("the number of updated entries is wrong '" + ret + "' but should be 1");
}
catch(Exception ex) {
log.info("exception when updating '" + row.toXml("") + " where description is '" + desc.toXml("") + "'");
throw ex;
}
try {
int ret = desc.delete(conn, row);
if (ret != 1)
throw new Exception("the number of deleted entries is wrong '" + ret + "' but should be 1");
}
catch(Exception ex) {
log.info("exception when deleting '" + row.toXml("") + " where description is '" + desc.toXml("") + "'");
throw ex;
}
try {
int ret = desc.insert(conn, row);
if (ret != 1)
throw new Exception("the number of inserted entries is wrong '" + ret + "' but should be 1");
}
catch(Exception ex) {
log.info("exception when inserting '" + row.toXml("") + " where description is '" + desc.toXml("") + "'");
throw ex;
}
}
Thread.sleep(this.sleepDelay);
conn.commit();