Update pgsql

This commit is contained in:
sunkaixuna 2021-10-05 20:23:35 +08:00
parent ec35f811d9
commit 4c083b869b

View File

@ -34,7 +34,7 @@ namespace SqlSugar
} }
} }
public override object FormatValue(object value) public object FormatValue(object value,string name,int i)
{ {
if (value == null) if (value == null)
{ {
@ -45,12 +45,9 @@ namespace SqlSugar
var type = value.GetType(); var type = value.GetType();
if (type == UtilConstants.DateType) if (type == UtilConstants.DateType)
{ {
var date = value.ObjToDate(); var parameterName = this.Builder.SqlParameterKeyWord + name + i;
if (date < Convert.ToDateTime("1900-1-1")) this.Parameters.Add(new SugarParameter(parameterName, value));
{ return parameterName;
date = Convert.ToDateTime("1900-1-1");
}
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
} }
else if (type == UtilConstants.ByteArrayType) else if (type == UtilConstants.ByteArrayType)
{ {
@ -148,7 +145,7 @@ namespace SqlSugar
dbType = "varchar"; dbType = "varchar";
} }
} }
return string.Format("CAST({0} AS {1})", FormatValue(it.Value), dbType); return string.Format("CAST({0} AS {1})", FormatValue(it.Value,it.DbColumnName,i), dbType);
})) + ")"); })) + ")");
++i; ++i;