Browse Source

Update MySql

pull/12/MERGE
sunkaixuan 7 years ago
parent
commit
f84ad5c799
  1. 1
      Src/Asp.Net/MySqlTest/Demos/1_Query.cs
  2. 6
      Src/Asp.Net/SqlSugar/Realization/MySql/SqlBuilder/MySqlExpressionContext.cs

1
Src/Asp.Net/MySqlTest/Demos/1_Query.cs

@ -332,6 +332,7 @@ namespace OrmTest.Demo
{
var db = GetInstance();
var t1 = db.Queryable<Student>().Where(it => SqlFunc.ToLower(it.Name) == SqlFunc.ToLower("JACK")).ToList();
var t2 = db.Queryable<Student>().Where(it => SqlFunc.IsNull(it.Name, "nullvalue") == "nullvalue").ToList();
//SELECT [Id],[SchoolId],[Name],[CreateTime] FROM [Student] WHERE ((LOWER([Name])) = (LOWER(@MethodConst0)) )
/***More Functions***/

6
Src/Asp.Net/SqlSugar/Realization/MySql/SqlBuilder/MySqlExpressionContext.cs

@ -123,5 +123,11 @@ namespace SqlSugar
{
return " concat("+string.Join(",", strings).Replace("+", "") + ") ";
}
public override string IsNull(MethodCallExpressionModel model)
{
var parameter = model.Args[0];
var parameter1 = model.Args[1];
return string.Format("IFNULL({0},{1})", parameter.MemberName, parameter1.MemberName);
}
}
}

Loading…
Cancel
Save