From 85a15a14043ed1aff7bb07d99fbc53f72b5f92fa Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Thu, 3 Jan 2019 21:41:04 +0800 Subject: [PATCH] Oracle Union all bug --- Src/Asp.Net/OracleTest/Demos/1_Query.cs | 12 ++++++++++++ Src/Asp.Net/SqlServerTest/Demos/1_Query.cs | 12 ++++++++++++ Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Src/Asp.Net/OracleTest/Demos/1_Query.cs b/Src/Asp.Net/OracleTest/Demos/1_Query.cs index 12de1fbe5..5a47ca7cc 100644 --- a/Src/Asp.Net/OracleTest/Demos/1_Query.cs +++ b/Src/Asp.Net/OracleTest/Demos/1_Query.cs @@ -336,6 +336,18 @@ namespace OrmTest.Demo var list8 = db.Queryable((st, sc, sc2) => st.SchoolId == sc.Id && sc.Id == sc2.Id) .OrderBy(st=>st.Id) .Select((st, sc, sc2) => new { st.Name, st.Id, schoolName = sc.Name, schoolName2 = sc2.Name }).ToPageList(1, 2); + + var q1 = db.Queryable().Select(it => new Student() + { + Id=it.Id, + Name="a" + }); + var q2 = db.Queryable().Select(it => new Student() + { + Id = it.Id, + Name = "b" + }); + var unionAllList=db.Union(q1, q2).ToList(); } public static void Funs() { diff --git a/Src/Asp.Net/SqlServerTest/Demos/1_Query.cs b/Src/Asp.Net/SqlServerTest/Demos/1_Query.cs index 0ccc7dac8..93c89c74c 100644 --- a/Src/Asp.Net/SqlServerTest/Demos/1_Query.cs +++ b/Src/Asp.Net/SqlServerTest/Demos/1_Query.cs @@ -539,6 +539,18 @@ namespace OrmTest.Demo id=st1.Id, name=st2.Name }).ToList(); + + var q1 = db.Queryable().Select(it => new Student() + { + Id = it.Id, + Name = "a" + }); + var q2 = db.Queryable().Select(it => new Student() + { + Id = it.Id, + Name = "b" + }); + var unionAllList = db.Union(q1, q2).ToList(); } public static void Funs() { diff --git a/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs b/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs index dc20c7321..031ccfa85 100644 --- a/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs +++ b/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs @@ -78,7 +78,7 @@ namespace SqlSugar //Compatible with.NET CORE parameters case var name = parameter.ParameterName; string newName = name +append+ addIndex; - appendSql = appendSql.Replace(name, newName); + appendSql =Regex.Replace(appendSql,name,newName,RegexOptions.IgnoreCase); parameter.ParameterName = newName; } }