- 增加 ISelect.InsertInto 将查询转换为 INSERT INTO t1 SELECT ... FROM t2 执行插入;#469

This commit is contained in:
28810
2020-10-16 22:01:00 +08:00
parent fc47407fba
commit acf26ecbef
46 changed files with 638 additions and 191 deletions

View File

@ -105,6 +105,11 @@ namespace FreeSql.Tests.MySqlConnector
Assert.Equal(1, g.mysql.Insert<TestEnumInsertTb>().AppendData(new TestEnumInsertTb { type = TestEnumInserTbType.sum211 }).ExecuteAffrows());
Assert.Equal(1, g.mysql.Insert<TestEnumInsertTb>().AppendData(new TestEnumInsertTb { type = TestEnumInserTbType.sum211 }).NoneParameter().ExecuteAffrows());
Assert.Equal(10, g.mysql.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
{
Title = a.Title
}));
}
[Fact]
public void ExecuteIdentity()

View File

@ -177,6 +177,11 @@ INTO ""TB_TOPIC_INSERT""(""CLICKS"") VALUES(900)
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
Assert.Equal(10, g.dameng.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
{
Title = a.Title
}));
}
[Fact]
public void ExecuteIdentity()

View File

@ -215,6 +215,11 @@ UNION ALL
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
Assert.Equal(10, insert.NoneParameter().AppendData(items).ExecuteAffrows());
Assert.Equal(10, g.firebird.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
{
Title = a.Title
}));
}
[Fact]
public void ExecuteIdentity()

View File

@ -89,6 +89,11 @@ namespace FreeSql.Tests.KingbaseES
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
Assert.Equal(10, g.kingbaseES.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
{
Title = a.Title
}));
}
[Fact]
public void ExecuteIdentity()

View File

@ -92,6 +92,11 @@ namespace FreeSql.Tests.MsAccess
//items = Enumerable.Range(0, 9989).Select(a => new Topic { Title = "newtitle" + a, CreateTime = DateTime.Now }).ToList();
//Assert.Equal(9989, g.msaccess.Insert<Topic>(items).ExecuteAffrows());
Assert.Equal(10, g.msaccess.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
{
Title = a.Title
}));
}
[Fact]
public void ExecuteIdentity()

View File

@ -106,6 +106,11 @@ namespace FreeSql.Tests.MySql
Assert.Equal(1, g.mysql.Insert<TestEnumInsertTb>().AppendData(new TestEnumInsertTb { type = TestEnumInserTbType.sum211 }).ExecuteAffrows());
Assert.Equal(1, g.mysql.Insert<TestEnumInsertTb>().AppendData(new TestEnumInsertTb { type = TestEnumInserTbType.sum211 }).NoneParameter().ExecuteAffrows());
Assert.Equal(10, g.mysql.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
{
Title = a.Title
}));
}
[Fact]
public void ExecuteIdentity()

View File

@ -177,6 +177,11 @@ INTO ""TB_TOPIC_INSERT""(""CLICKS"") VALUES(:Clicks_9)
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
Assert.Equal(10, g.oracle.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
{
Title = a.Title
}));
}
[Fact]
public void ExecuteIdentity()

View File

@ -89,6 +89,11 @@ namespace FreeSql.Tests.PostgreSQL
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
Assert.Equal(10, g.pgsql.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
{
Title = a.Title
}));
}
[Fact]
public void ExecuteIdentity()

View File

@ -89,6 +89,11 @@ namespace FreeSql.Tests.ShenTong
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
Assert.Equal(10, g.shentong.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
{
Title = a.Title
}));
}
[Fact]
public void ExecuteIdentity()

View File

@ -100,6 +100,11 @@ namespace FreeSql.Tests.SqlServer
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
Assert.Equal(10, insert.AppendData(items).NoneParameter().ExecuteAffrows());
Assert.Equal(10, g.sqlserver.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
{
Title = a.Title
}));
//items = Enumerable.Range(0, 9989).Select(a => new Topic { Title = "newtitle" + a, CreateTime = DateTime.Now }).ToList();
//Assert.Equal(9989, g.sqlserver.Insert<Topic>(items).ExecuteAffrows());

View File

@ -89,6 +89,11 @@ namespace FreeSql.Tests.Sqlite
Assert.Equal(1, insert.AppendData(items.First()).ExecuteAffrows());
Assert.Equal(10, insert.AppendData(items).ExecuteAffrows());
Assert.Equal(10, g.sqlite.Select<Topic>().Limit(10).InsertInto(null, a => new Topic
{
Title = a.Title
}));
}
[Fact]
public void ExecuteIdentity()