mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
Clickhouse Array泛型插入测试
This commit is contained in:
parent
322332cf73
commit
d91c7fbdfd
@ -114,7 +114,22 @@ namespace FreeSql.Tests.ClickHouse
|
||||
[Fact]
|
||||
public void ArrayBoolMappingSync()
|
||||
{
|
||||
_fsql.CodeFirst.SyncStructure(typeof(ArrayMappingTest));
|
||||
_fsql.CodeFirst.SyncStructure(typeof(ArrayMappingTestSimple));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试Array类型映射
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ArrayBoolMappingInsert()
|
||||
{
|
||||
_ = _fsql.Insert(new ArrayMappingTestSimple
|
||||
{
|
||||
Name = "daily",
|
||||
Tags1 = new List<string>() { "a", "b", "c" },
|
||||
Tags2 = new List<int>() { 1, 2, 3, 4 },
|
||||
Tags3 = new List<bool>() { true, true, false }
|
||||
}).ExecuteAffrows();
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,4 +168,18 @@ namespace FreeSql.Tests.ClickHouse
|
||||
|
||||
[Column(Name = "tags7")] public IEnumerable<bool> Tags7 { get; set; }
|
||||
}
|
||||
|
||||
[Table(Name = "table_test_array_simple")]
|
||||
public class ArrayMappingTestSimple
|
||||
|
||||
{
|
||||
[Column(Name = "name", IsPrimary = true)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column(Name = "tags1")] public IEnumerable<string> Tags1 { get; set; }
|
||||
|
||||
[Column(Name = "tags2")] public List<int> Tags2 { get; set; }
|
||||
|
||||
[Column(Name = "tags3")] public IEnumerable<bool> Tags3 { get; set; }
|
||||
}
|
||||
}
|
@ -34,6 +34,11 @@
|
||||
测试Array类型映射
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:FreeSql.Tests.ClickHouse.ClickHouseTest3.ArrayBoolMappingInsert">
|
||||
<summary>
|
||||
测试Array类型映射
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:FreeSql.Tests.ClickHouse.CollectDataEntityUpdate01">
|
||||
<summary>
|
||||
实时数据
|
||||
|
@ -43,7 +43,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
sb.Append(AddslashesProcessParam(z, mapType, mapColumn));
|
||||
}
|
||||
|
||||
return sb.Length == 0 ? "(NULL)" : sb.Remove(0, 1).Insert(0, "(").Append(")").ToString();
|
||||
return sb.Length == 0 ? "(NULL)" : sb.Remove(0, 1).Insert(0, "[").Append("]").ToString();
|
||||
}
|
||||
|
||||
public static bool IsFromSlave(string cmdText)
|
||||
|
@ -146,7 +146,7 @@ namespace FreeSql.ClickHouse
|
||||
}
|
||||
|
||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, string specialParamFlag, ColumnInfo col, Type type, object value)
|
||||
{
|
||||
{
|
||||
if (value == null) return "NULL";
|
||||
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
||||
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
||||
|
Loading…
x
Reference in New Issue
Block a user