mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 04:23:47 +08:00
Code collation
This commit is contained in:
@@ -158,7 +158,16 @@ namespace SqlSugar
|
|||||||
var type = value.GetType();
|
var type = value.GetType();
|
||||||
if (type == PubConst.DateType)
|
if (type == PubConst.DateType)
|
||||||
{
|
{
|
||||||
return "'" + value.ObjToDate().ToString("yyyy-MM-dd hh:mm:ss.fff") + "'";
|
var date = value.ObjToDate();
|
||||||
|
if (date < Convert.ToDateTime("1900-1-1"))
|
||||||
|
{
|
||||||
|
date = Convert.ToDateTime("1900-1-1");
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd hh:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
|
else if (type == PubConst.BoolType)
|
||||||
|
{
|
||||||
|
return value.ObjToBool() ? "1" : "0";
|
||||||
}
|
}
|
||||||
else if (type == PubConst.StringType || type == PubConst.ObjType)
|
else if (type == PubConst.StringType || type == PubConst.ObjType)
|
||||||
{
|
{
|
||||||
@@ -169,7 +178,7 @@ namespace SqlSugar
|
|||||||
return "N'" + value.ToString() + "'";
|
return "N'" + value.ToString() + "'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -258,6 +258,10 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
return "'" + date.ToString("yyyy-MM-dd hh:mm:ss.fff") + "'";
|
return "'" + date.ToString("yyyy-MM-dd hh:mm:ss.fff") + "'";
|
||||||
}
|
}
|
||||||
|
else if (type == PubConst.BoolType)
|
||||||
|
{
|
||||||
|
return value.ObjToBool() ? "1" : "0";
|
||||||
|
}
|
||||||
else if (type == PubConst.StringType || type == PubConst.ObjType)
|
else if (type == PubConst.StringType || type == PubConst.ObjType)
|
||||||
{
|
{
|
||||||
return "N'" + value.ToString().ToSqlFilter() + "'";
|
return "N'" + value.ToString().ToSqlFilter() + "'";
|
||||||
|
Reference in New Issue
Block a user