mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
内部 SQL 格式优化
This commit is contained in:
parent
8d11993e6c
commit
7471df5924
@ -125,6 +125,13 @@
|
|||||||
清空状态数据
|
清空状态数据
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:FreeSql.DbSet`1.RemoveAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})">
|
||||||
|
<summary>
|
||||||
|
根据 lambda 条件删除数据
|
||||||
|
</summary>
|
||||||
|
<param name="predicate"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
||||||
<summary>
|
<summary>
|
||||||
添加
|
添加
|
||||||
@ -479,5 +486,14 @@
|
|||||||
<param name="that"></param>
|
<param name="that"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
|
||||||
|
<summary>
|
||||||
|
批量注入 Repository,可以参考代码自行调整
|
||||||
|
</summary>
|
||||||
|
<param name="services"></param>
|
||||||
|
<param name="globalDataFilter"></param>
|
||||||
|
<param name="assemblies"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
@ -1077,12 +1077,12 @@ WHERE (((cast(a.`Id` as char)) in (SELECT b.`Title`
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb UNION ALLSELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb UNION ALL SELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -1004,12 +1004,12 @@ WHERE (((to_char(a.""ID"")) in (SELECT b.""TITLE""
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb UNION ALLSELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb UNION ALL SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -974,12 +974,12 @@ WHERE (((cast(a.[Id] as nvarchar)) in (SELECT b.[Title]
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb UNION ALLSELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb UNION ALL SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -969,12 +969,12 @@ WHERE ((((a.""ID"")::text) in (SELECT b.""TITLE""
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb UNION ALLSELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb UNION ALL SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -1088,12 +1088,12 @@ WHERE (((cast(a.`Id` as char)) in (SELECT b.`Title`
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb UNION ALLSELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb UNION ALL SELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -1005,12 +1005,12 @@ WHERE (((to_char(a.""ID"")) in (SELECT b.""TITLE""
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb UNION ALLSELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb UNION ALL SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -1064,12 +1064,12 @@ WHERE ((((a.""id"")::text) in (SELECT b.""title""
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.\"id\", a.\"clicks\", a.\"typeguid\", a.\"title\", a.\"createtime\" FROM \"tb_topic\" a) ftb UNION ALLSELECT * from (SELECT a.\"id\", a.\"clicks\", a.\"typeguid\", a.\"title\", a.\"createtime\" FROM \"tb_topic\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.\"id\", a.\"clicks\", a.\"typeguid\", a.\"title\", a.\"createtime\" FROM \"tb_topic\" a) ftb UNION ALL SELECT * from (SELECT a.\"id\", a.\"clicks\", a.\"typeguid\", a.\"title\", a.\"createtime\" FROM \"tb_topic\" a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"tb_topic\" a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM \"tb_topic\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"tb_topic\" a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM \"tb_topic\" a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -955,12 +955,12 @@ WHERE (((cast(a.[Id] as nvarchar(100))) in (SELECT b.[Title]
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb UNION ALLSELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb UNION ALL SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -1005,12 +1005,12 @@ WHERE (((to_char(a.""ID"")) in (SELECT b.""TITLE""
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb UNION ALLSELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb UNION ALL SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -975,12 +975,12 @@ WHERE (((cstr(a.[Id])) in (SELECT b.[Title]
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb UNION ALLSELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb UNION ALL SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -1124,12 +1124,12 @@ WHERE (((cast(a.`Id` as char)) in (SELECT b.`Title`
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb UNION ALLSELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb UNION ALL SELECT * from (SELECT a.`Id`, a.`Clicks`, a.`TypeGuid`, a.`Title`, a.`CreateTime` FROM `tb_topic` a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM `tb_topic` a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -1005,12 +1005,12 @@ WHERE (((to_char(a.""ID"")) in (SELECT b.""TITLE""
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb UNION ALLSELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb UNION ALL SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC22\" a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC22\" a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -1081,12 +1081,12 @@ WHERE ((((a.""id"")::text) in (SELECT b.""title""
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.\"id\", a.\"clicks\", a.\"typeguid\", a.\"title\", a.\"createtime\" FROM \"tb_topic\" a) ftb UNION ALLSELECT * from (SELECT a.\"id\", a.\"clicks\", a.\"typeguid\", a.\"title\", a.\"createtime\" FROM \"tb_topic\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.\"id\", a.\"clicks\", a.\"typeguid\", a.\"title\", a.\"createtime\" FROM \"tb_topic\" a) ftb UNION ALL SELECT * from (SELECT a.\"id\", a.\"clicks\", a.\"typeguid\", a.\"title\", a.\"createtime\" FROM \"tb_topic\" a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"tb_topic\" a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM \"tb_topic\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"tb_topic\" a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM \"tb_topic\" a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -1081,12 +1081,12 @@ WHERE ((((a.""ID"")::text) in (SELECT b.""TITLE""
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC\" a) ftb UNION ALLSELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC\" a) ftb UNION ALL SELECT * from (SELECT a.\"ID\", a.\"CLICKS\", a.\"TYPEGUID\", a.\"TITLE\", a.\"CREATETIME\" FROM \"TB_TOPIC\" a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC\" a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC\" a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM \"TB_TOPIC\" a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -1011,12 +1011,12 @@ WHERE (((cast(a.[Id] as nvarchar(100))) in (SELECT b.[Title]
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb UNION ALLSELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb UNION ALL SELECT * from (SELECT a.[Id], a.[Clicks], a.[TypeGuid], a.[Title], a.[CreateTime] FROM [tb_topic22] a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM [tb_topic22] a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -1001,12 +1001,12 @@ WHERE (((cast(a.""Id"" as character)) in (SELECT b.""Title""
|
|||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql().Replace("\r\n", "");
|
sql = query.ToSql().Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT a.\"Id\", a.\"Clicks\", a.\"TypeGuid\", a.\"Title\", a.\"CreateTime\" FROM \"tb_topic22\" a) ftb UNION ALLSELECT * from (SELECT a.\"Id\", a.\"Clicks\", a.\"TypeGuid\", a.\"Title\", a.\"CreateTime\" FROM \"tb_topic22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT a.\"Id\", a.\"Clicks\", a.\"TypeGuid\", a.\"Title\", a.\"CreateTime\" FROM \"tb_topic22\" a) ftb UNION ALL SELECT * from (SELECT a.\"Id\", a.\"Clicks\", a.\"TypeGuid\", a.\"Title\", a.\"CreateTime\" FROM \"tb_topic22\" a) ftb", sql);
|
||||||
query.ToList();
|
query.ToList();
|
||||||
|
|
||||||
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
query = select.AsTable((_, old) => old).AsTable((_, old) => old);
|
||||||
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
sql = query.ToSql("count(1) as1").Replace("\r\n", "");
|
||||||
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"tb_topic22\" a) ftb UNION ALLSELECT * from (SELECT count(1) as1 FROM \"tb_topic22\" a) ftb", sql);
|
Assert.Equal("SELECT * from (SELECT count(1) as1 FROM \"tb_topic22\" a) ftb UNION ALL SELECT * from (SELECT count(1) as1 FROM \"tb_topic22\" a) ftb", sql);
|
||||||
query.Count();
|
query.Count();
|
||||||
|
|
||||||
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
select.AsTable((_, old) => old).AsTable((_, old) => old).Max(a => a.Id);
|
||||||
|
@ -984,7 +984,7 @@ namespace FreeSql.Internal
|
|||||||
fsqlWhere.Invoke(fsql, new object[] { Expression.Lambda(fsqlManyWhereExp, fsqlWhereParam) });
|
fsqlWhere.Invoke(fsql, new object[] { Expression.Lambda(fsqlManyWhereExp, fsqlWhereParam) });
|
||||||
var sql2 = fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { "1" })?.ToString();
|
var sql2 = fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { "1" })?.ToString();
|
||||||
if (string.IsNullOrEmpty(sql2) == false)
|
if (string.IsNullOrEmpty(sql2) == false)
|
||||||
manySubSelectExpBoy = Expression.Call(manySubSelectExpBoy, manySubSelectWhereSql, Expression.Constant($"exists({sql2.Replace("\r\n", "\r\n\t")})"), Expression.Constant(null));
|
manySubSelectExpBoy = Expression.Call(manySubSelectExpBoy, manySubSelectWhereSql, Expression.Constant($"exists({sql2.Replace(" \r\n", " \r\n ")})"), Expression.Constant(null));
|
||||||
MethodInfo manySubSelectAggMethod = null;
|
MethodInfo manySubSelectAggMethod = null;
|
||||||
switch (exp3.Method.Name) //https://github.com/dotnetcore/FreeSql/issues/362
|
switch (exp3.Method.Name) //https://github.com/dotnetcore/FreeSql/issues/362
|
||||||
{
|
{
|
||||||
@ -1031,12 +1031,12 @@ namespace FreeSql.Internal
|
|||||||
case "Any":
|
case "Any":
|
||||||
var sql = fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { "1" })?.ToString();
|
var sql = fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { "1" })?.ToString();
|
||||||
if (string.IsNullOrEmpty(sql) == false)
|
if (string.IsNullOrEmpty(sql) == false)
|
||||||
return $"exists({sql.Replace("\r\n", "\r\n\t")})";
|
return $"exists({sql.Replace(" \r\n", " \r\n ")})";
|
||||||
break;
|
break;
|
||||||
case "Count":
|
case "Count":
|
||||||
var sqlCount = fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { "count(1)" })?.ToString();
|
var sqlCount = fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { "count(1)" })?.ToString();
|
||||||
if (string.IsNullOrEmpty(sqlCount) == false)
|
if (string.IsNullOrEmpty(sqlCount) == false)
|
||||||
return $"({sqlCount.Replace("\r\n", "\r\n\t")})";
|
return $"({sqlCount.Replace(" \r\n", " \r\n ")})";
|
||||||
break;
|
break;
|
||||||
case "Sum":
|
case "Sum":
|
||||||
case "Min":
|
case "Min":
|
||||||
@ -1047,7 +1047,7 @@ namespace FreeSql.Internal
|
|||||||
tscClone1._tables = fsqltables;
|
tscClone1._tables = fsqltables;
|
||||||
var sqlSum = fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { $"{exp3.Method.Name.ToLower()}({ExpressionLambdaToSql(exp3.Arguments.FirstOrDefault(), tscClone1)})" })?.ToString();
|
var sqlSum = fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { $"{exp3.Method.Name.ToLower()}({ExpressionLambdaToSql(exp3.Arguments.FirstOrDefault(), tscClone1)})" })?.ToString();
|
||||||
if (string.IsNullOrEmpty(sqlSum) == false)
|
if (string.IsNullOrEmpty(sqlSum) == false)
|
||||||
return $"({sqlSum.Replace("\r\n", "\r\n\t")})";
|
return $"({sqlSum.Replace(" \r\n", " \r\n ")})";
|
||||||
break;
|
break;
|
||||||
case "ToList":
|
case "ToList":
|
||||||
case "ToOne":
|
case "ToOne":
|
||||||
@ -1057,7 +1057,7 @@ namespace FreeSql.Internal
|
|||||||
tscClone2._tables = fsqltables;
|
tscClone2._tables = fsqltables;
|
||||||
var sqlFirst = fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { ExpressionLambdaToSql(exp3.Arguments.FirstOrDefault(), tscClone2) })?.ToString();
|
var sqlFirst = fsqlType.GetMethod("ToSql", new Type[] { typeof(string) })?.Invoke(fsql, new object[] { ExpressionLambdaToSql(exp3.Arguments.FirstOrDefault(), tscClone2) })?.ToString();
|
||||||
if (string.IsNullOrEmpty(sqlFirst) == false)
|
if (string.IsNullOrEmpty(sqlFirst) == false)
|
||||||
return $"({sqlFirst.Replace("\r\n", "\r\n\t")})";
|
return $"({sqlFirst.Replace(" \r\n", " \r\n ")})";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -990,7 +990,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure(tb.Table.Type, name);
|
if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure(tb.Table.Type, name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
name = name.Replace("\r\n", "\r\n ");
|
name = name.Replace(" \r\n", " \r\n ");
|
||||||
}
|
}
|
||||||
dict.Add(tb.Table.Type, name);
|
dict.Add(tb.Table.Type, name);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.Dameng.Curd
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace FreeSql.MsAccess.Curd
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ namespace FreeSql.MySql.Curd
|
|||||||
.AsTable((_, __) => _tableRule?.Invoke(__)).AsType(_table.Type)
|
.AsTable((_, __) => _tableRule?.Invoke(__)).AsType(_table.Type)
|
||||||
.DisableGlobalFilter()
|
.DisableGlobalFilter()
|
||||||
.WhereDynamic(rowd)
|
.WhereDynamic(rowd)
|
||||||
.Limit(1).ToSql("1").Replace("\r\n", "\r\n\t")).Append(")"));
|
.Limit(1).ToSql("1").Replace(" \r\n", " \r\n ")).Append(")"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(sql)) return null;
|
if (string.IsNullOrEmpty(sql)) return null;
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.MySql.Curd
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.Odbc.Dameng
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.Odbc.Default
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.Odbc.KingbaseES
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
.AsTable((_, __) => _tableRule?.Invoke(__)).AsType(_table.Type)
|
.AsTable((_, __) => _tableRule?.Invoke(__)).AsType(_table.Type)
|
||||||
.DisableGlobalFilter()
|
.DisableGlobalFilter()
|
||||||
.WhereDynamic(rowd)
|
.WhereDynamic(rowd)
|
||||||
.Limit(1).ToSql("1").Replace("\r\n", "\r\n\t")).Append(")"));
|
.Limit(1).ToSql("1").Replace(" \r\n", " \r\n ")).Append(")"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(sql)) return null;
|
if (string.IsNullOrEmpty(sql)) return null;
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.Odbc.Oracle
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.Oracle.Curd
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.PostgreSQL.Curd
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.ShenTong.Curd
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ namespace FreeSql.SqlServer.Curd
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ namespace FreeSql.Sqlite.Curd
|
|||||||
.AsTable((_, __) => _tableRule?.Invoke(__)).AsType(_table.Type)
|
.AsTable((_, __) => _tableRule?.Invoke(__)).AsType(_table.Type)
|
||||||
.DisableGlobalFilter()
|
.DisableGlobalFilter()
|
||||||
.WhereDynamic(rowd)
|
.WhereDynamic(rowd)
|
||||||
.Limit(1).ToSql("1").Replace("\r\n", "\r\n\t")).Append(")"));
|
.Limit(1).ToSql("1").Replace(" \r\n", " \r\n ")).Append(")"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(sql)) return null;
|
if (string.IsNullOrEmpty(sql)) return null;
|
||||||
|
@ -25,7 +25,7 @@ namespace FreeSql.Sqlite.Curd
|
|||||||
var tbUnionsGt0 = tbUnions.Count > 1;
|
var tbUnionsGt0 = tbUnions.Count > 1;
|
||||||
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
for (var tbUnionsIdx = 0; tbUnionsIdx < tbUnions.Count; tbUnionsIdx++)
|
||||||
{
|
{
|
||||||
if (tbUnionsIdx > 0) sb.Append(" \r\n\r\nUNION ALL\r\n\r\n");
|
if (tbUnionsIdx > 0) sb.Append("\r\n \r\nUNION ALL\r\n \r\n");
|
||||||
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
if (tbUnionsGt0) sb.Append(_select).Append(" * from (");
|
||||||
var tbUnion = tbUnions[tbUnionsIdx];
|
var tbUnion = tbUnions[tbUnionsIdx];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user