Browse Source

Oracle Union all bug

pull/12/MERGE
sunkaixuan 4 years ago
parent
commit
78cf945954
  1. 14
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs

14
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs

@ -467,8 +467,15 @@ namespace SqlSugar
var allParameters = allItems.SelectMany(it => it.Value).ToArray(); var allParameters = allItems.SelectMany(it => it.Value).ToArray();
var resulut = this.Context.Queryable<ExpandoObject>().AS(UtilMethods.GetPackTable(allSql, "unionTable")).With(SqlWith.Null); var resulut = this.Context.Queryable<ExpandoObject>().AS(UtilMethods.GetPackTable(allSql, "unionTable")).With(SqlWith.Null);
resulut.AddParameters(allParameters); resulut.AddParameters(allParameters);
if (this.Context.CurrentConnectionConfig.DbType == DbType.Oracle && sqlBuilder.SqlSelectAll == "*")
{
return resulut.Select<T>("unionTable.*");
}
else
{
return resulut.Select<T>(sqlBuilder.SqlSelectAll); return resulut.Select<T>(sqlBuilder.SqlSelectAll);
} }
}
public virtual ISugarQueryable<T> UnionAll<T>(List<ISugarQueryable<T>> queryables) where T : class, new() public virtual ISugarQueryable<T> UnionAll<T>(List<ISugarQueryable<T>> queryables) where T : class, new()
{ {
Check.Exception(queryables.IsNullOrEmpty(), "UnionAll.queryables is null "); Check.Exception(queryables.IsNullOrEmpty(), "UnionAll.queryables is null ");
@ -495,8 +502,15 @@ namespace SqlSugar
var allParameters = allItems.SelectMany(it => it.Value).ToArray(); var allParameters = allItems.SelectMany(it => it.Value).ToArray();
var resulut = this.Context.Queryable<ExpandoObject>().AS(UtilMethods.GetPackTable(allSql, "unionTable")).With(SqlWith.Null); var resulut = this.Context.Queryable<ExpandoObject>().AS(UtilMethods.GetPackTable(allSql, "unionTable")).With(SqlWith.Null);
resulut.AddParameters(allParameters); resulut.AddParameters(allParameters);
if (this.Context.CurrentConnectionConfig.DbType == DbType.Oracle && sqlBuilder.SqlSelectAll == "*")
{
return resulut.Select<T>("unionTable.*");
}
else
{
return resulut.Select<T>(sqlBuilder.SqlSelectAll); return resulut.Select<T>(sqlBuilder.SqlSelectAll);
} }
}
public virtual ISugarQueryable<T> Union<T>(List<ISugarQueryable<T>> queryables) where T : class, new() public virtual ISugarQueryable<T> Union<T>(List<ISugarQueryable<T>> queryables) where T : class, new()
{ {
Check.Exception(queryables.IsNullOrEmpty(), "Union.queryables is null "); Check.Exception(queryables.IsNullOrEmpty(), "Union.queryables is null ");

Loading…
Cancel
Save