“c2b4ec91ffc066cfa5f421988932247c0325793d”上不存在“source/dnode/vnode/src/git@gitcode.net:taosdata/tdengine.git”
提交 ddb33879 编写于 作者: G Ganlin Zhao

fix openTSDBTest.c and memory leak

上级 dc13ae8a
...@@ -2331,16 +2331,13 @@ static int32_t convertPrecisionType(int precision, SMLTimeStampType *tsType) { ...@@ -2331,16 +2331,13 @@ static int32_t convertPrecisionType(int precision, SMLTimeStampType *tsType) {
} }
//make a dummy SSqlObj //make a dummy SSqlObj
static SSqlObj* createSmlQueryObj(int32_t affected_rows, int32_t code) { static SSqlObj* createSmlQueryObj(TAOS* taos, int32_t affected_rows, int32_t code) {
SSqlObj *pNew = (SSqlObj*)calloc(1, sizeof(SSqlObj)); SSqlObj *pNew = (SSqlObj*)calloc(1, sizeof(SSqlObj));
if (pNew == NULL) { if (pNew == NULL) {
return NULL; return NULL;
} }
pNew->signature = pNew; pNew->signature = pNew;
pNew->pTscObj = (STscObj*)calloc(1, sizeof(STscObj)); pNew->pTscObj = taos;
if (pNew->pTscObj == NULL) {
return NULL;
}
tsem_init(&pNew->rspSem, 0, 0); tsem_init(&pNew->rspSem, 0, 0);
registerSqlObj(pNew); registerSqlObj(pNew);
...@@ -2402,7 +2399,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr ...@@ -2402,7 +2399,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
} }
SSqlObj *pSql = createSmlQueryObj(affected_rows, code); SSqlObj *pSql = createSmlQueryObj(taos, affected_rows, code);
return (TAOS_RES*)pSql; return (TAOS_RES*)pSql;
} }
...@@ -26,10 +26,12 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -26,10 +26,12 @@ void verify_telnet_insert(TAOS* taos) {
"stb0_1 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", "stb0_1 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
"stb0_2 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", "stb0_2 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
}; };
code = taos_schemaless_insert(taos, lines0, 3, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines0, 3, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines0 code: %d, %s.\n", code, tstrerror(code)); printf("lines0 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
/* timestamp */ /* timestamp */
char* lines1[] = { char* lines1[] = {
...@@ -41,10 +43,12 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -41,10 +43,12 @@ void verify_telnet_insert(TAOS* taos) {
"stb1 1626006833651ms 6i8 host=\"host0\"", "stb1 1626006833651ms 6i8 host=\"host0\"",
"stb1 0 7i8 host=\"host0\"", "stb1 0 7i8 host=\"host0\"",
}; };
code = taos_schemaless_insert(taos, lines1, 7, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines1, 7, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines1 code: %d, %s.\n", code, tstrerror(code)); printf("lines1 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
/* metric value */ /* metric value */
//tinyint //tinyint
...@@ -52,40 +56,48 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -52,40 +56,48 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_0 1626006833651ms -127i8 host=\"host0\"", "stb2_0 1626006833651ms -127i8 host=\"host0\"",
"stb2_0 1626006833652ms 127i8 host=\"host0\"" "stb2_0 1626006833652ms 127i8 host=\"host0\""
}; };
code = taos_schemaless_insert(taos, lines2_0, 2, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines2_0, 2, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines2_0 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_0 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
//smallint //smallint
char* lines2_1[] = { char* lines2_1[] = {
"stb2_1 1626006833651ms -32767i16 host=\"host0\"", "stb2_1 1626006833651ms -32767i16 host=\"host0\"",
"stb2_1 1626006833652ms 32767i16 host=\"host0\"" "stb2_1 1626006833652ms 32767i16 host=\"host0\""
}; };
code = taos_schemaless_insert(taos, lines2_1, 2, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines2_1, 2, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines2_1 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_1 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
//int //int
char* lines2_2[] = { char* lines2_2[] = {
"stb2_2 1626006833651ms -2147483647i32 host=\"host0\"", "stb2_2 1626006833651ms -2147483647i32 host=\"host0\"",
"stb2_2 1626006833652ms 2147483647i32 host=\"host0\"" "stb2_2 1626006833652ms 2147483647i32 host=\"host0\""
}; };
code = taos_schemaless_insert(taos, lines2_2, 2, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines2_2, 2, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines2_2 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_2 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
//bigint //bigint
char* lines2_3[] = { char* lines2_3[] = {
"stb2_3 1626006833651ms -9223372036854775807i64 host=\"host0\"", "stb2_3 1626006833651ms -9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\"" "stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\""
}; };
code = taos_schemaless_insert(taos, lines2_3, 2, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines2_3, 2, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines2_3 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_3 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
//float //float
char* lines2_4[] = { char* lines2_4[] = {
...@@ -100,10 +112,12 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -100,10 +112,12 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_4 1626006833700ms 3.4E38f32 host=\"host0\"", "stb2_4 1626006833700ms 3.4E38f32 host=\"host0\"",
"stb2_4 1626006833710ms -3.4E38f32 host=\"host0\"" "stb2_4 1626006833710ms -3.4E38f32 host=\"host0\""
}; };
code = taos_schemaless_insert(taos, lines2_4, 10, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines2_4, 10, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines2_4 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_4 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
//double //double
char* lines2_5[] = { char* lines2_5[] = {
...@@ -119,10 +133,12 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -119,10 +133,12 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_5 1626006833700ms -1.7E308f64 host=\"host0\"", "stb2_5 1626006833700ms -1.7E308f64 host=\"host0\"",
"stb2_5 1626006833710ms 3.15 host=\"host0\"" "stb2_5 1626006833710ms 3.15 host=\"host0\""
}; };
code = taos_schemaless_insert(taos, lines2_5, 11, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines2_5, 11, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines2_5 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_5 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
//bool //bool
char* lines2_6[] = { char* lines2_6[] = {
...@@ -137,10 +153,12 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -137,10 +153,12 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_6 1626006833690ms False host=\"host0\"", "stb2_6 1626006833690ms False host=\"host0\"",
"stb2_6 1626006833700ms FALSE host=\"host0\"" "stb2_6 1626006833700ms FALSE host=\"host0\""
}; };
code = taos_schemaless_insert(taos, lines2_6, 10, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines2_6, 10, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines2_6 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_6 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
//binary //binary
char* lines2_7[] = { char* lines2_7[] = {
...@@ -148,20 +166,24 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -148,20 +166,24 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_7 1626006833620ms \"binary_val.:;,./?|+-=\" host=\"host0\"", "stb2_7 1626006833620ms \"binary_val.:;,./?|+-=\" host=\"host0\"",
"stb2_7 1626006833630ms \"binary_val.()[]{}<>\" host=\"host0\"" "stb2_7 1626006833630ms \"binary_val.()[]{}<>\" host=\"host0\""
}; };
code = taos_schemaless_insert(taos, lines2_7, 3, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines2_7, 3, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines2_7 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_7 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
//nchar //nchar
char* lines2_8[] = { char* lines2_8[] = {
"stb2_8 1626006833610ms L\"nchar_val数值一\" host=\"host0\"", "stb2_8 1626006833610ms L\"nchar_val数值一\" host=\"host0\"",
"stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\"" "stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\""
}; };
code = taos_schemaless_insert(taos, lines2_8, 2, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines2_8, 2, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines2_8 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_8 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
/* tags */ /* tags */
//tag value types //tag value types
...@@ -169,10 +191,12 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -169,10 +191,12 @@ void verify_telnet_insert(TAOS* taos) {
"stb3_0 1626006833610ms 1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=\"binary_val_1\" t9=L\"标签值1\"", "stb3_0 1626006833610ms 1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=\"binary_val_1\" t9=L\"标签值1\"",
"stb3_0 1626006833610ms 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=\"binary_val_2\" t9=L\"标签值2\"" "stb3_0 1626006833610ms 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=\"binary_val_2\" t9=L\"标签值2\""
}; };
code = taos_schemaless_insert(taos, lines3_0, 2, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines3_0, 2, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines3_0 code: %d, %s.\n", code, tstrerror(code)); printf("lines3_0 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
//tag ID as child table name //tag ID as child table name
char* lines3_1[] = { char* lines3_1[] = {
...@@ -180,10 +204,12 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -180,10 +204,12 @@ void verify_telnet_insert(TAOS* taos) {
"stb3_1 1626006833610ms 2 host=host2 iD=child_table2", "stb3_1 1626006833610ms 2 host=host2 iD=child_table2",
"stb3_1 1626006833610ms 3 ID=child_table3 host=host3" "stb3_1 1626006833610ms 3 ID=child_table3 host=host3"
}; };
code = taos_schemaless_insert(taos, lines3_1, 3, 1, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, lines3_1, 3, SML_TELNET_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("lines3_1 code: %d, %s.\n", code, tstrerror(code)); printf("lines3_1 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
return; return;
} }
...@@ -214,10 +240,12 @@ void verify_json_insert(TAOS* taos) { ...@@ -214,10 +240,12 @@ void verify_json_insert(TAOS* taos) {
} \ } \
}"}; }"};
code = taos_schemaless_insert(taos, message, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, message, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload_0 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
char *message1[] = { char *message1[] = {
"[ \ "[ \
...@@ -245,10 +273,12 @@ void verify_json_insert(TAOS* taos) { ...@@ -245,10 +273,12 @@ void verify_json_insert(TAOS* taos) {
} \ } \
]"}; ]"};
code = taos_schemaless_insert(taos, message1, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, message1, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload_1 code: %d, %s.\n", code, tstrerror(code)); printf("payload_1 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
char *message2[] = { char *message2[] = {
"[ \ "[ \
...@@ -296,10 +326,12 @@ void verify_json_insert(TAOS* taos) { ...@@ -296,10 +326,12 @@ void verify_json_insert(TAOS* taos) {
} \ } \
} \ } \
]"}; ]"};
code = taos_schemaless_insert(taos, message2, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, message2, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload_2 code: %d, %s.\n", code, tstrerror(code)); printf("payload_2 code: %d, %s.\n", code, tstrerror(code));
} }
taos_free_result(result);
cJSON *payload, *tags; cJSON *payload, *tags;
...@@ -320,12 +352,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -320,12 +352,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload0_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_0 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//true //true
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -341,12 +375,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -341,12 +375,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload0_1 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_1 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//false //false
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -362,12 +398,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -362,12 +398,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload0_2 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_2 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//string //string
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -383,12 +421,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -383,12 +421,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload0_3 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_3 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//timestamp 0 -> current time //timestamp 0 -> current time
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -404,12 +444,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -404,12 +444,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload0_4 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_4 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
/* Nested format */ /* Nested format */
//timestamp //timestamp
...@@ -433,12 +475,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -433,12 +475,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload1_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload1_0 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//milleseconds //milleseconds
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -459,12 +503,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -459,12 +503,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload1_1 code: %d, %s.\n", code, tstrerror(code)); printf("payload1_1 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//microseconds //microseconds
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -485,12 +531,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -485,12 +531,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload1_2 code: %d, %s.\n", code, tstrerror(code)); printf("payload1_2 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//now //now
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -511,12 +559,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -511,12 +559,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload1_4 code: %d, %s.\n", code, tstrerror(code)); printf("payload1_4 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//metric value //metric value
cJSON *metric_val; cJSON *metric_val;
...@@ -543,12 +593,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -543,12 +593,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload2_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_0 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//tinyint //tinyint
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -573,12 +625,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -573,12 +625,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload2_1 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_1 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//smallint //smallint
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -603,12 +657,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -603,12 +657,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload2_2 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_2 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//int //int
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -633,12 +689,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -633,12 +689,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload2_3 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_3 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//bigint //bigint
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -663,12 +721,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -663,12 +721,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload2_4 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_4 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//float //float
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -693,12 +753,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -693,12 +753,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload2_5 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_5 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//double //double
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -723,12 +785,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -723,12 +785,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload2_6 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_6 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//binary //binary
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -753,12 +817,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -753,12 +817,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload2_7 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_7 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//nchar //nchar
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
...@@ -783,12 +849,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -783,12 +849,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload2_8 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_8 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
//tag value //tag value
cJSON *tag; cJSON *tag;
...@@ -863,12 +931,14 @@ void verify_json_insert(TAOS* taos) { ...@@ -863,12 +931,14 @@ void verify_json_insert(TAOS* taos) {
*payload_str = cJSON_Print(payload); *payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str); //printf("%s\n", payload_str);
code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL, NULL, NULL, 0); result = taos_schemaless_insert(taos, payload_str, 0, SML_JSON_PROTOCOL, SML_TIMESTAMP_NOT_CONFIGURED);
code = taos_errno(result);
if (code) { if (code) {
printf("payload3_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload3_0 code: %d, %s.\n", code, tstrerror(code));
} }
free(*payload_str); free(*payload_str);
cJSON_Delete(payload); cJSON_Delete(payload);
taos_free_result(result);
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册