From bc8eb40f5f6afecae37898800ada4cd2384b818a Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 12 Dec 2022 22:43:22 +0800 Subject: [PATCH] opti:parse value in schemaless --- source/client/src/clientSmlLine.c | 5 +++-- source/client/test/smlTest.cpp | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index aca0fe752b..cb57d85375 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -148,8 +148,8 @@ static int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { } if (pVal->value[0] == 't' || pVal->value[0] == 'T'){ - if(pVal->length == 1 || (pVal->length == 4 && (pVal->value[1] == 'u' || pVal->value[1] == 'U') - && (pVal->value[2] == 'r' || pVal->value[2] == 'R') + if(pVal->length == 1 || (pVal->length == 4 && (pVal->value[1] == 'r' || pVal->value[1] == 'R') + && (pVal->value[2] == 'u' || pVal->value[2] == 'U') && (pVal->value[3] == 'e' || pVal->value[3] == 'E'))){ pVal->i = TSDB_TRUE; pVal->type = TSDB_DATA_TYPE_BOOL; @@ -492,6 +492,7 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlKv kv = {.key = key, .keyLen = keyLen, .value = value, .length = valueLen}; int32_t ret = smlParseValue(&kv, &info->msgBuf); if (ret != TSDB_CODE_SUCCESS) { + smlBuildInvalidDataMsg(&info->msgBuf, "smlParseValue error", value); return ret; } diff --git a/source/client/test/smlTest.cpp b/source/client/test/smlTest.cpp index d55783fd4c..b7a50f1cc8 100644 --- a/source/client/test/smlTest.cpp +++ b/source/client/test/smlTest.cpp @@ -239,6 +239,7 @@ TEST(testCase, smlParseCols_Test) { info->protocol = TSDB_SML_LINE_PROTOCOL; info->dataFormat = false; SSmlLineInfo elements = {0}; + info->msgBuf = msgBuf; const char *data = "st,t=1 cb\\=in=\"pass\\,it "