void DoUpdatesForTable(SoodaObject obj, TableInfo table, bool isPrecommit) { if (table.IsDynamic) { // For dynamic fields do DELETE+INSERT instead of UPDATE. // This is because if a dynamic field is added to an existing object, there is no dynamic field row to update. // Another reason is that we never store null dynamic fields in the database - an INSERT will be ommitted in this case. DoDeletesForTable(obj, table); DoInsertsForTable(obj, table, true); return; } StringBuilder builder = new StringBuilder(500); builder.Append("update "); builder.Append(table.DBTableName); builder.Append(" set "); ArrayList par = new ArrayList(); bool anyChange = false; foreach (FieldInfo fi in table.Fields) { if (obj.IsFieldDirty(fi.ClassUnifiedOrdinal)) { if (anyChange) { builder.Append(", "); } FieldEquals(fi, GetFieldValue(obj, fi, isPrecommit), builder, par); anyChange = true; } } if (!anyChange) { return; } DoWithWhere(obj, builder, par, false); }
void DoUpdatesForTable(SoodaObject obj, TableInfo table, bool isPrecommit) { if (table.IsDynamic) { // For dynamic fields do DELETE+INSERT instead of UPDATE. // This is because if a dynamic field is added to an existing object, there is no dynamic field row to update. // Another reason is that we never store null dynamic fields in the database - an INSERT will be ommitted in this case. DoDeletesForTable(obj, table); DoInsertsForTable(obj, table, true); return; } StringBuilder builder = new StringBuilder(500); builder.Append("update "); builder.Append(table.DBTableName); builder.Append(" set "); ArrayList par = new ArrayList(); bool anyChange = false; foreach (FieldInfo fi in table.Fields) { if (obj.IsFieldDirty(fi.ClassUnifiedOrdinal)) { if (anyChange) builder.Append(", "); FieldEquals(fi, GetFieldValue(obj, fi, isPrecommit), builder, par); anyChange = true; } } if (!anyChange) return; DoWithWhere(obj, builder, par, false); }
public static bool IsFieldDirty(SoodaObject theObject, int tableNumber, int fieldOrdinal) { return theObject.IsFieldDirty(fieldOrdinal); }
public static bool IsFieldDirty(SoodaObject theObject, int tableNumber, int fieldOrdinal) { return(theObject.IsFieldDirty(fieldOrdinal)); }