Update Util.GetSqlString

This commit is contained in:
sunkaixuan
2022-06-09 20:28:24 +08:00
parent 27b874564e
commit ed9734385b

View File

@@ -779,6 +779,17 @@ namespace SqlSugar
{ {
result = result.Replace(item.ParameterName, "0x" + BitConverter.ToString((byte[])item.Value)); result = result.Replace(item.ParameterName, "0x" + BitConverter.ToString((byte[])item.Value));
} }
else if (item.Value is bool)
{
if (connectionConfig.DbType == DbType.PostgreSQL)
{
result = result.Replace(item.ParameterName, (Convert.ToBoolean(item.Value) ? "true": "false") );
}
else
{
result = result.Replace(item.ParameterName, (Convert.ToBoolean(item.Value) ? 1 : 0) + "");
}
}
else if (item.Value.GetType() != UtilConstants.StringType && connectionConfig.DbType == DbType.PostgreSQL && PostgreSQLDbBind.MappingTypesConst.Any(x => x.Value.ToString().EqualCase(item.Value.GetType().Name))) else if (item.Value.GetType() != UtilConstants.StringType && connectionConfig.DbType == DbType.PostgreSQL && PostgreSQLDbBind.MappingTypesConst.Any(x => x.Value.ToString().EqualCase(item.Value.GetType().Name)))
{ {
var type = PostgreSQLDbBind.MappingTypesConst.First(x => x.Value.ToString().EqualCase(item.Value.GetType().Name)).Key; var type = PostgreSQLDbBind.MappingTypesConst.First(x => x.Value.ToString().EqualCase(item.Value.GetType().Name)).Key;