internal void ProcessDiffs(ArrayList tableList, XmlReader ssync)
{
DataTable tableBefore;
DataRow row;
int oldRowRecord;
int pos = -1;
int iSsyncDepth = ssync.Depth;
ssync.Read(); // pass the before node.
//SkipWhitespaces(ssync); for given scenario does not require this change, but in fact we should do it.
while (iSsyncDepth < ssync.Depth)
{
tableBefore = null;
string diffId = null;
oldRowRecord = -1;
// the diffgramm always contains sql:before and sql:after pairs
int iTempDepth = ssync.Depth;
diffId = ssync.GetAttribute(Keywords.DIFFID, Keywords.DFFNS);
bool hasErrors = ssync.GetAttribute(Keywords.HASERRORS, Keywords.DFFNS) == Keywords.TRUE;
oldRowRecord = ReadOldRowData(_dataSet, ref tableBefore, ref pos, ssync);
if (oldRowRecord == -1)
continue;
if (tableBefore == null)
throw ExceptionBuilder.DiffgramMissingSQL();
row = (DataRow)tableBefore.RowDiffId[diffId];
if (row != null)
{
row._oldRecord = oldRowRecord;
tableBefore._recordManager[oldRowRecord] = row;
}
else
{
row = tableBefore.NewEmptyRow();
tableBefore._recordManager[oldRowRecord] = row;
row._oldRecord = oldRowRecord;
row._newRecord = oldRowRecord;
tableBefore.Rows.DiffInsertAt(row, pos);
row.Delete();
if (hasErrors)
tableBefore.RowDiffId[diffId] = row;
}
}
return;
}