mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
PgSql Updateable.SetColumn datetime== null bug
This commit is contained in:
parent
cbabfa5f71
commit
359757a076
@ -54,8 +54,20 @@ namespace OrmTest
|
|||||||
UValidate.Check(sql.Key, @"UPDATE ""diary"" SET
|
UValidate.Check(sql.Key, @"UPDATE ""diary"" SET
|
||||||
""typeid"" = @Const0 WHERE ( ""id"" = @ID1 )", "Updateable");
|
""typeid"" = @Const0 WHERE ( ""id"" = @ID1 )", "Updateable");
|
||||||
|
|
||||||
|
Db.Updateable<OrderModel>().SetColumns(it => new OrderModel()
|
||||||
|
{
|
||||||
|
CreateTime = null
|
||||||
|
}).Where(it => it.Id == 1).ExecuteCommand();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[SugarTable("order")]
|
||||||
|
public class OrderModel
|
||||||
|
{
|
||||||
|
[SugarColumn(IsPrimaryKey =true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
}
|
||||||
public class UnitSaveDiary
|
public class UnitSaveDiary
|
||||||
{
|
{
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
@ -134,7 +134,14 @@ namespace SqlSugar
|
|||||||
base.Start();
|
base.Start();
|
||||||
string parameterName = this.Context.SqlParameterKeyWord + ExpressionConst.Const + this.Context.ParameterIndex;
|
string parameterName = this.Context.SqlParameterKeyWord + ExpressionConst.Const + this.Context.ParameterIndex;
|
||||||
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameterName));
|
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameterName));
|
||||||
this.Context.Parameters.Add(new SugarParameter(parameterName, parameter.CommonTempData));
|
var addItem = new SugarParameter(parameterName, parameter.CommonTempData);
|
||||||
|
var dataType = UtilMethods.GetUnderType(item.Type);
|
||||||
|
if (addItem.Value == null && dataType == UtilConstants.DateType)
|
||||||
|
{
|
||||||
|
addItem.DbType = System.Data.DbType.Date;
|
||||||
|
|
||||||
|
}
|
||||||
|
this.Context.Parameters.Add(addItem);
|
||||||
this.Context.ParameterIndex++;
|
this.Context.ParameterIndex++;
|
||||||
}
|
}
|
||||||
else if (item is MemberExpression)
|
else if (item is MemberExpression)
|
||||||
|
Loading…
Reference in New Issue
Block a user