Skip to content

Commit

Permalink
- 优化 Update 无字段时不做任何处理;
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Dec 1, 2023
1 parent 5f01fbd commit 60d3292
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions FreeSql/Internal/CommonProvider/DeleteProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public void ToSqlFetch(Action<StringBuilder> fetch)
_tableRule = old => name;
sb.Clear().Append("DELETE FROM ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(newwhere);
_interceptSql?.Invoke(sb);
fetch(sb);
if (sb.Length > 0) fetch(sb);
}
_tableRule = oldTableRule;
return;
Expand Down Expand Up @@ -240,7 +240,7 @@ async public Task ToSqlFetchAsync(Func<StringBuilder, Task> fetchAsync)
_tableRule = old => name;
sb.Clear().Append("DELETE FROM ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(newwhere);
_interceptSql?.Invoke(sb);
await fetchAsync(sb);
if (sb.Length > 0) await fetchAsync(sb);
}
_tableRule = oldTableRule;
return;
Expand Down
10 changes: 7 additions & 3 deletions FreeSql/Internal/CommonProvider/UpdateProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ public void ToSqlFetch(Action<StringBuilder> fetch)
{
var sb1 = new StringBuilder();
ToSqlExtension110(sb1, false);
fetch(sb1);
if (sb1.Length > 0) fetch(sb1);
return;
}
if (_where.Length == 0) return;
Expand Down Expand Up @@ -1035,7 +1035,7 @@ async public Task ToSqlFetchAsync(Func<StringBuilder, Task> fetchAsync)
{
var sb1 = new StringBuilder();
ToSqlExtension110(sb1, false);
await fetchAsync(sb1);
if (sb1.Length > 0) await fetchAsync(sb1);
sb1.Clear();
return;
}
Expand Down Expand Up @@ -1126,7 +1126,11 @@ public virtual void ToSqlExtension110(StringBuilder sb, bool isAsTableSplited)
++colidx;
}
}
if (colidx == 0) return;
if (colidx == 0)
{
sb.Clear();
return;
}

}
else if (_source.Count > 1)
Expand Down

0 comments on commit 60d3292

Please sign in to comment.