提交 aae94079 编写于 作者: wmmhello's avatar wmmhello

opti:modify logic for telnet and json in schemaless

上级 078f65cf
......@@ -1902,13 +1902,12 @@ static int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, S
SSmlKv kv = {.key = VALUE, .keyLen = VALUE_LEN, .value = elements->cols, .length = elements->colsLen};
if (smlParseNumber(&kv, &info->msgBuf)) {
kv.length = (int16_t)tDataTypes[kv.type].bytes;
return TSDB_CODE_SUCCESS;
}else{
return TSDB_CODE_TSC_INVALID_VALUE;
}
// move measure before tags to combine keys to identify child table
memcpy(sql - elements->measureLen, elements->measure, elements->measureLen);
memmove(sql - elements->measureLen, elements->measure, elements->measureLen);
elements->measure = sql - elements->measureLen;
elements->measureLen += sqlEnd - sql;
......
......@@ -77,11 +77,20 @@ int smlProcess_telnet_Test() {
pRes = taos_query(taos, "use sml_db");
taos_free_result(pRes);
const char *sql[] = {"sys.if.bytes.out 1479496100 1.3E0 host=web01 interface=eth0",
char *sql[4] = {0};
sql[0] = taosMemoryCalloc(1, 128);
sql[1] = taosMemoryCalloc(1, 128);
sql[2] = taosMemoryCalloc(1, 128);
sql[3] = taosMemoryCalloc(1, 128);
const char *sql1[] = {"sys.if.bytes.out 1479496100 1.3E0 host=web01 interface=eth0",
"sys.if.bytes.out 1479496101 1.3E1 interface=eth0 host=web01 ",
"sys.if.bytes.out 1479496102 1.3E3 network=tcp",
" sys.procs.running 1479496100 42 host=web01 "};
for(int i = 0; i < 4; i++){
strncpy(sql[i], sql1[i], 128);
}
pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_TELNET_PROTOCOL,
TSDB_SML_TIMESTAMP_NANO_SECONDS);
printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册