mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 完善 IUpdate.SetSource 组合主键的数据更新单元测试;
This commit is contained in:
@ -48,6 +48,29 @@ namespace FreeSql.Tests.Odbc.Dameng
|
||||
|
||||
sql = update.SetSource(items).Set(a => a.CreateTime, new DateTime(2020, 1, 1)).ToSql().Replace("\r\n", "");
|
||||
Assert.Equal("UPDATE \"TB_TOPIC\" SET \"CREATETIME\" = to_timestamp('2020-01-01 00:00:00.000000','YYYY-MM-DD HH24:MI:SS.FF6') WHERE (\"ID\" IN (1,2,3,4,5,6,7,8,9,10))", sql);
|
||||
|
||||
if (g.dameng.Select<ts_source_mpk>().Where(a => a.id1 == 1 && a.id2 == 7).Any() == false)
|
||||
g.dameng.Insert(new ts_source_mpk { id1 = 1, id2 = 7 }).ExecuteAffrows();
|
||||
if (g.dameng.Select<ts_source_mpk>().Where(a => a.id1 == 1 && a.id2 == 8).Any() == false)
|
||||
g.dameng.Insert(new ts_source_mpk { id1 = 1, id2 = 8 }).ExecuteAffrows();
|
||||
|
||||
sql = g.dameng.Update<ts_source_mpk>().SetSource(new[] {
|
||||
new ts_source_mpk { id1 = 1, id2 = 7, xx = "a1" },
|
||||
new ts_source_mpk { id1 = 1, id2 = 8, xx = "b122" }
|
||||
}).NoneParameter().ToSql().Replace("\r\n", "");
|
||||
g.dameng.Update<ts_source_mpk>().SetSource(new[] {
|
||||
new ts_source_mpk { id1 = 1, id2 = 7, xx = "a1" },
|
||||
new ts_source_mpk { id1 = 1, id2 = 8, xx = "b122" }
|
||||
}).NoneParameter().ExecuteAffrows();
|
||||
var testlist = g.dameng.Select<ts_source_mpk>().ToList();
|
||||
}
|
||||
public class ts_source_mpk
|
||||
{
|
||||
[Column(IsPrimary = true)]
|
||||
public int id1 { get; set; }
|
||||
[Column(IsPrimary = true)]
|
||||
public int id2 { get; set; }
|
||||
public string xx { get; set; }
|
||||
}
|
||||
[Fact]
|
||||
public void IgnoreColumns()
|
||||
|
Reference in New Issue
Block a user