Update : queryable.ToSqlString()

This commit is contained in:
sunkaixuan
2024-04-22 19:21:45 +08:00
parent f9f2b7e42c
commit 2ed7e116af

View File

@@ -1552,10 +1552,18 @@ namespace SqlSugar
else if (item.Value is DateTime)
{
result = result.Replace(item.ParameterName, "'"+item.Value.ObjToDate().ToString("yyyy-MM-dd HH:mm:ss.fff")+"'");
}
else if (item.IsArray)
{
result = result.Replace(item.ParameterName, "'{" + new SerializeService().SerializeObject(item.Value).TrimStart('[').TrimEnd(']') + "}'");
}
else if (item.Value is byte[]&&connectionConfig.DbType==DbType.PostgreSQL)
{
result = result.Replace(item.ParameterName, "E'0x" + BitConverter.ToString((byte[])item.Value).Replace("-", "")+"'" );
}
else if (item.Value is byte[])
{
result = result.Replace(item.ParameterName, "0x" + BitConverter.ToString((byte[])item.Value));
result = result.Replace(item.ParameterName, "0x" + BitConverter.ToString((byte[])item.Value).Replace("-",""));
}
else if (item.Value is bool)
{
@@ -1578,10 +1586,6 @@ namespace SqlSugar
{
result = result.Replace(item.ParameterName, $"'{item.Value.ObjToString().ToSqlFilter()}'");
}
else if (item.IsArray)
{
result = result.Replace(item.ParameterName, "'{" + new SerializeService().SerializeObject(item.Value).TrimStart('[').TrimEnd(']') + "}'");
}
else
{
result = result.Replace(item.ParameterName, $"N'{item.Value.ObjToString().ToSqlFilter()}'");