修复数据类型sbyte对应clickhouse Int8的错误

This commit is contained in:
20521097 2022-10-27 16:13:19 +08:00
parent 0cf9a96737
commit 16e32901d5
5 changed files with 12 additions and 2 deletions

View File

@ -133,6 +133,10 @@ namespace SqlSugar.ClickHouse
param.Value = Guid.Empty;
}
}
if (dbtype.ObjToString() == System.Data.DbType.SByte.ToString())
{
dbtype = ClickHouseDbBind.MappingTypesConst.First(it => it.Value == CSharpDataType.@sbyte).Key;
}
if (param.Value!=null&&param.Value!=DBNull.Value&&dbtype.ObjToString() == System.Data.DbType.Boolean.ToString())
{
sql = sql.Replace(param.ParameterName, param.Value.ObjToBool()?"1":"0");

View File

@ -67,8 +67,8 @@ namespace SqlSugar.ClickHouse
new KeyValuePair<string, CSharpDataType>("UInt32",CSharpDataType.@int),
new KeyValuePair<string, CSharpDataType>("UInt16",CSharpDataType.@short),
new KeyValuePair<string, CSharpDataType>("UInt64",CSharpDataType.@long),
new KeyValuePair<string, CSharpDataType>("Int8",CSharpDataType.@int),
new KeyValuePair<string, CSharpDataType>("UInt8",CSharpDataType.@int),
new KeyValuePair<string, CSharpDataType>("Int8",CSharpDataType.@sbyte),
new KeyValuePair<string, CSharpDataType>("UInt8",CSharpDataType.@byte),
new KeyValuePair<string, CSharpDataType>("Decimal(38,19)",CSharpDataType.@decimal),
new KeyValuePair<string, CSharpDataType>("Decimal",CSharpDataType.@decimal),
new KeyValuePair<string, CSharpDataType>("Decimal32",CSharpDataType.@decimal),

View File

@ -15,6 +15,7 @@ namespace SqlSugar
@double,
@Guid,
@byte,
@sbyte,
@enum,
@short,
@long,

View File

@ -110,6 +110,10 @@ namespace SqlSugar
{
this.DbType = System.Data.DbType.Byte;
}
else if (type == UtilConstants.SByteType)
{
this.DbType = System.Data.DbType.SByte;
}
else if (type == UtilConstants.FloatType)
{
this.DbType = System.Data.DbType.Single;

View File

@ -24,6 +24,7 @@ namespace SqlSugar
internal static Type BoolType = typeof(bool);
internal static Type BoolTypeNull = typeof(bool?);
internal static Type ByteType = typeof(Byte);
internal static Type SByteType = typeof(sbyte);
internal static Type ObjType = typeof(object);
internal static Type DobType = typeof(double);
internal static Type FloatType = typeof(float);