提交 902fc00b 编写于 作者: S shenglian zhou

see whether parse part can be skipped

上级 f7537e79
...@@ -415,6 +415,20 @@ static int32_t tscParseTelnetLines(char* lines[], int numLines, SArray* points, ...@@ -415,6 +415,20 @@ static int32_t tscParseTelnetLines(char* lines[], int numLines, SArray* points,
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int tscSmlInsert2(TAOS* taos, TAOS_SML_DATA_POINT* points, int numPoint, SSmlLinesInfo* info) {
int64_t ts = taosGetTimestampUs();
static int64_t l = 0;
for (int i = 0; i < numPoint; ++i) {
char sql[512];
sprintf(sql, "insert into `sml`(`ts`,`value`) values(%" PRId64 ",%f)", ts+l, 4.2);
TAOS_RES* res = taos_query(taos, sql);
taos_free_result(res);
++l;
}
info->affectedRows = numPoint;
return TSDB_CODE_SUCCESS;
}
int taos_insert_telnet_lines(TAOS* taos, char* lines[], int numLines, SMLProtocolType protocol, SMLTimeStampType tsType, int* affectedRows) { int taos_insert_telnet_lines(TAOS* taos, char* lines[], int numLines, SMLProtocolType protocol, SMLTimeStampType tsType, int* affectedRows) {
int32_t code = 0; int32_t code = 0;
...@@ -455,7 +469,8 @@ int taos_insert_telnet_lines(TAOS* taos, char* lines[], int numLines, SMLProtoco ...@@ -455,7 +469,8 @@ int taos_insert_telnet_lines(TAOS* taos, char* lines[], int numLines, SMLProtoco
} }
TAOS_SML_DATA_POINT* points = TARRAY_GET_START(lpPoints); TAOS_SML_DATA_POINT* points = TARRAY_GET_START(lpPoints);
code = tscSmlInsert(taos, points, (int)numPoints, info); //code = tscSmlInsert(taos, points, (int)numPoints, info);
code = tscSmlInsert2(taos, points, (int)numPoints, info);
if (code != 0) { if (code != 0) {
tscError("OTD:0x%"PRIx64" taos_insert_telnet_lines error: %s", info->id, tstrerror((code))); tscError("OTD:0x%"PRIx64" taos_insert_telnet_lines error: %s", info->id, tstrerror((code)));
} }
......
...@@ -190,6 +190,10 @@ int main(int argc, char* argv[]) { ...@@ -190,6 +190,10 @@ int main(int argc, char* argv[]) {
(void)taos_select_db(taos, "db"); (void)taos_select_db(taos, "db");
result = taos_query(taos, "create table `sml`(`ts` timestamp, `value` double)");
taos_free_result(result);
usleep(100000);
time_t ct = time(0); time_t ct = time(0);
int64_t ts = ct * 1000 ; int64_t ts = ct * 1000 ;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册