mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
Clickhouse Bool类型Parameter测试
This commit is contained in:
parent
3528c01c5b
commit
bfb438ee08
@ -20,7 +20,7 @@ namespace FreeSql.Tests.ClickHouse
|
|||||||
_fsql = new FreeSqlBuilder().UseConnectionString(DataType.ClickHouse,
|
_fsql = new FreeSqlBuilder().UseConnectionString(DataType.ClickHouse,
|
||||||
"Host=192.168.1.123;Port=8123;Database=test;Compress=True;Min Pool Size=1")
|
"Host=192.168.1.123;Port=8123;Database=test;Compress=True;Min Pool Size=1")
|
||||||
.UseMonitorCommand(cmd => _output.WriteLine($"线程:{cmd.CommandText}\r\n"))
|
.UseMonitorCommand(cmd => _output.WriteLine($"线程:{cmd.CommandText}\r\n"))
|
||||||
.UseNoneCommandParameter(false)
|
.UseNoneCommandParameter(true)
|
||||||
.Build();
|
.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ namespace FreeSql.Tests.ClickHouse
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 测试bool类型映射
|
/// 测试bool类型插入
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestBoolMappingInsert()
|
public void TestBoolMappingInsert()
|
||||||
@ -63,11 +63,19 @@ namespace FreeSql.Tests.ClickHouse
|
|||||||
Name = "Daily",
|
Name = "Daily",
|
||||||
Age = 22,
|
Age = 22,
|
||||||
Id = Guid.NewGuid().ToString(),
|
Id = Guid.NewGuid().ToString(),
|
||||||
IsDelete = true,
|
IsDelete = false,
|
||||||
IsEnable = null
|
IsEnable = false
|
||||||
}).ExecuteAffrows();
|
}).ExecuteAffrows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 测试bool类型查询
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void TestBoolMappingSelect()
|
||||||
|
{
|
||||||
|
var list = _fsql.Select<BoolMappingTest>().ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Table(Name = "table_test_bool")]
|
[Table(Name = "table_test_bool")]
|
||||||
|
@ -48,7 +48,7 @@ namespace FreeSql.ClickHouse
|
|||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is bool || param is bool?)
|
if (param is bool || param is bool?)
|
||||||
return (bool)param ? 1 : 0;
|
return (bool)param; //不需要转0/1
|
||||||
else if (param is string)
|
else if (param is string)
|
||||||
return string.Concat("'", param.ToString().Replace("'", "''").Replace("\\", "\\\\"), "'"); //只有 mysql 需要处理反斜杠
|
return string.Concat("'", param.ToString().Replace("'", "''").Replace("\\", "\\\\"), "'"); //只有 mysql 需要处理反斜杠
|
||||||
else if (param is char)
|
else if (param is char)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user