提交 f7ba4b8d 编写于 作者: G Ganlin Zhao

[TD-10532]<enhance>: schemaless fix test cases

上级 3d110dd3
...@@ -47,7 +47,8 @@ typedef enum { ...@@ -47,7 +47,8 @@ typedef enum {
SML_TIME_STAMP_SECONDS, SML_TIME_STAMP_SECONDS,
SML_TIME_STAMP_MILLI_SECONDS, SML_TIME_STAMP_MILLI_SECONDS,
SML_TIME_STAMP_MICRO_SECONDS, SML_TIME_STAMP_MICRO_SECONDS,
SML_TIME_STAMP_NANO_SECONDS SML_TIME_STAMP_NANO_SECONDS,
SML_TIME_STAMP_NOT_CONFIGURED
} SMLTimeStampType; } SMLTimeStampType;
typedef enum { typedef enum {
......
...@@ -1408,7 +1408,7 @@ static bool isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType, SSml ...@@ -1408,7 +1408,7 @@ static bool isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType, SSml
//Default no appendix //Default no appendix
if (isdigit(pVal[len - 1]) && isdigit(pVal[len - 2])) { if (isdigit(pVal[len - 1]) && isdigit(pVal[len - 2])) {
if (info->protocol == SML_LINE_PROTOCOL) { if (info->protocol == SML_LINE_PROTOCOL && info->tsType != SML_TIME_STAMP_NOT_CONFIGURED) {
*tsType = info->tsType; *tsType = info->tsType;
} else if (info->protocol == SML_TELNET_PROTOCOL) { } else if (info->protocol == SML_TELNET_PROTOCOL) {
if (len == SML_TIMESTAMP_SECOND_DIGITS) { if (len == SML_TIMESTAMP_SECOND_DIGITS) {
...@@ -2018,8 +2018,7 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs, ...@@ -2018,8 +2018,7 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
tscError("SML:0x%"PRIx64" Unable to parse value", info->id); tscError("SML:0x%"PRIx64" Unable to parse value", info->id);
goto error; goto error;
} }
if (!isField && if (!isField && (strcasecmp(pkv->key, "ID") == 0)) {
(strcasecmp(pkv->key, "ID") == 0) && pkv->type == TSDB_DATA_TYPE_BINARY) {
ret = isValidChildTableName(pkv->value, pkv->length, info); ret = isValidChildTableName(pkv->value, pkv->length, info);
if (ret) { if (ret) {
goto error; goto error;
...@@ -2233,6 +2232,10 @@ cleanup: ...@@ -2233,6 +2232,10 @@ cleanup:
} }
int32_t convertPrecisionStrType(char* precision, SMLTimeStampType *tsType) { int32_t convertPrecisionStrType(char* precision, SMLTimeStampType *tsType) {
if (precision == NULL) {
*tsType = SML_TIME_STAMP_NOT_CONFIGURED;
return TSDB_CODE_SUCCESS;
}
int32_t len = (int32_t)strlen(precision); int32_t len = (int32_t)strlen(precision);
if (len == 1 && precision[0] == 's') { if (len == 1 && precision[0] == 's') {
*tsType = SML_TIME_STAMP_SECONDS; *tsType = SML_TIME_STAMP_SECONDS;
......
...@@ -297,7 +297,7 @@ static int32_t parseTelnetTagKvs(TAOS_SML_KV **pKVs, int *num_kvs, ...@@ -297,7 +297,7 @@ static int32_t parseTelnetTagKvs(TAOS_SML_KV **pKVs, int *num_kvs,
tscError("OTD:0x%"PRIx64" Unable to parse value", info->id); tscError("OTD:0x%"PRIx64" Unable to parse value", info->id);
return ret; return ret;
} }
if ((strcasecmp(pkv->key, "ID") == 0) && pkv->type == TSDB_DATA_TYPE_BINARY) { if ((strcasecmp(pkv->key, "ID") == 0)) {
ret = isValidChildTableName(pkv->value, pkv->length, info); ret = isValidChildTableName(pkv->value, pkv->length, info);
if (ret) { if (ret) {
return ret; return ret;
......
...@@ -990,7 +990,7 @@ int32_t verify_schema_less(TAOS* taos) { ...@@ -990,7 +990,7 @@ int32_t verify_schema_less(TAOS* taos) {
code = taos_schemaless_insert(taos, &lines2[1], 1, 0, "ns"); code = taos_schemaless_insert(taos, &lines2[1], 1, 0, "ns");
char* lines3[] = { char* lines3[] = {
"sth,t1=4i64,t2=5f64,t4=5f64,ID=\"childtable\" c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641", "sth,t1=4i64,t2=5f64,t4=5f64,ID=childTable c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641",
"sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933654" "sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933654"
}; };
code = taos_schemaless_insert(taos, lines3, 2, 0, "ms"); code = taos_schemaless_insert(taos, lines3, 2, 0, "ms");
...@@ -1036,6 +1036,7 @@ int main(int argc, char *argv[]) { ...@@ -1036,6 +1036,7 @@ int main(int argc, char *argv[]) {
printf("************ verify schema-less *************\n"); printf("************ verify schema-less *************\n");
verify_schema_less(taos); verify_schema_less(taos);
return 0;
printf("************ verify query *************\n"); printf("************ verify query *************\n");
verify_query(taos); verify_query(taos);
......
...@@ -36,7 +36,7 @@ class TDTestCase: ...@@ -36,7 +36,7 @@ class TDTestCase:
payload = [''' payload = ['''
{ {
"metric": ".stb.0.", "metric": ".stb.0.",
"timestamp": 1626006833610123, "timestamp": 1626006833610,
"value": 10, "value": 10,
"tags": { "tags": {
"t1": true, "t1": true,
...@@ -57,7 +57,7 @@ class TDTestCase: ...@@ -57,7 +57,7 @@ class TDTestCase:
payload = [''' payload = ['''
{ {
"metric": "stb0_0", "metric": "stb0_0",
"timestamp": 1626006833610123, "timestamp": 1626006833610,
"value": 10, "value": 10,
"tags": { "tags": {
"t1": true, "t1": true,
...@@ -76,7 +76,7 @@ class TDTestCase: ...@@ -76,7 +76,7 @@ class TDTestCase:
payload = [''' payload = ['''
{ {
"metric": "stb0_1", "metric": "stb0_1",
"timestamp": 1626006833610123, "timestamp": 1626006833610,
"value": true, "value": true,
"tags": { "tags": {
"t1": true, "t1": true,
...@@ -95,7 +95,7 @@ class TDTestCase: ...@@ -95,7 +95,7 @@ class TDTestCase:
payload = [''' payload = ['''
{ {
"metric": "stb0_2", "metric": "stb0_2",
"timestamp": 1626006833610123, "timestamp": 1626006833610,
"value": false, "value": false,
"tags": { "tags": {
"t1": true, "t1": true,
...@@ -114,7 +114,7 @@ class TDTestCase: ...@@ -114,7 +114,7 @@ class TDTestCase:
payload = [''' payload = ['''
{ {
"metric": "stb0_3", "metric": "stb0_3",
"timestamp": 1626006833610123, "timestamp": 1626006833610,
"value": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>", "value": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>",
"tags": { "tags": {
"t1": true, "t1": true,
...@@ -133,7 +133,7 @@ class TDTestCase: ...@@ -133,7 +133,7 @@ class TDTestCase:
payload = [''' payload = ['''
{ {
"metric": "stb0_4", "metric": "stb0_4",
"timestamp": 1626006833610123, "timestamp": 1626006833610,
"value": 3.14, "value": 3.14,
"tags": { "tags": {
"t1": true, "t1": true,
...@@ -152,7 +152,7 @@ class TDTestCase: ...@@ -152,7 +152,7 @@ class TDTestCase:
payload = [''' payload = ['''
{ {
"metric": "stb0_5", "metric": "stb0_5",
"timestamp": 1626006833610123, "timestamp": 1626006833610,
"value": 3.14E-2, "value": 3.14E-2,
"tags": { "tags": {
"t1": true, "t1": true,
...@@ -187,6 +187,22 @@ class TDTestCase: ...@@ -187,6 +187,22 @@ class TDTestCase:
code = self._conn.schemaless_insert(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("schemaless_insert result {}".format(code)) print("schemaless_insert result {}".format(code))
### timestamp 10 digits second ###
payload = ['''
{
"metric": "stb0_7",
"timestamp": 1626006833,
"value": 123,
"tags": {
"t1": true,
"t2": false,
"t3": 10,
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
''']
code = self._conn.schemaless_insert(payload, 2)
print("schemaless_insert result {}".format(code))
print("============= step3 : test tags ================") print("============= step3 : test tags ================")
### Default tag numeric types ### ### Default tag numeric types ###
......
...@@ -63,16 +63,17 @@ class TDTestCase: ...@@ -63,16 +63,17 @@ class TDTestCase:
"stb1 1626006833s 1i8 host=\"host0\"", "stb1 1626006833s 1i8 host=\"host0\"",
"stb1 1626006833639000000ns 2i8 host=\"host0\"", "stb1 1626006833639000000ns 2i8 host=\"host0\"",
"stb1 1626006833640000us 3i8 host=\"host0\"", "stb1 1626006833640000us 3i8 host=\"host0\"",
"stb1 1626006833641123 4i8 host=\"host0\"", "stb1 1626006833641 4i8 host=\"host0\"",
"stb1 1626006833651ms 5i8 host=\"host0\"", "stb1 1626006834 5i8 host=\"host0\"",
"stb1 0 6i8 host=\"host0\"", "stb1 1626006833651ms 6i8 host=\"host0\"",
"stb1 0 7i8 host=\"host0\"",
] ]
code = self._conn.schemaless_insert(lines1, 1) code = self._conn.schemaless_insert(lines1, 1)
print("schemaless_insert result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb1") tdSql.query("select * from stb1")
tdSql.checkRows(6) tdSql.checkRows(7)
### metric value ### ### metric value ###
print("============= step3 : test metric value ================") print("============= step3 : test metric value ================")
...@@ -126,15 +127,14 @@ class TDTestCase: ...@@ -126,15 +127,14 @@ class TDTestCase:
#bigint #bigint
lines2_3 = [ 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\""
"stb2_3 1626006833662ms 9223372036854775807 host=\"host0\""
] ]
code = self._conn.schemaless_insert(lines2_3, 1) code = self._conn.schemaless_insert(lines2_3, 1)
print("schemaless_insert result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_3") tdSql.query("select * from stb2_3")
tdSql.checkRows(3) tdSql.checkRows(2)
tdSql.query("describe stb2_3") tdSql.query("describe stb2_3")
tdSql.checkRows(3) tdSql.checkRows(3)
...@@ -176,7 +176,7 @@ class TDTestCase: ...@@ -176,7 +176,7 @@ class TDTestCase:
"stb2_5 1626006833680ms -3.4e-2f64 host=\"host0\"", "stb2_5 1626006833680ms -3.4e-2f64 host=\"host0\"",
"stb2_5 1626006833690ms 1.7E308f64 host=\"host0\"", "stb2_5 1626006833690ms 1.7E308f64 host=\"host0\"",
"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 host=\"host0\""
] ]
code = self._conn.schemaless_insert(lines2_5, 1) code = self._conn.schemaless_insert(lines2_5, 1)
...@@ -263,28 +263,28 @@ class TDTestCase: ...@@ -263,28 +263,28 @@ class TDTestCase:
tdSql.query("describe stb3_0") tdSql.query("describe stb3_0")
tdSql.checkRows(11) tdSql.checkRows(11)
tdSql.checkData(2, 1, "TINYINT") tdSql.checkData(2, 1, "NCHAR")
tdSql.checkData(2, 3, "TAG") tdSql.checkData(2, 3, "TAG")
tdSql.checkData(3, 1, "SMALLINT") tdSql.checkData(3, 1, "NCHAR")
tdSql.checkData(3, 3, "TAG") tdSql.checkData(3, 3, "TAG")
tdSql.checkData(4, 1, "INT") tdSql.checkData(4, 1, "NCHAR")
tdSql.checkData(4, 3, "TAG") tdSql.checkData(4, 3, "TAG")
tdSql.checkData(5, 1, "BIGINT") tdSql.checkData(5, 1, "NCHAR")
tdSql.checkData(5, 3, "TAG") tdSql.checkData(5, 3, "TAG")
tdSql.checkData(6, 1, "FLOAT") tdSql.checkData(6, 1, "NCHAR")
tdSql.checkData(6, 3, "TAG") tdSql.checkData(6, 3, "TAG")
tdSql.checkData(7, 1, "DOUBLE") tdSql.checkData(7, 1, "NCHAR")
tdSql.checkData(7, 3, "TAG") tdSql.checkData(7, 3, "TAG")
tdSql.checkData(8, 1, "BOOL") tdSql.checkData(8, 1, "NCHAR")
tdSql.checkData(8, 3, "TAG") tdSql.checkData(8, 3, "TAG")
tdSql.checkData(9, 1, "BINARY") tdSql.checkData(9, 1, "NCHAR")
tdSql.checkData(9, 3, "TAG") tdSql.checkData(9, 3, "TAG")
tdSql.checkData(10, 1, "NCHAR") tdSql.checkData(10, 1, "NCHAR")
...@@ -293,9 +293,9 @@ class TDTestCase: ...@@ -293,9 +293,9 @@ class TDTestCase:
#tag ID as child table name #tag ID as child table name
lines3_1 = [ lines3_1 = [
"stb3_1 1626006833610ms 1 id=\"child_table1\" host=\"host1\"", "stb3_1 1626006833610ms 1 id=child_table1 host=host1",
"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 = self._conn.schemaless_insert(lines3_1, 1) code = self._conn.schemaless_insert(lines3_1, 1)
......
...@@ -26,7 +26,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -26,7 +26,7 @@ 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); code = taos_schemaless_insert(taos, lines0, 3, 1, NULL);
if (code) { if (code) {
printf("lines0 code: %d, %s.\n", code, tstrerror(code)); printf("lines0 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -36,11 +36,12 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -36,11 +36,12 @@ void verify_telnet_insert(TAOS* taos) {
"stb1 1626006833s 1i8 host=\"host0\"", "stb1 1626006833s 1i8 host=\"host0\"",
"stb1 1626006833639000000ns 2i8 host=\"host0\"", "stb1 1626006833639000000ns 2i8 host=\"host0\"",
"stb1 1626006833640000us 3i8 host=\"host0\"", "stb1 1626006833640000us 3i8 host=\"host0\"",
"stb1 1626006833641123 4i8 host=\"host0\"", "stb1 1626006833641 4i8 host=\"host0\"",
"stb1 1626006833651ms 5i8 host=\"host0\"", "stb1 1626006832 5i8 host=\"host0\"",
"stb1 0 6i8 host=\"host0\"", "stb1 1626006833651ms 6i8 host=\"host0\"",
"stb1 0 7i8 host=\"host0\"",
}; };
code = taos_schemaless_insert(taos, lines1, 6, 1); code = taos_schemaless_insert(taos, lines1, 7, 1, NULL);
if (code) { if (code) {
printf("lines1 code: %d, %s.\n", code, tstrerror(code)); printf("lines1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -51,7 +52,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -51,7 +52,7 @@ 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); code = taos_schemaless_insert(taos, lines2_0, 2, 1, NULL);
if (code) { if (code) {
printf("lines2_0 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_0 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -61,7 +62,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -61,7 +62,7 @@ void verify_telnet_insert(TAOS* taos) {
"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); code = taos_schemaless_insert(taos, lines2_1, 2, 1, NULL);
if (code) { if (code) {
printf("lines2_1 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -71,7 +72,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -71,7 +72,7 @@ void verify_telnet_insert(TAOS* taos) {
"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); code = taos_schemaless_insert(taos, lines2_2, 2, 1, NULL);
if (code) { if (code) {
printf("lines2_2 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_2 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -79,10 +80,9 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -79,10 +80,9 @@ void verify_telnet_insert(TAOS* taos) {
//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\""
"stb2_3 1626006833662ms 9223372036854775807 host=\"host0\""
}; };
code = taos_schemaless_insert(taos, lines2_3, 3, 1); code = taos_schemaless_insert(taos, lines2_3, 2, 1, NULL);
if (code) { if (code) {
printf("lines2_3 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_3 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -100,7 +100,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -100,7 +100,7 @@ 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); code = taos_schemaless_insert(taos, lines2_4, 10, 1, NULL);
if (code) { if (code) {
printf("lines2_4 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_4 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -119,7 +119,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -119,7 +119,7 @@ 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); code = taos_schemaless_insert(taos, lines2_5, 11, 1, NULL);
if (code) { if (code) {
printf("lines2_5 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_5 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -137,7 +137,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -137,7 +137,7 @@ 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); code = taos_schemaless_insert(taos, lines2_6, 10, 1, NULL);
if (code) { if (code) {
printf("lines2_6 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_6 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -148,7 +148,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -148,7 +148,7 @@ 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); code = taos_schemaless_insert(taos, lines2_7, 3, 1, NULL);
if (code) { if (code) {
printf("lines2_7 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_7 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -158,7 +158,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -158,7 +158,7 @@ void verify_telnet_insert(TAOS* taos) {
"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); code = taos_schemaless_insert(taos, lines2_8, 2, 1, NULL);
if (code) { if (code) {
printf("lines2_8 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_8 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -169,18 +169,18 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -169,18 +169,18 @@ 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); code = taos_schemaless_insert(taos, lines3_0, 2, 1, NULL);
if (code) { if (code) {
printf("lines3_0 code: %d, %s.\n", code, tstrerror(code)); printf("lines3_0 code: %d, %s.\n", code, tstrerror(code));
} }
//tag ID as child table name //tag ID as child table name
char* lines3_1[] = { char* lines3_1[] = {
"stb3_1 1626006833610ms 1 id=\"child_table1\" host=\"host1\"", "stb3_1 1626006833610ms 1 id=child_table1 host=host1",
"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); code = taos_schemaless_insert(taos, lines3_1, 3, 1, NULL);
if (code) { if (code) {
printf("lines3_1 code: %d, %s.\n", code, tstrerror(code)); printf("lines3_1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -204,7 +204,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -204,7 +204,7 @@ void verify_json_insert(TAOS* taos) {
char *message[] = { char *message[] = {
"{ \ "{ \
\"metric\":\"cpu_load_0\", \ \"metric\":\"cpu_load_0\", \
\"timestamp\": 1626006833610123, \ \"timestamp\": 1626006833610, \
\"value\": 55.5, \ \"value\": 55.5, \
\"tags\": \ \"tags\": \
{ \ { \
...@@ -214,7 +214,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -214,7 +214,7 @@ void verify_json_insert(TAOS* taos) {
} \ } \
}"}; }"};
code = taos_schemaless_insert(taos, message, 0, 2); code = taos_schemaless_insert(taos, message, 0, 2, NULL);
if (code) { if (code) {
printf("payload_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload_0 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -223,7 +223,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -223,7 +223,7 @@ void verify_json_insert(TAOS* taos) {
"[ \ "[ \
{ \ { \
\"metric\":\"cpu_load_1\", \ \"metric\":\"cpu_load_1\", \
\"timestamp\": 1626006833610123, \ \"timestamp\": 1626006833610, \
\"value\": 55.5, \ \"value\": 55.5, \
\"tags\": \ \"tags\": \
{ \ { \
...@@ -234,7 +234,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -234,7 +234,7 @@ void verify_json_insert(TAOS* taos) {
}, \ }, \
{ \ { \
\"metric\":\"cpu_load_2\", \ \"metric\":\"cpu_load_2\", \
\"timestamp\": 1626006833610123, \ \"timestamp\": 1626006833610, \
\"value\": 55.5, \ \"value\": 55.5, \
\"tags\": \ \"tags\": \
{ \ { \
...@@ -245,7 +245,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -245,7 +245,7 @@ void verify_json_insert(TAOS* taos) {
} \ } \
]"}; ]"};
code = taos_schemaless_insert(taos, message1, 0, 2); code = taos_schemaless_insert(taos, message1, 0, 2, NULL);
if (code) { if (code) {
printf("payload_1 code: %d, %s.\n", code, tstrerror(code)); printf("payload_1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -256,8 +256,8 @@ void verify_json_insert(TAOS* taos) { ...@@ -256,8 +256,8 @@ void verify_json_insert(TAOS* taos) {
\"metric\":\"cpu_load_3\", \ \"metric\":\"cpu_load_3\", \
\"timestamp\": \ \"timestamp\": \
{ \ { \
\"value\": 1626006833610123, \ \"value\": 1626006833610, \
\"type\": \"us\" \ \"type\": \"ms\" \
}, \ }, \
\"value\": \ \"value\": \
{ \ { \
...@@ -286,7 +286,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -286,7 +286,7 @@ void verify_json_insert(TAOS* taos) {
}, \ }, \
{ \ { \
\"metric\":\"cpu_load_4\", \ \"metric\":\"cpu_load_4\", \
\"timestamp\": 1626006833610123, \ \"timestamp\": 1626006833610, \
\"value\": 66.6, \ \"value\": 66.6, \
\"tags\": \ \"tags\": \
{ \ { \
...@@ -296,7 +296,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -296,7 +296,7 @@ void verify_json_insert(TAOS* taos) {
} \ } \
} \ } \
]"}; ]"};
code = taos_schemaless_insert(taos, message2, 0, 2); code = taos_schemaless_insert(taos, message2, 0, 2, NULL);
if (code) { if (code) {
printf("payload_2 code: %d, %s.\n", code, tstrerror(code)); printf("payload_2 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -309,7 +309,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -309,7 +309,7 @@ void verify_json_insert(TAOS* taos) {
//number //number
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_0"); cJSON_AddStringToObject(payload, "metric", "stb0_0");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); cJSON_AddNumberToObject(payload, "timestamp", 1626006833610);
cJSON_AddNumberToObject(payload, "value", 10); cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject(); tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1"); cJSON_AddTrueToObject(tags, "t1");
...@@ -320,7 +320,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -320,7 +320,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload0_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_0 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -330,7 +330,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -330,7 +330,7 @@ void verify_json_insert(TAOS* taos) {
//true //true
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_1"); cJSON_AddStringToObject(payload, "metric", "stb0_1");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); cJSON_AddNumberToObject(payload, "timestamp", 1626006833610);
cJSON_AddTrueToObject(payload, "value"); cJSON_AddTrueToObject(payload, "value");
tags = cJSON_CreateObject(); tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1"); cJSON_AddTrueToObject(tags, "t1");
...@@ -341,7 +341,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -341,7 +341,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload0_1 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -351,7 +351,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -351,7 +351,7 @@ void verify_json_insert(TAOS* taos) {
//false //false
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_2"); cJSON_AddStringToObject(payload, "metric", "stb0_2");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); cJSON_AddNumberToObject(payload, "timestamp", 1626006833610);
cJSON_AddFalseToObject(payload, "value"); cJSON_AddFalseToObject(payload, "value");
tags = cJSON_CreateObject(); tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1"); cJSON_AddTrueToObject(tags, "t1");
...@@ -362,7 +362,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -362,7 +362,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload0_2 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_2 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -372,7 +372,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -372,7 +372,7 @@ void verify_json_insert(TAOS* taos) {
//string //string
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb0_3"); cJSON_AddStringToObject(payload, "metric", "stb0_3");
cJSON_AddNumberToObject(payload, "timestamp", 1626006833610123); cJSON_AddNumberToObject(payload, "timestamp", 1626006833610);
cJSON_AddStringToObject(payload, "value", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"); cJSON_AddStringToObject(payload, "value", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
tags = cJSON_CreateObject(); tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1"); cJSON_AddTrueToObject(tags, "t1");
...@@ -383,7 +383,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -383,7 +383,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload0_3 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_3 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -404,7 +404,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -404,7 +404,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload0_4 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_4 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -433,7 +433,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -433,7 +433,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload1_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload1_0 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -459,7 +459,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -459,7 +459,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload1_1 code: %d, %s.\n", code, tstrerror(code)); printf("payload1_1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -485,7 +485,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -485,7 +485,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload1_2 code: %d, %s.\n", code, tstrerror(code)); printf("payload1_2 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -511,7 +511,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -511,7 +511,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload1_4 code: %d, %s.\n", code, tstrerror(code)); printf("payload1_4 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -543,7 +543,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -543,7 +543,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload2_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_0 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -573,7 +573,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -573,7 +573,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload2_1 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -603,7 +603,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -603,7 +603,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload2_2 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_2 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -633,7 +633,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -633,7 +633,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload2_3 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_3 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -663,7 +663,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -663,7 +663,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload2_4 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_4 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -693,7 +693,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -693,7 +693,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload2_5 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_5 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -723,7 +723,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -723,7 +723,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload2_6 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_6 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -753,7 +753,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -753,7 +753,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload2_7 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_7 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -783,7 +783,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -783,7 +783,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload2_8 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_8 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -863,7 +863,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -863,7 +863,7 @@ 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); code = taos_schemaless_insert(taos, payload_str, 0, 2, NULL);
if (code) { if (code) {
printf("payload3_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload3_0 code: %d, %s.\n", code, tstrerror(code));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册