Browse Source

Oracle 达梦 Update Join

pull/32/head
sunkaixuan 2 years ago
parent
commit
005caf242f
  1. 11
      Src/Asp.Net/SqlSugar/Realization/Dm/SqlBuilder/DmUpdateBuilder.cs
  2. 12
      Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleUpdateBuilder.cs

11
Src/Asp.Net/SqlSugar/Realization/Dm/SqlBuilder/DmUpdateBuilder.cs

@ -7,6 +7,17 @@ namespace SqlSugar
{
public class DmUpdateBuilder : UpdateBuilder
{
protected override string GetJoinUpdate(string columnsString, ref string whereString)
{
var joinString = $" {Builder.GetTranslationColumnName(this.TableName)} {Builder.GetTranslationColumnName(this.ShortName)} ";
foreach (var item in this.JoinInfos)
{
joinString += $"\r\n USING {Builder.GetTranslationColumnName(item.TableName)} {Builder.GetTranslationColumnName(item.ShortName)} ON {item.JoinWhere} ";
}
var tableName = joinString + "\r\n ";
var newTemp = SqlTemplate.Replace("UPDATE", "MERGE INTO").Replace("SET", "WHEN MATCHED THEN \r\nUPDATE SET");
return string.Format(newTemp, tableName, columnsString, whereString);
}
protected override string TomultipleSqlString(List<IGrouping<int, DbColumnInfo>> groupList)
{
StringBuilder sb = new StringBuilder();

12
Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleUpdateBuilder.cs

@ -116,7 +116,17 @@ namespace SqlSugar
}
}
}
protected override string GetJoinUpdate(string columnsString, ref string whereString)
{
var joinString = $" {Builder.GetTranslationColumnName(this.TableName)} {Builder.GetTranslationColumnName(this.ShortName)} ";
foreach (var item in this.JoinInfos)
{
joinString += $"\r\n USING {Builder.GetTranslationColumnName(item.TableName)} {Builder.GetTranslationColumnName(item.ShortName)} ON {item.JoinWhere} ";
}
var tableName = joinString + "\r\n ";
var newTemp = SqlTemplate.Replace("UPDATE", "MERGE INTO").Replace("SET", "WHEN MATCHED THEN \r\nUPDATE SET");
return string.Format(newTemp, tableName, columnsString, whereString);
}
#region Helper
public bool IsUppper
{

Loading…
Cancel
Save