diff --git a/IoTSharp.sln b/IoTSharp.sln index fc27b1bad3b88884c70e99b9fe0e9198cbefc86d..0c1d3404c497481b71ca8719886e47f0708f2dbe 100644 --- a/IoTSharp.sln +++ b/IoTSharp.sln @@ -32,6 +32,7 @@ Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "zeromq_taos", "Deployments\ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{3048484A-6A46-4E17-825C-D2C59D6D30ED}" ProjectSection(SolutionItems) = preProject + buildimage.cmd = buildimage.cmd tools\ef_mg_add.cmd = tools\ef_mg_add.cmd tools\upgrade_ef.cmd = tools\upgrade_ef.cmd EndProjectSection diff --git a/IoTSharp/Storage/TaosStorage.cs b/IoTSharp/Storage/TaosStorage.cs index 986e7463de6d273ceea993b83d101faa818c66aa..435f2e9818d47907d226b09f99b178760e6d1542 100644 --- a/IoTSharp/Storage/TaosStorage.cs +++ b/IoTSharp/Storage/TaosStorage.cs @@ -66,6 +66,7 @@ namespace IoTSharp.Storage TaosConnection _taos = _taospool.Get(); _taos.ChangeDatabase(_taos.Database); if (_taos.State != System.Data.ConnectionState.Open) _taos.Open(); + //https://github.com/taosdata/TDengine/issues/4269 string sql = $"select last_row(*) from telemetrydata where deviceid='{deviceId:N}' group by deviceid,keyname"; List dt = SqlToTDD(_taos, sql, "last_row(", ")", string.Empty); _taospool.Return(_taos); @@ -73,7 +74,16 @@ namespace IoTSharp.Storage } - + /// + /// 转换获取到的值 + /// + /// + /// + /// + /// + /// + /// + /// 务必注意此bug private List SqlToTDD(TaosConnection db, string sql, string prefix, string suffix, string keyname) { List dt = new List(); @@ -91,7 +101,7 @@ namespace IoTSharp.Storage } else { - datatype = (byte)DataType.String; + throw new Exception($"字段{prefix}value_type{suffix}的Index={idx}小于0或者大于FieldCount{dataReader.FieldCount},更多信息请访问 HelpLink") { HelpLink= "https://github.com/taosdata/TDengine/issues/4269" }; } if (string.IsNullOrEmpty(keyname))