Skip to content

Commit

Permalink
390:MDataTable AcceptChange 修正无主键时的的批量更新(2016-10-14)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyq1162 committed Oct 14, 2016
1 parent 072c96b commit 91f85ea
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
//
// 可以指定所有这些值,也可以使用“修订号”和“内部版本号”的默认值,
// 方法是按如下所示使用“*”:
[assembly: AssemblyVersion("5.6.6.4")]
[assembly: AssemblyFileVersion("5.6.6.4")]
[assembly: AssemblyVersion("5.6.6.5")]
[assembly: AssemblyFileVersion("5.6.6.5")]
10 changes: 5 additions & 5 deletions Table/MDataTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ public string ToJson(bool addHead, bool addSchema, RowOp rowOp)
{
return ToJson(addHead, addSchema, rowOp, false);
}

public string ToJson(bool addHead, bool addSchema, RowOp rowOp, bool isConvertNameToLower)
{
return ToJson(addHead, addSchema, rowOp, isConvertNameToLower, EscapeOp.Default);
Expand Down Expand Up @@ -1666,14 +1666,14 @@ public MDataTable Pivot(string rowName, string colName, string valueName)
}
#endregion


internal void Load(MDataTable dt)
//给MDataTableBatchAction的批量更新使用。
internal void Load(MDataTable dt, MCellStruct primary)
{
if (dt == null || dt.Rows.Count == 0)
{
return;
}
string pkName = Columns.FirstPrimary.ColumnName;
string pkName = primary != null ? primary.ColumnName : Columns.FirstPrimary.ColumnName;
int i1 = Columns.GetIndex(pkName);
MDataRow rowA, rowB;

Expand All @@ -1683,7 +1683,7 @@ internal void Load(MDataTable dt)
rowB = dt.FindRow(pkName + "='" + rowA[i1].strValue + "'");
if (rowB != null)
{
rowA.LoadFrom(rowB);
rowA.LoadFrom(rowB,RowOp.IgnoreNull, false);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Table/MDataTableBatchAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ internal bool BulkCopyUpdate()
#region 核心逻辑
string whereIn = SqlCreate.GetWhereIn(keyColumn, dt.GetColumnItems<string>(columnName, BreakOp.NullOrEmpty, true), action.DalType);
MDataTable dtData = action.Select(whereIn);//获取远程数据。
dtData.Load(dt);//重新加载赋值。
dtData.Load(dt, keyColumn);//重新加载赋值。
action.IsIgnoreDeleteField = true;//处理如果存在IsDeleted,会被转Update(导致后续无法Insert)、外层也有判断,不会进来。
result = action.Delete(whereIn);
action.IsIgnoreDeleteField = false;
Expand Down
3 changes: 2 additions & 1 deletion 更新记录.txt
Original file line number Diff line number Diff line change
Expand Up @@ -602,4 +602,5 @@
386��AutoCache��JsonHelper����Escape���ԡ�MDataTable����ToJson���أ�������\n��ת���滻��2016-10-09)
387��MDataTable ToJson ����null�����ݣ�Ĭ����� xx:null ֵ��2016-10-09)
388��Oracle(DBTool.GetTables) ���Ӷ���ͼ�Ĺ��ˣ�2016-10-10)
389��JsonHelper ����ʵ��Ƕ�׵����⡢ͬʱ���Ӷ������֧�֣�2016-10-14)
389��JsonHelper ����ʵ��Ƕ�׵����⡢ͬʱ���Ӷ������֧�֣�2016-10-14)
390��MDataTable AcceptChange ����������ʱ�ĵ��������£�2016-10-14)

0 comments on commit 91f85ea

Please sign in to comment.