mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Update Expression to sql
This commit is contained in:
parent
2c7ff9d067
commit
cd241b39b2
@ -8,8 +8,8 @@ namespace OrmTest
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
public static string ConnectionString = "server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST";
|
||||
public static string ConnectionString2 = "server=.;uid=sa;pwd=haosql;database=sqlsugar4xtest";
|
||||
public static string ConnectionString3 = "server=.;uid=sa;pwd=haosql;database=sqlsugar4xtesT";
|
||||
public static string ConnectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SQLSUGAR4XTEST";
|
||||
public static string ConnectionString2 = "server=.;uid=sa;pwd=@jhl85661501;database=sqlsugar4xtest";
|
||||
public static string ConnectionString3 = "server=.;uid=sa;pwd=@jhl85661501;database=sqlsugar4xtesT";
|
||||
}
|
||||
}
|
||||
|
@ -445,6 +445,8 @@ namespace OrmTest.Demo
|
||||
var test45 = db.Queryable<DataTestInfo>().Select(it => new {
|
||||
x =p
|
||||
}).ToList();
|
||||
var test46 = db.Queryable<Student>().Where(it => it.CreateTime > SqlFunc.ToDate(DateTime.Now.Date)).ToList();
|
||||
//var test47 = db.Queryable<Student>().Where(it =>string.IsNullOrEmpty(it.Name)==true).ToList();
|
||||
}
|
||||
public static void Page()
|
||||
{
|
||||
|
@ -386,7 +386,13 @@ namespace SqlSugar
|
||||
{
|
||||
parameter.CommonTempData = CommonTempDataType.Result;
|
||||
base.Expression = item;
|
||||
base.Start();
|
||||
if (item.Type == UtilConstants.DateType && parameter.CommonTempData.ObjToString() == CommonTempDataType.Result.ToString() && item.ToString() == "DateTime.Now.Date")
|
||||
{
|
||||
parameter.CommonTempData = DateTime.Now.Date;
|
||||
}
|
||||
else {
|
||||
base.Start();
|
||||
}
|
||||
var methodCallExpressionArgs = new MethodCallExpressionArgs()
|
||||
{
|
||||
IsMember = parameter.ChildExpression is MemberExpression && !ExpressionTool.IsConstExpression(parameter.ChildExpression as MemberExpression),
|
||||
|
@ -836,10 +836,10 @@ namespace SqlSugar
|
||||
var newName = itemParameter.ParameterName + "_q_" + index;
|
||||
SugarParameter parameter = new SugarParameter(newName, itemParameter.Value);
|
||||
parameter.DbType = itemParameter.DbType;
|
||||
itemSql = Regex.Replace(itemSql,string.Format(@"{0} ","\\"+itemParameter.ParameterName), newName+" ");
|
||||
itemSql = Regex.Replace(itemSql, string.Format(@"{0}\)", "\\" + itemParameter.ParameterName), newName+")");
|
||||
itemSql = Regex.Replace(itemSql, string.Format(@"{0}\,", "\\" + itemParameter.ParameterName), newName+",");
|
||||
itemSql = Regex.Replace(itemSql, string.Format(@"{0}$", "\\" + itemParameter.ParameterName), newName);
|
||||
itemSql = Regex.Replace(itemSql,string.Format(@"{0} ","\\"+itemParameter.ParameterName), newName+" ",RegexOptions.IgnoreCase);
|
||||
itemSql = Regex.Replace(itemSql, string.Format(@"{0}\)", "\\" + itemParameter.ParameterName), newName+")", RegexOptions.IgnoreCase);
|
||||
itemSql = Regex.Replace(itemSql, string.Format(@"{0}\,", "\\" + itemParameter.ParameterName), newName+",", RegexOptions.IgnoreCase);
|
||||
itemSql = Regex.Replace(itemSql, string.Format(@"{0}$", "\\" + itemParameter.ParameterName), newName, RegexOptions.IgnoreCase);
|
||||
addParameters.Add(parameter);
|
||||
}
|
||||
parsmeters.AddRange(addParameters);
|
||||
|
Loading…
Reference in New Issue
Block a user