Browse Source

Update core

pull/11/head
sunkaixuna 3 years ago
parent
commit
65a3d1d232
  1. 2
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/FastestProvider/FastBuilder.cs
  2. 6
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs
  3. 4
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/DbMethods/SqlFuncExtendsion.cs
  4. 15
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs
  5. 3
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Realization/PostgreSQL/DbBind/PostgreSQLDbBind.cs
  6. 2
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLFastBuilder.cs

2
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/FastestProvider/FastBuilder.cs

@ -31,7 +31,7 @@ namespace SqlSugar
Check.ArgumentNullException(!updateColumns.Any(), "update columns count is 0");
Check.ArgumentNullException(!whereColumns.Any(), "where columns count is 0");
var sets = string.Join(",", updateColumns.Select(it => $"TM.{sqlbuilder.GetTranslationColumnName(it)}=TE.{sqlbuilder.GetTranslationColumnName(it)}"));
var wheres = string.Join(",", whereColumns.Select(it => $"TM.{sqlbuilder.GetTranslationColumnName(it)}=TE.{sqlbuilder.GetTranslationColumnName(it)}"));
var wheres = string.Join(" AND ", whereColumns.Select(it => $"TM.{sqlbuilder.GetTranslationColumnName(it)}=TE.{sqlbuilder.GetTranslationColumnName(it)}"));
string sql = string.Format(UpdateSql, sets, tableName, tempName, wheres);
return await this.Context.Ado.ExecuteCommandAsync(sql);
}

6
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs

@ -491,7 +491,7 @@ namespace SqlSugar
}
public string GetSqlQuerySql(string result)
{
if (this.IsSqlQuery && (Skip == null && Take == null))
if (this.IsSqlQuery && (Skip == null && Take == null)&&(this.WhereInfos==null||this.WhereInfos.Count==0))
{
var old = result;
var regex = @"^SELECT .* FROM \(((.|\n|\r)*)\) t $";
@ -543,6 +543,10 @@ namespace SqlSugar
{
return "*";
}
if (result.Contains("/**/*"))
{
return result.Replace("/**/*", "");
}
if (result.Contains(".*") && this.IsSingle())
{
return "*";

4
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/DbMethods/SqlFuncExtendsion.cs

@ -23,5 +23,9 @@ namespace SqlSugar
{
throw new NotSupportedException("Can only be used in expressions");
}
public static FieldType SelectAll<FieldType>(this FieldType field,string singleTableQueryShortName)
{
throw new NotSupportedException("Can only be used in expressions");
}
}
}

15
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs

@ -322,7 +322,13 @@ namespace SqlSugar
if (name.IsIn("GetSelfAndAutoFill","SelectAll"))
{
var memberValue = (args.First() as MemberExpression).Expression.ToString();
model.Args.Add(new MethodCallExpressionArgs() { MemberValue = memberValue, IsMember = true, MemberName = memberValue });
var data = new MethodCallExpressionArgs() { MemberValue = memberValue, IsMember = true, MemberName = memberValue };
model.Args.Add(data);
if (args.Count() == 2)
{
data.MemberName = (args.Last()).ToString();
data.MemberValue = "." ;
}
}
else
{
@ -773,7 +779,12 @@ namespace SqlSugar
case "SelectAll":
case "GetSelfAndAutoFill":
this.Context.Parameters.RemoveAll(it => it.ParameterName == model.Args[0].MemberName.ObjToString());
return this.Context.DbMehtods.GetSelfAndAutoFill(model.Args[0].MemberValue.ObjToString(), this.Context.IsSingle);
var result1= this.Context.DbMehtods.GetSelfAndAutoFill(model.Args[0].MemberValue.ObjToString(), this.Context.IsSingle);
if ((model.Args[0].MemberValue+"") == "."&&this.Context.IsSingle)
{
result1 =this.Context.GetTranslationTableName(model.Args[0].MemberName+"",false)+".*/**/" + result1;
}
return result1;
case "GetDate":
return this.Context.DbMehtods.GetDate();
case "GetRandom":

3
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Realization/PostgreSQL/DbBind/PostgreSQLDbBind.cs

@ -116,7 +116,8 @@ namespace SqlSugar
new KeyValuePair<string, CSharpDataType>("bit varying",CSharpDataType.byteArray),
new KeyValuePair<string, CSharpDataType>("varbit",CSharpDataType.@byte),
new KeyValuePair<string, CSharpDataType>("time",CSharpDataType.TimeSpan),
new KeyValuePair<string, CSharpDataType>("public.geometry",CSharpDataType.@object)
new KeyValuePair<string, CSharpDataType>("public.geometry",CSharpDataType.@object),
new KeyValuePair<string, CSharpDataType>("inet",CSharpDataType.@object)
};
public override List<string> StringThrow
{

2
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLFastBuilder.cs

@ -125,7 +125,7 @@ namespace SqlSugar
Check.ArgumentNullException(!updateColumns.Any(), "update columns count is 0");
Check.ArgumentNullException(!whereColumns.Any(), "where columns count is 0");
var sets = string.Join(",", updateColumns.Select(it => $"{sqlquerybulder.GetTranslationColumnName(it)}=TE.{sqlquerybulder.GetTranslationColumnName(it)}"));
var wheres = string.Join(",", whereColumns.Select(it => $"{tableName}.{sqlquerybulder.GetTranslationColumnName(it)}=TE.{sqlquerybulder.GetTranslationColumnName(it)}"));
var wheres = string.Join(" AND ", whereColumns.Select(it => $"{tableName}.{sqlquerybulder.GetTranslationColumnName(it)}=TE.{sqlquerybulder.GetTranslationColumnName(it)}"));
string sql = string.Format(UpdateSql, sets, tableName, tempName, wheres);
return await this.Context.Ado.ExecuteCommandAsync(sql);
}

Loading…
Cancel
Save