提交 0182f95c 编写于 作者: G Ganlin Zhao

[TD-10445]<enhance>: change API name from taos_insert_lines to taos_schemaless_insert

上级 c19535c2
...@@ -1070,7 +1070,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(J ...@@ -1070,7 +1070,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(J
c_lines[i] = (char *)(*env)->GetStringUTFChars(env, line, 0); c_lines[i] = (char *)(*env)->GetStringUTFChars(env, line, 0);
} }
int code = taos_insert_lines(taos, c_lines, numLines, 0); int code = taos_schemaless_insert(taos, c_lines, numLines, 0);
for (int i = 0; i < numLines; ++i) { for (int i = 0; i < numLines; ++i) {
jstring line = (jstring)((*env)->GetObjectArrayElement(env, lines, i)); jstring line = (jstring)((*env)->GetObjectArrayElement(env, lines, i));
......
...@@ -2132,7 +2132,7 @@ int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* faile ...@@ -2132,7 +2132,7 @@ int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* faile
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int taos_insert_sml_lines(TAOS* taos, char* lines[], int numLines) { int taos_insert_lines(TAOS* taos, char* lines[], int numLines) {
int32_t code = 0; int32_t code = 0;
SSmlLinesInfo* info = tcalloc(1, sizeof(SSmlLinesInfo)); SSmlLinesInfo* info = tcalloc(1, sizeof(SSmlLinesInfo));
...@@ -2190,7 +2190,7 @@ cleanup: ...@@ -2190,7 +2190,7 @@ cleanup:
} }
/** /**
* taos_insert lines() parse and insert data points into database according to * taos_schemaless_insert() parse and insert data points into database according to
* different protocol. * different protocol.
* *
* @param $lines input array may contain multiple lines, each line indicates a data point. * @param $lines input array may contain multiple lines, each line indicates a data point.
...@@ -2210,11 +2210,11 @@ cleanup: ...@@ -2210,11 +2210,11 @@ cleanup:
* *
*/ */
int taos_insert_lines(TAOS* taos, char* lines[], int numLines, int protocol) { int taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int protocol) {
int code; int code;
switch (protocol) { switch (protocol) {
case SML_LINE_PROTOCOL: case SML_LINE_PROTOCOL:
code = taos_insert_sml_lines(taos, lines, numLines); code = taos_insert_lines(taos, lines, numLines);
break; break;
case SML_TELNET_PROTOCOL: case SML_TELNET_PROTOCOL:
code = taos_insert_telnet_lines(taos, lines, numLines); code = taos_insert_telnet_lines(taos, lines, numLines);
......
...@@ -404,13 +404,13 @@ lines = [ ...@@ -404,13 +404,13 @@ lines = [
'st,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"pass it again",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns', 'st,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"pass it again",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns',
'stf,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"pass it again_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns', 'stf,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"pass it again_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns',
] ]
conn.insert_lines(lines) conn.schemaless_insert(lines)
print("inserted") print("inserted")
lines = [ lines = [
'stf,t1=5i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"pass it again_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns', 'stf,t1=5i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"pass it again_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns',
] ]
conn.insert_lines(lines) conn.schemaless_insert(lines)
result = conn.query("show tables") result = conn.query("show tables")
for row in result: for row in result:
......
...@@ -9,10 +9,10 @@ conn.select_db(dbname) ...@@ -9,10 +9,10 @@ conn.select_db(dbname)
lines = [ lines = [
'st,t1=3i64,t2=4f64,t3="t3" c1=3i64,c3=L"pass",c2=false,c4=4f64 1626006833639000000ns', 'st,t1=3i64,t2=4f64,t3="t3" c1=3i64,c3=L"pass",c2=false,c4=4f64 1626006833639000000ns',
] ]
conn.insert_lines(lines) conn.schemaless_insert(lines)
print("inserted") print("inserted")
conn.insert_lines(lines) conn.schemaless_insert(lines)
result = conn.query("show tables") result = conn.query("show tables")
for row in result: for row in result:
......
...@@ -406,13 +406,13 @@ lines = [ ...@@ -406,13 +406,13 @@ lines = [
'st,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns', 'st,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns',
'stf,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns', 'stf,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns',
] ]
conn.insert_lines(lines) conn.schemaless_insert(lines)
print("inserted") print("inserted")
lines = [ lines = [
'stf,t1=5i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns', 'stf,t1=5i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns',
] ]
conn.insert_lines(lines) conn.schemaless_insert(lines)
result = conn.query("show tables") result = conn.query("show tables")
for row in result: for row in result:
......
...@@ -809,40 +809,23 @@ def taos_stmt_use_result(stmt): ...@@ -809,40 +809,23 @@ def taos_stmt_use_result(stmt):
return result return result
try: try:
_libtaos.taos_insert_lines.restype = c_int _libtaos.taos_schemaless_insert.restype = c_int
_libtaos.taos_insert_lines.argstype = c_void_p, c_void_p, c_int _libtaos.taos_schemaless_insert.argstype = c_void_p, c_void_p, c_int
except AttributeError: except AttributeError:
print("WARNING: libtaos(%s) does not support insert_lines" % taos_get_client_info()) print("WARNING: libtaos(%s) does not support schemaless_insert" % taos_get_client_info())
def taos_insert_lines(connection, lines, protocol): def taos_schemaless_insert(connection, lines, protocol):
# type: (c_void_p, list[str] | tuple(str)) -> None # type: (c_void_p, list[str] | tuple(str)) -> None
num_of_lines = len(lines) num_of_lines = len(lines)
lines = (c_char_p(line.encode("utf-8")) for line in lines) lines = (c_char_p(line.encode("utf-8")) for line in lines)
lines_type = ctypes.c_char_p * num_of_lines lines_type = ctypes.c_char_p * num_of_lines
p_lines = lines_type(*lines) p_lines = lines_type(*lines)
errno = _libtaos.taos_insert_lines(connection, p_lines, num_of_lines, protocol) errno = _libtaos.taos_schemaless_insert(connection, p_lines, num_of_lines, protocol)
if errno != 0: if errno != 0:
raise LinesError("insert lines error", errno) raise SchemalessError("schemaless insert error", errno)
def taos_insert_telnet_lines(connection, lines):
# type: (c_void_p, list[str] | tuple(str)) -> None
num_of_lines = len(lines)
lines = (c_char_p(line.encode("utf-8")) for line in lines)
lines_type = ctypes.c_char_p * num_of_lines
p_lines = lines_type(*lines)
errno = _libtaos.taos_insert_telnet_lines(connection, p_lines, num_of_lines)
if errno != 0:
raise TelnetLinesError("insert telnet lines error", errno)
def taos_insert_json_payload(connection, payload):
# type: (c_void_p, list[str] | tuple(str)) -> None
payload = payload.encode("utf-8")
errno = _libtaos.taos_insert_json_payload(connection, payload)
if errno != 0:
raise JsonPayloadError("insert json payload error", errno)
class CTaosInterface(object): class CTaosInterface(object):
def __init__(self, config=None): def __init__(self, config=None):
......
...@@ -117,7 +117,7 @@ class TaosConnection(object): ...@@ -117,7 +117,7 @@ class TaosConnection(object):
stream = taos_open_stream(self._conn, sql, callback, stime, param, callback2) stream = taos_open_stream(self._conn, sql, callback, stime, param, callback2)
return TaosStream(stream) return TaosStream(stream)
def insert_lines(self, lines, protocol): def schemaless_insert(self, lines, protocol):
# type: (list[str]) -> None # type: (list[str]) -> None
""" """
1.Line protocol and schemaless support 1.Line protocol and schemaless support
...@@ -132,7 +132,7 @@ class TaosConnection(object): ...@@ -132,7 +132,7 @@ class TaosConnection(object):
lines = [ lines = [
'ste,t2=5,t3=L"ste" c1=true,c2=4,c3="string" 1626056811855516532', 'ste,t2=5,t3=L"ste" c1=true,c2=4,c3="string" 1626056811855516532',
] ]
conn.insert_lines(lines) conn.schemaless_insert(lines)
``` ```
2.OpenTSDB telnet style API format support 2.OpenTSDB telnet style API format support
...@@ -160,13 +160,13 @@ class TaosConnection(object): ...@@ -160,13 +160,13 @@ class TaosConnection(object):
```python ```python
try: try:
conn.insert_lines(lines) conn.schemaless_insert(lines)
except SchemalessError as err: except SchemalessError as err:
print(err) print(err)
``` ```
""" """
return taos_insert_lines(self._conn, lines, protocol) return taos_schemaless_insert(self._conn, lines, protocol)
def cursor(self): def cursor(self):
......
...@@ -80,17 +80,7 @@ class ResultError(DatabaseError): ...@@ -80,17 +80,7 @@ class ResultError(DatabaseError):
pass pass
class LinesError(DatabaseError): class SchemalessError(DatabaseError):
"""taos_insert_lines errors.""" """taos_schemaless_insert errors."""
pass
class TelnetLinesError(DatabaseError):
"""taos_insert_telnet_lines errors."""
pass
class JsonPayloadError(DatabaseError):
"""taos_insert_json_payload errors."""
pass pass
...@@ -13,10 +13,10 @@ def conn(): ...@@ -13,10 +13,10 @@ def conn():
return connect() return connect()
def test_insert_lines(conn): def test_schemaless_insert(conn):
# type: (TaosConnection) -> None # type: (TaosConnection) -> None
dbname = "pytest_taos_insert_lines" dbname = "pytest_taos_schemaless_insert"
try: try:
conn.execute("drop database if exists %s" % dbname) conn.execute("drop database if exists %s" % dbname)
conn.execute("create database if not exists %s precision 'us'" % dbname) conn.execute("create database if not exists %s precision 'us'" % dbname)
...@@ -27,13 +27,13 @@ def test_insert_lines(conn): ...@@ -27,13 +27,13 @@ def test_insert_lines(conn):
'st,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns', 'st,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns',
'stf,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns', 'stf,t1=4i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns',
] ]
conn.insert_lines(lines) conn.schemaless_insert(lines)
print("inserted") print("inserted")
lines = [ lines = [
'stf,t1=5i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns', 'stf,t1=5i64,t3="t4",t2=5f64,t4=5f64 c1=3i64,c3=L"passitagin_stf",c2=false,c5=5f64,c6=7u64 1626006933641000000ns',
] ]
conn.insert_lines(lines) conn.schemaless_insert(lines)
print("inserted") print("inserted")
result = conn.query("select * from st") result = conn.query("select * from st")
print(*result.fields) print(*result.fields)
...@@ -54,4 +54,4 @@ def test_insert_lines(conn): ...@@ -54,4 +54,4 @@ def test_insert_lines(conn):
if __name__ == "__main__": if __name__ == "__main__":
test_insert_lines(connect()) test_schemaless_insert(connect())
...@@ -187,7 +187,7 @@ DLL_EXPORT void taos_close_stream(TAOS_STREAM *tstr); ...@@ -187,7 +187,7 @@ DLL_EXPORT void taos_close_stream(TAOS_STREAM *tstr);
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char* tableNameList); DLL_EXPORT int taos_load_table_info(TAOS *taos, const char* tableNameList);
DLL_EXPORT int taos_insert_lines(TAOS* taos, char* lines[], int numLines, int protocol); DLL_EXPORT int taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int protocol);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -980,40 +980,40 @@ int32_t verify_schema_less(TAOS* taos) { ...@@ -980,40 +980,40 @@ int32_t verify_schema_less(TAOS* taos) {
"stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns" "stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns"
}; };
code = taos_insert_lines(taos, lines , sizeof(lines)/sizeof(char*), 0); code = taos_schemaless_insert(taos, lines , sizeof(lines)/sizeof(char*), 0);
char* lines2[] = { char* lines2[] = {
"stg,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", "stg,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns",
"stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns" "stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns"
}; };
code = taos_insert_lines(taos, &lines2[0], 1, 0); code = taos_schemaless_insert(taos, &lines2[0], 1, 0);
code = taos_insert_lines(taos, &lines2[1], 1, 0); code = taos_schemaless_insert(taos, &lines2[1], 1, 0);
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 1626006933641ms", "sth,t1=4i64,t2=5f64,t4=5f64,ID=\"childtable\" c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641ms",
"sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933654ms" "sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933654ms"
}; };
code = taos_insert_lines(taos, lines3, 2, 0); code = taos_schemaless_insert(taos, lines3, 2, 0);
char* lines4[] = { char* lines4[] = {
"st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", "st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns",
"dgtyqodr,t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns" "dgtyqodr,t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"
}; };
code = taos_insert_lines(taos, lines4, 2, 0); code = taos_schemaless_insert(taos, lines4, 2, 0);
char* lines5[] = { char* lines5[] = {
"zqlbgs,id=\"zqlbgs_39302_21680\",t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000ns", "zqlbgs,id=\"zqlbgs_39302_21680\",t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000ns",
"zqlbgs,t9=f,id=\"zqlbgs_39302_21680\",t0=f,t1=127i8,t11=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\",t10=L\"ncharTagValue\" c10=f,c0=f,c1=127i8,c12=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64,c11=L\"ncharColValue\" 1626006833639000000ns" "zqlbgs,t9=f,id=\"zqlbgs_39302_21680\",t0=f,t1=127i8,t11=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\",t10=L\"ncharTagValue\" c10=f,c0=f,c1=127i8,c12=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64,c11=L\"ncharColValue\" 1626006833639000000ns"
}; };
code = taos_insert_lines(taos, &lines5[0], 1, 0); code = taos_schemaless_insert(taos, &lines5[0], 1, 0);
code = taos_insert_lines(taos, &lines5[1], 1, 0); code = taos_schemaless_insert(taos, &lines5[1], 1, 0);
char* lines6[] = { char* lines6[] = {
"st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", "st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns",
"dgtyqodr,t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns" "dgtyqodr,t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"
}; };
code = taos_insert_lines(taos, lines6, 2, 0); code = taos_schemaless_insert(taos, lines6, 2, 0);
return (code); return (code);
} }
......
...@@ -77,9 +77,9 @@ int main(int argc, char* argv[]) { ...@@ -77,9 +77,9 @@ int main(int argc, char* argv[]) {
} }
//shuffle(lines, numSuperTables * numChildTables * numRowsPerChildTable); //shuffle(lines, numSuperTables * numChildTables * numRowsPerChildTable);
printf("%s\n", "begin taos_insert_lines"); printf("%s\n", "begin taos_schemaless_insert");
int64_t begin = getTimeInUs(); int64_t begin = getTimeInUs();
int32_t code = taos_insert_lines(taos, lines, numSuperTables * numChildTables * numRowsPerChildTable, 0); int32_t code = taos_schemaless_insert(taos, lines, numSuperTables * numChildTables * numRowsPerChildTable, 0);
int64_t end = getTimeInUs(); int64_t end = getTimeInUs();
printf("code: %d, %s. time used: %"PRId64"\n", code, tstrerror(code), end-begin); printf("code: %d, %s. time used: %"PRId64"\n", code, tstrerror(code), end-begin);
......
...@@ -46,8 +46,8 @@ class TDTestCase: ...@@ -46,8 +46,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe _stb_0_") tdSql.query("describe _stb_0_")
tdSql.checkRows(6) tdSql.checkRows(6)
...@@ -67,8 +67,8 @@ class TDTestCase: ...@@ -67,8 +67,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_0") tdSql.query("describe stb0_0")
tdSql.checkData(1, 1, "BIGINT") tdSql.checkData(1, 1, "BIGINT")
...@@ -86,8 +86,8 @@ class TDTestCase: ...@@ -86,8 +86,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_1") tdSql.query("describe stb0_1")
tdSql.checkData(1, 1, "BOOL") tdSql.checkData(1, 1, "BOOL")
...@@ -105,8 +105,8 @@ class TDTestCase: ...@@ -105,8 +105,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_2") tdSql.query("describe stb0_2")
tdSql.checkData(1, 1, "BOOL") tdSql.checkData(1, 1, "BOOL")
...@@ -124,8 +124,8 @@ class TDTestCase: ...@@ -124,8 +124,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_3") tdSql.query("describe stb0_3")
tdSql.checkData(1, 1, "BINARY") tdSql.checkData(1, 1, "BINARY")
...@@ -143,8 +143,8 @@ class TDTestCase: ...@@ -143,8 +143,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_4") tdSql.query("describe stb0_4")
tdSql.checkData(1, 1, "DOUBLE") tdSql.checkData(1, 1, "DOUBLE")
...@@ -162,8 +162,8 @@ class TDTestCase: ...@@ -162,8 +162,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_5") tdSql.query("describe stb0_5")
tdSql.checkData(1, 1, "DOUBLE") tdSql.checkData(1, 1, "DOUBLE")
...@@ -184,8 +184,8 @@ class TDTestCase: ...@@ -184,8 +184,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
print("============= step3 : test tags ================") print("============= step3 : test tags ================")
...@@ -200,8 +200,8 @@ class TDTestCase: ...@@ -200,8 +200,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_8") tdSql.query("describe stb0_8")
tdSql.checkData(2, 1, "BIGINT") tdSql.checkData(2, 1, "BIGINT")
...@@ -216,8 +216,8 @@ class TDTestCase: ...@@ -216,8 +216,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_9") tdSql.query("describe stb0_9")
tdSql.checkData(2, 1, "DOUBLE") tdSql.checkData(2, 1, "DOUBLE")
...@@ -232,8 +232,8 @@ class TDTestCase: ...@@ -232,8 +232,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb0_10") tdSql.query("describe stb0_10")
tdSql.checkData(2, 1, "DOUBLE") tdSql.checkData(2, 1, "DOUBLE")
...@@ -258,8 +258,8 @@ class TDTestCase: ...@@ -258,8 +258,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select ts from stb1_0") tdSql.query("select ts from stb1_0")
tdSql.checkData(0, 0, "2021-07-11 20:33:53.000000") tdSql.checkData(0, 0, "2021-07-11 20:33:53.000000")
...@@ -281,8 +281,8 @@ class TDTestCase: ...@@ -281,8 +281,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select ts from stb1_1") tdSql.query("select ts from stb1_1")
tdSql.checkData(0, 0, "2021-07-11 20:33:53.610000") tdSql.checkData(0, 0, "2021-07-11 20:33:53.610000")
...@@ -304,8 +304,8 @@ class TDTestCase: ...@@ -304,8 +304,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select ts from stb1_2") tdSql.query("select ts from stb1_2")
tdSql.checkData(0, 0, "2021-07-11 20:33:53.610123") tdSql.checkData(0, 0, "2021-07-11 20:33:53.610123")
...@@ -315,7 +315,7 @@ class TDTestCase: ...@@ -315,7 +315,7 @@ class TDTestCase:
{ {
"metric": "stb1_3", "metric": "stb1_3",
"timestamp": { "timestamp": {
"value": 1.6260068336101233e+18, "value": 1626006833610123321,
"type": "ns" "type": "ns"
}, },
"value": 10, "value": 10,
...@@ -327,8 +327,8 @@ class TDTestCase: ...@@ -327,8 +327,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select ts from stb1_3") tdSql.query("select ts from stb1_3")
tdSql.checkData(0, 0, "2021-07-11 20:33:53.610123") tdSql.checkData(0, 0, "2021-07-11 20:33:53.610123")
...@@ -351,8 +351,8 @@ class TDTestCase: ...@@ -351,8 +351,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
### metric value ### ### metric value ###
payload = [''' payload = ['''
...@@ -374,8 +374,8 @@ class TDTestCase: ...@@ -374,8 +374,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_0") tdSql.query("describe stb2_0")
tdSql.checkData(1, 1, "BOOL") tdSql.checkData(1, 1, "BOOL")
...@@ -399,8 +399,8 @@ class TDTestCase: ...@@ -399,8 +399,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_1") tdSql.query("describe stb2_1")
tdSql.checkData(1, 1, "TINYINT") tdSql.checkData(1, 1, "TINYINT")
...@@ -424,8 +424,8 @@ class TDTestCase: ...@@ -424,8 +424,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_2") tdSql.query("describe stb2_2")
tdSql.checkData(1, 1, "SMALLINT") tdSql.checkData(1, 1, "SMALLINT")
...@@ -449,8 +449,8 @@ class TDTestCase: ...@@ -449,8 +449,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_3") tdSql.query("describe stb2_3")
tdSql.checkData(1, 1, "INT") tdSql.checkData(1, 1, "INT")
...@@ -474,8 +474,8 @@ class TDTestCase: ...@@ -474,8 +474,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_4") tdSql.query("describe stb2_4")
tdSql.checkData(1, 1, "BIGINT") tdSql.checkData(1, 1, "BIGINT")
...@@ -499,8 +499,8 @@ class TDTestCase: ...@@ -499,8 +499,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_5") tdSql.query("describe stb2_5")
tdSql.checkData(1, 1, "FLOAT") tdSql.checkData(1, 1, "FLOAT")
...@@ -524,8 +524,8 @@ class TDTestCase: ...@@ -524,8 +524,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_6") tdSql.query("describe stb2_6")
tdSql.checkData(1, 1, "DOUBLE") tdSql.checkData(1, 1, "DOUBLE")
...@@ -549,8 +549,8 @@ class TDTestCase: ...@@ -549,8 +549,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_7") tdSql.query("describe stb2_7")
tdSql.checkData(1, 1, "BINARY") tdSql.checkData(1, 1, "BINARY")
...@@ -574,8 +574,8 @@ class TDTestCase: ...@@ -574,8 +574,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb2_8") tdSql.query("describe stb2_8")
tdSql.checkData(1, 1, "NCHAR") tdSql.checkData(1, 1, "NCHAR")
...@@ -633,8 +633,8 @@ class TDTestCase: ...@@ -633,8 +633,8 @@ class TDTestCase:
} }
} }
'''] ''']
code = self._conn.insert_lines(payload, 2) code = self._conn.schemaless_insert(payload, 2)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("describe stb3_0") tdSql.query("describe stb3_0")
tdSql.checkData(2, 1, "BOOL") tdSql.checkData(2, 1, "BOOL")
......
...@@ -39,8 +39,8 @@ class TDTestCase: ...@@ -39,8 +39,8 @@ class TDTestCase:
".stb0.3. 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"", ".stb0.3. 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
] ]
code = self._conn.insert_lines(lines0, 1) code = self._conn.schemaless_insert(lines0, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("show stables") tdSql.query("show stables")
tdSql.checkRows(4) tdSql.checkRows(4)
...@@ -68,8 +68,8 @@ class TDTestCase: ...@@ -68,8 +68,8 @@ class TDTestCase:
"stb1 0 6i8 host=\"host0\"", "stb1 0 6i8 host=\"host0\"",
] ]
code = self._conn.insert_lines(lines1, 1) code = self._conn.schemaless_insert(lines1, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb1") tdSql.query("select * from stb1")
tdSql.checkRows(6) tdSql.checkRows(6)
...@@ -82,8 +82,8 @@ class TDTestCase: ...@@ -82,8 +82,8 @@ class TDTestCase:
"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 = self._conn.insert_lines(lines2_0, 1) code = self._conn.schemaless_insert(lines2_0, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_0") tdSql.query("select * from stb2_0")
tdSql.checkRows(2) tdSql.checkRows(2)
...@@ -97,8 +97,8 @@ class TDTestCase: ...@@ -97,8 +97,8 @@ class TDTestCase:
"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 = self._conn.insert_lines(lines2_1, 1) code = self._conn.schemaless_insert(lines2_1, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_1") tdSql.query("select * from stb2_1")
tdSql.checkRows(2) tdSql.checkRows(2)
...@@ -113,8 +113,8 @@ class TDTestCase: ...@@ -113,8 +113,8 @@ class TDTestCase:
"stb2_2 1626006833652ms 2147483647i32 host=\"host0\"" "stb2_2 1626006833652ms 2147483647i32 host=\"host0\""
] ]
code = self._conn.insert_lines(lines2_2, 1) code = self._conn.schemaless_insert(lines2_2, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_2") tdSql.query("select * from stb2_2")
tdSql.checkRows(2) tdSql.checkRows(2)
...@@ -130,8 +130,8 @@ class TDTestCase: ...@@ -130,8 +130,8 @@ class TDTestCase:
"stb2_3 1626006833662ms 9223372036854775807 host=\"host0\"" "stb2_3 1626006833662ms 9223372036854775807 host=\"host0\""
] ]
code = self._conn.insert_lines(lines2_3, 1) code = self._conn.schemaless_insert(lines2_3, 1)
print("insert_lines 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(3)
...@@ -154,8 +154,8 @@ class TDTestCase: ...@@ -154,8 +154,8 @@ class TDTestCase:
"stb2_4 1626006833710ms -3.4E38f32 host=\"host0\"" "stb2_4 1626006833710ms -3.4E38f32 host=\"host0\""
] ]
code = self._conn.insert_lines(lines2_4, 1) code = self._conn.schemaless_insert(lines2_4, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_4") tdSql.query("select * from stb2_4")
tdSql.checkRows(10) tdSql.checkRows(10)
...@@ -179,8 +179,8 @@ class TDTestCase: ...@@ -179,8 +179,8 @@ class TDTestCase:
"stb2_5 1626006833710ms 3.15 host=\"host0\"" "stb2_5 1626006833710ms 3.15 host=\"host0\""
] ]
code = self._conn.insert_lines(lines2_5, 1) code = self._conn.schemaless_insert(lines2_5, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_5") tdSql.query("select * from stb2_5")
tdSql.checkRows(11) tdSql.checkRows(11)
...@@ -203,8 +203,8 @@ class TDTestCase: ...@@ -203,8 +203,8 @@ class TDTestCase:
"stb2_6 1626006833700ms FALSE host=\"host0\"" "stb2_6 1626006833700ms FALSE host=\"host0\""
] ]
code = self._conn.insert_lines(lines2_6, 1) code = self._conn.schemaless_insert(lines2_6, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_6") tdSql.query("select * from stb2_6")
tdSql.checkRows(10) tdSql.checkRows(10)
...@@ -220,8 +220,8 @@ class TDTestCase: ...@@ -220,8 +220,8 @@ class TDTestCase:
"stb2_7 1626006833630ms \"binary_val.()[]{}<>\" host=\"host0\"" "stb2_7 1626006833630ms \"binary_val.()[]{}<>\" host=\"host0\""
] ]
code = self._conn.insert_lines(lines2_7, 1) code = self._conn.schemaless_insert(lines2_7, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_7") tdSql.query("select * from stb2_7")
tdSql.checkRows(3) tdSql.checkRows(3)
...@@ -236,8 +236,8 @@ class TDTestCase: ...@@ -236,8 +236,8 @@ class TDTestCase:
"stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\"" "stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\""
] ]
code = self._conn.insert_lines(lines2_8, 1) code = self._conn.schemaless_insert(lines2_8, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb2_8") tdSql.query("select * from stb2_8")
tdSql.checkRows(2) tdSql.checkRows(2)
...@@ -254,8 +254,8 @@ class TDTestCase: ...@@ -254,8 +254,8 @@ class TDTestCase:
"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 = self._conn.insert_lines(lines3_0, 1) code = self._conn.schemaless_insert(lines3_0, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb3_0") tdSql.query("select * from stb3_0")
tdSql.checkRows(2) tdSql.checkRows(2)
...@@ -298,8 +298,8 @@ class TDTestCase: ...@@ -298,8 +298,8 @@ class TDTestCase:
"stb3_1 1626006833610ms 3 ID=\"child_table3\" host=\"host3\"" "stb3_1 1626006833610ms 3 ID=\"child_table3\" host=\"host3\""
] ]
code = self._conn.insert_lines(lines3_1, 1) code = self._conn.schemaless_insert(lines3_1, 1)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from stb3_1") tdSql.query("select * from stb3_1")
tdSql.checkRows(3) tdSql.checkRows(3)
......
...@@ -42,18 +42,18 @@ class TDTestCase: ...@@ -42,18 +42,18 @@ class TDTestCase:
"stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns" "stf,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns"
] ]
code = self._conn.insert_lines(lines, 0) code = self._conn.schemaless_insert(lines, 0)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
lines2 = [ "stg,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", lines2 = [ "stg,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns",
"stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns" "stg,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000ns"
] ]
code = self._conn.insert_lines([ lines2[0] ], 0) code = self._conn.schemaless_insert([ lines2[0] ], 0)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
self._conn.insert_lines([ lines2[1] ], 0) self._conn.schemaless_insert([ lines2[1] ], 0)
print("insert_lines result {}".format(code)) print("schemaless_insert result {}".format(code))
tdSql.query("select * from st") tdSql.query("select * from st")
tdSql.checkRows(4) tdSql.checkRows(4)
...@@ -73,7 +73,7 @@ class TDTestCase: ...@@ -73,7 +73,7 @@ class TDTestCase:
tdSql.query("describe stf") tdSql.query("describe stf")
tdSql.checkData(2, 2, 14) tdSql.checkData(2, 2, 14)
self._conn.insert_lines([ self._conn.schemaless_insert([
"sth,t1=4i64,t2=5f64,t4=5f64,ID=\"childtable\" c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641ms", "sth,t1=4i64,t2=5f64,t4=5f64,ID=\"childtable\" c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641ms",
"sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933654ms" "sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933654ms"
], 0) ], 0)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
import traceback import traceback
import random import random
from taos.error import TelnetLinesError from taos.error import SchemalessError
import time import time
import numpy as np import numpy as np
from util.log import * from util.log import *
...@@ -282,7 +282,7 @@ class TDTestCase: ...@@ -282,7 +282,7 @@ class TDTestCase:
def resCmp(self, input_sql, stb_name, query_sql="select * from", condition="", ts=None, id=True, none_check_tag=None): def resCmp(self, input_sql, stb_name, query_sql="select * from", condition="", ts=None, id=True, none_check_tag=None):
expect_list = self.inputHandle(input_sql) expect_list = self.inputHandle(input_sql)
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
query_sql = f"{query_sql} {stb_name} {condition}" query_sql = f"{query_sql} {stb_name} {condition}"
res_row_list, res_field_list_without_ts, res_type_list = self.resHandle(query_sql, True) res_row_list, res_field_list_without_ts, res_type_list = self.resHandle(query_sql, True)
if ts == 0: if ts == 0:
...@@ -389,13 +389,13 @@ class TDTestCase: ...@@ -389,13 +389,13 @@ class TDTestCase:
""" """
for input_sql in [self.genLongSql(128)[0]]: for input_sql in [self.genLongSql(128)[0]]:
tdCom.cleanTb() tdCom.cleanTb()
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
for input_sql in [self.genLongSql(129)[0]]: for input_sql in [self.genLongSql(129)[0]]:
tdCom.cleanTb() tdCom.cleanTb()
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def idIllegalNameCheckCase(self): def idIllegalNameCheckCase(self):
...@@ -408,9 +408,9 @@ class TDTestCase: ...@@ -408,9 +408,9 @@ class TDTestCase:
for i in rstr: for i in rstr:
input_sql = self.genFullTypeSql(tb_name=f"\"aaa{i}bbb\"")[0] input_sql = self.genFullTypeSql(tb_name=f"\"aaa{i}bbb\"")[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def idStartWithNumCheckCase(self): def idStartWithNumCheckCase(self):
...@@ -420,9 +420,9 @@ class TDTestCase: ...@@ -420,9 +420,9 @@ class TDTestCase:
tdCom.cleanTb() tdCom.cleanTb()
input_sql = self.genFullTypeSql(tb_name=f"\"1aaabbb\"")[0] input_sql = self.genFullTypeSql(tb_name=f"\"1aaabbb\"")[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def nowTsCheckCase(self): def nowTsCheckCase(self):
...@@ -432,9 +432,9 @@ class TDTestCase: ...@@ -432,9 +432,9 @@ class TDTestCase:
tdCom.cleanTb() tdCom.cleanTb()
input_sql = self.genFullTypeSql(ts="now")[0] input_sql = self.genFullTypeSql(ts="now")[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def dateFormatTsCheckCase(self): def dateFormatTsCheckCase(self):
...@@ -444,9 +444,9 @@ class TDTestCase: ...@@ -444,9 +444,9 @@ class TDTestCase:
tdCom.cleanTb() tdCom.cleanTb()
input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0] input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def illegalTsCheckCase(self): def illegalTsCheckCase(self):
...@@ -456,9 +456,9 @@ class TDTestCase: ...@@ -456,9 +456,9 @@ class TDTestCase:
tdCom.cleanTb() tdCom.cleanTb()
input_sql = self.genFullTypeSql(ts="16260068336390us19")[0] input_sql = self.genFullTypeSql(ts="16260068336390us19")[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def tagValueLengthCheckCase(self): def tagValueLengthCheckCase(self):
...@@ -473,9 +473,9 @@ class TDTestCase: ...@@ -473,9 +473,9 @@ class TDTestCase:
for t1 in ["-128i8", "128i8"]: for t1 in ["-128i8", "128i8"]:
input_sql = self.genFullTypeSql(t1=t1)[0] input_sql = self.genFullTypeSql(t1=t1)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
#i16 #i16
...@@ -485,9 +485,9 @@ class TDTestCase: ...@@ -485,9 +485,9 @@ class TDTestCase:
for t2 in ["-32768i16", "32768i16"]: for t2 in ["-32768i16", "32768i16"]:
input_sql = self.genFullTypeSql(t2=t2)[0] input_sql = self.genFullTypeSql(t2=t2)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
#i32 #i32
...@@ -497,9 +497,9 @@ class TDTestCase: ...@@ -497,9 +497,9 @@ class TDTestCase:
for t3 in ["-2147483648i32", "2147483648i32"]: for t3 in ["-2147483648i32", "2147483648i32"]:
input_sql = self.genFullTypeSql(t3=t3)[0] input_sql = self.genFullTypeSql(t3=t3)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
#i64 #i64
...@@ -509,9 +509,9 @@ class TDTestCase: ...@@ -509,9 +509,9 @@ class TDTestCase:
for t4 in ["-9223372036854775808i64", "9223372036854775808i64"]: for t4 in ["-9223372036854775808i64", "9223372036854775808i64"]:
input_sql = self.genFullTypeSql(t4=t4)[0] input_sql = self.genFullTypeSql(t4=t4)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# f32 # f32
...@@ -522,9 +522,9 @@ class TDTestCase: ...@@ -522,9 +522,9 @@ class TDTestCase:
for t5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]: for t5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]:
input_sql = self.genFullTypeSql(t5=t5)[0] input_sql = self.genFullTypeSql(t5=t5)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
...@@ -536,33 +536,33 @@ class TDTestCase: ...@@ -536,33 +536,33 @@ class TDTestCase:
for t6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']: for t6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']:
input_sql = self.genFullTypeSql(t6=t6)[0] input_sql = self.genFullTypeSql(t6=t6)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# binary # binary
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1="{tdCom.getLongName(16374, "letters")}"' input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1="{tdCom.getLongName(16374, "letters")}"'
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1="{tdCom.getLongName(16375, "letters")}"' input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1="{tdCom.getLongName(16375, "letters")}"'
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# nchar # nchar
# * legal nchar could not be larger than 16374/4 # * legal nchar could not be larger than 16374/4
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1=L"{tdCom.getLongName(4093, "letters")}"' input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1=L"{tdCom.getLongName(4093, "letters")}"'
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1=L"{tdCom.getLongName(4094, "letters")}"' input_sql = f'{stb_name} 1626006833639000000ns t t0=t t1=L"{tdCom.getLongName(4094, "letters")}"'
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def colValueLengthCheckCase(self): def colValueLengthCheckCase(self):
...@@ -578,9 +578,9 @@ class TDTestCase: ...@@ -578,9 +578,9 @@ class TDTestCase:
for value in ["-128i8", "128i8"]: for value in ["-128i8", "128i8"]:
input_sql = self.genFullTypeSql(value=value)[0] input_sql = self.genFullTypeSql(value=value)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i16 # i16
tdCom.cleanTb() tdCom.cleanTb()
...@@ -591,9 +591,9 @@ class TDTestCase: ...@@ -591,9 +591,9 @@ class TDTestCase:
for value in ["-32768i16", "32768i16"]: for value in ["-32768i16", "32768i16"]:
input_sql = self.genFullTypeSql(value=value)[0] input_sql = self.genFullTypeSql(value=value)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i32 # i32
...@@ -605,9 +605,9 @@ class TDTestCase: ...@@ -605,9 +605,9 @@ class TDTestCase:
for value in ["-2147483648i32", "2147483648i32"]: for value in ["-2147483648i32", "2147483648i32"]:
input_sql = self.genFullTypeSql(value=value)[0] input_sql = self.genFullTypeSql(value=value)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i64 # i64
...@@ -619,9 +619,9 @@ class TDTestCase: ...@@ -619,9 +619,9 @@ class TDTestCase:
for value in ["-9223372036854775808i64", "9223372036854775808i64"]: for value in ["-9223372036854775808i64", "9223372036854775808i64"]:
input_sql = self.genFullTypeSql(value=value)[0] input_sql = self.genFullTypeSql(value=value)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# f32 # f32
...@@ -634,9 +634,9 @@ class TDTestCase: ...@@ -634,9 +634,9 @@ class TDTestCase:
for value in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]: for value in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]:
input_sql = self.genFullTypeSql(value=value)[0] input_sql = self.genFullTypeSql(value=value)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# f64 # f64
...@@ -649,23 +649,23 @@ class TDTestCase: ...@@ -649,23 +649,23 @@ class TDTestCase:
for value in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']: for value in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']:
input_sql = self.genFullTypeSql(value=value)[0] input_sql = self.genFullTypeSql(value=value)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# # binary # # binary
tdCom.cleanTb() tdCom.cleanTb()
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
input_sql = f'{stb_name} 1626006833639000000ns "{tdCom.getLongName(16374, "letters")}" t0=t' input_sql = f'{stb_name} 1626006833639000000ns "{tdCom.getLongName(16374, "letters")}" t0=t'
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
tdCom.cleanTb() tdCom.cleanTb()
input_sql = f'{stb_name} 1626006833639000000ns "{tdCom.getLongName(16375, "letters")}" t0=t' input_sql = f'{stb_name} 1626006833639000000ns "{tdCom.getLongName(16375, "letters")}" t0=t'
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# nchar # nchar
...@@ -673,14 +673,14 @@ class TDTestCase: ...@@ -673,14 +673,14 @@ class TDTestCase:
tdCom.cleanTb() tdCom.cleanTb()
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
input_sql = f'{stb_name} 1626006833639000000ns L"{tdCom.getLongName(4093, "letters")}" t0=t' input_sql = f'{stb_name} 1626006833639000000ns L"{tdCom.getLongName(4093, "letters")}" t0=t'
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
tdCom.cleanTb() tdCom.cleanTb()
input_sql = f'{stb_name} 1626006833639000000ns L"{tdCom.getLongName(4094, "letters")}" t0=t' input_sql = f'{stb_name} 1626006833639000000ns L"{tdCom.getLongName(4094, "letters")}" t0=t'
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def tagColIllegalValueCheckCase(self): def tagColIllegalValueCheckCase(self):
...@@ -706,9 +706,9 @@ class TDTestCase: ...@@ -706,9 +706,9 @@ class TDTestCase:
self.genFullTypeSql(t6="11.1s45f64")[0], self.genFullTypeSql(t6="11.1s45f64")[0],
]: ]:
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# check binary and nchar blank # check binary and nchar blank
...@@ -718,9 +718,9 @@ class TDTestCase: ...@@ -718,9 +718,9 @@ class TDTestCase:
input_sql4 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns t t0=L"abc aaa"' input_sql4 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns t t0=L"abc aaa"'
for input_sql in [input_sql1, input_sql2, input_sql3, input_sql4]: for input_sql in [input_sql1, input_sql2, input_sql3, input_sql4]:
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# check accepted binary and nchar symbols # check accepted binary and nchar symbols
...@@ -728,8 +728,8 @@ class TDTestCase: ...@@ -728,8 +728,8 @@ class TDTestCase:
for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'): for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'):
input_sql1 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns "abc{symbol}aaa" t0=t' input_sql1 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns "abc{symbol}aaa" t0=t'
input_sql2 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns t t0=t t1="abc{symbol}aaa"' input_sql2 = f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns t t0=t t1="abc{symbol}aaa"'
self._conn.insert_telnet_lines([input_sql1]) self._conn.schemaless_insert([input_sql1], 1)
self._conn.insert_telnet_lines([input_sql2]) self._conn.schemaless_insert([input_sql2], 1)
def blankCheckCase(self): def blankCheckCase(self):
''' '''
...@@ -748,9 +748,9 @@ class TDTestCase: ...@@ -748,9 +748,9 @@ class TDTestCase:
f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns L"abaaa" t0=L"abcaaa3"'] f'{tdCom.getLongName(7, "letters")} 1626006833639000000ns L"abaaa" t0=L"abcaaa3"']
for input_sql in input_sql_list: for input_sql in input_sql_list:
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def duplicateIdTagColInsertCheckCase(self): def duplicateIdTagColInsertCheckCase(self):
...@@ -760,17 +760,17 @@ class TDTestCase: ...@@ -760,17 +760,17 @@ class TDTestCase:
tdCom.cleanTb() tdCom.cleanTb()
input_sql_id = self.genFullTypeSql(id_double_tag=True)[0] input_sql_id = self.genFullTypeSql(id_double_tag=True)[0]
try: try:
self._conn.insert_telnet_lines([input_sql_id]) self._conn.schemaless_insert([input_sql_id], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
input_sql = self.genFullTypeSql()[0] input_sql = self.genFullTypeSql()[0]
input_sql_tag = input_sql.replace("t5", "t6") input_sql_tag = input_sql.replace("t5", "t6")
try: try:
self._conn.insert_telnet_lines([input_sql_tag]) self._conn.schemaless_insert([input_sql_tag], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
##### stb exist ##### ##### stb exist #####
...@@ -794,7 +794,7 @@ class TDTestCase: ...@@ -794,7 +794,7 @@ class TDTestCase:
tdCom.cleanTb() tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
def tagColBinaryNcharLengthCheckCase(self): def tagColBinaryNcharLengthCheckCase(self):
...@@ -865,7 +865,7 @@ class TDTestCase: ...@@ -865,7 +865,7 @@ class TDTestCase:
tdSql.checkRows(1) tdSql.checkRows(1)
tdSql.checkEqual(tb_name1, tb_name2) tdSql.checkEqual(tb_name1, tb_name2)
input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", value="f", id_noexist_tag=True, t_add_tag=True) input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", value="f", id_noexist_tag=True, t_add_tag=True)
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
tb_name3 = self.getNoIdTbName(stb_name) tb_name3 = self.getNoIdTbName(stb_name)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2) tdSql.checkRows(2)
...@@ -881,19 +881,19 @@ class TDTestCase: ...@@ -881,19 +881,19 @@ class TDTestCase:
tb_name = f'{stb_name}_1' tb_name = f'{stb_name}_1'
input_sql = f'{stb_name} 1626006833639000000ns f id="{tb_name}" t0=t' input_sql = f'{stb_name} 1626006833639000000ns f id="{tb_name}" t0=t'
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
# * every binary and nchar must be length+2, so here is two tag, max length could not larger than 16384-2*2 # * every binary and nchar must be length+2, so here is two tag, max length could not larger than 16384-2*2
input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1="{tdCom.getLongName(16374, "letters")}" t2="{tdCom.getLongName(5, "letters")}"' input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1="{tdCom.getLongName(16374, "letters")}" t2="{tdCom.getLongName(5, "letters")}"'
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2) tdSql.checkRows(2)
input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1="{tdCom.getLongName(16374, "letters")}" t2="{tdCom.getLongName(6, "letters")}"' input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1="{tdCom.getLongName(16374, "letters")}" t2="{tdCom.getLongName(6, "letters")}"'
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2) tdSql.checkRows(2)
...@@ -907,18 +907,18 @@ class TDTestCase: ...@@ -907,18 +907,18 @@ class TDTestCase:
stb_name = tdCom.getLongName(7, "letters") stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1' tb_name = f'{stb_name}_1'
input_sql = f'{stb_name} 1626006833639000000ns f id="{tb_name}" t0=t' input_sql = f'{stb_name} 1626006833639000000ns f id="{tb_name}" t0=t'
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
# * legal nchar could not be larger than 16374/4 # * legal nchar could not be larger than 16374/4
input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1=L"{tdCom.getLongName(4093, "letters")}" t2=L"{tdCom.getLongName(1, "letters")}"' input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1=L"{tdCom.getLongName(4093, "letters")}" t2=L"{tdCom.getLongName(1, "letters")}"'
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2) tdSql.checkRows(2)
input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1=L"{tdCom.getLongName(4093, "letters")}" t2=L"{tdCom.getLongName(2, "letters")}"' input_sql = f'{stb_name} 1626006833639000000ns f t0=t t1=L"{tdCom.getLongName(4093, "letters")}" t2=L"{tdCom.getLongName(2, "letters")}"'
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2) tdSql.checkRows(2)
...@@ -941,7 +941,7 @@ class TDTestCase: ...@@ -941,7 +941,7 @@ class TDTestCase:
"st123456 1626006933640000000ns 8i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64", "st123456 1626006933640000000ns 8i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64",
"st123456 1626006933641000000ns 9i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64" "st123456 1626006933641000000ns 9i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64"
] ]
self._conn.insert_telnet_lines(lines) self._conn.schemaless_insert(lines, 1)
tdSql.query('show stables') tdSql.query('show stables')
tdSql.checkRows(3) tdSql.checkRows(3)
tdSql.query('show tables') tdSql.query('show tables')
...@@ -960,7 +960,7 @@ class TDTestCase: ...@@ -960,7 +960,7 @@ class TDTestCase:
for i in range(count): for i in range(count):
input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True)[0] input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True)[0]
sql_list.append(input_sql) sql_list.append(input_sql)
self._conn.insert_telnet_lines(sql_list) self._conn.schemaless_insert(sql_list, 1)
tdSql.query('show tables') tdSql.query('show tables')
tdSql.checkRows(count) tdSql.checkRows(count)
...@@ -973,9 +973,9 @@ class TDTestCase: ...@@ -973,9 +973,9 @@ class TDTestCase:
lines = ["st123456 1626006833639000000ns 3i 64 t1=3i64 t2=4f64 t3=\"t3\"", lines = ["st123456 1626006833639000000ns 3i 64 t1=3i64 t2=4f64 t3=\"t3\"",
f"{stb_name} 1626056811823316532ns tRue t2=5f64 t3=L\"ste\""] f"{stb_name} 1626056811823316532ns tRue t2=5f64 t3=L\"ste\""]
try: try:
self._conn.insert_telnet_lines(lines) self._conn.schemaless_insert(lines, 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def multiColsInsertCheckCase(self): def multiColsInsertCheckCase(self):
...@@ -985,9 +985,9 @@ class TDTestCase: ...@@ -985,9 +985,9 @@ class TDTestCase:
tdCom.cleanTb() tdCom.cleanTb()
input_sql = self.genFullTypeSql(t_multi_tag=True)[0] input_sql = self.genFullTypeSql(t_multi_tag=True)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def blankColInsertCheckCase(self): def blankColInsertCheckCase(self):
...@@ -997,9 +997,9 @@ class TDTestCase: ...@@ -997,9 +997,9 @@ class TDTestCase:
tdCom.cleanTb() tdCom.cleanTb()
input_sql = self.genFullTypeSql(c_blank_tag=True)[0] input_sql = self.genFullTypeSql(c_blank_tag=True)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def blankTagInsertCheckCase(self): def blankTagInsertCheckCase(self):
...@@ -1009,9 +1009,9 @@ class TDTestCase: ...@@ -1009,9 +1009,9 @@ class TDTestCase:
tdCom.cleanTb() tdCom.cleanTb()
input_sql = self.genFullTypeSql(t_blank_tag=True)[0] input_sql = self.genFullTypeSql(t_blank_tag=True)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def chineseCheckCase(self): def chineseCheckCase(self):
...@@ -1029,9 +1029,9 @@ class TDTestCase: ...@@ -1029,9 +1029,9 @@ class TDTestCase:
tdCom.cleanTb() tdCom.cleanTb()
input_sql = self.genFullTypeSql(multi_field_tag=True)[0] input_sql = self.genFullTypeSql(multi_field_tag=True)[0]
try: try:
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
raise Exception("should not reach here") raise Exception("should not reach here")
except TelnetLinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def errorTypeCheckCase(self): def errorTypeCheckCase(self):
...@@ -1120,7 +1120,7 @@ class TDTestCase: ...@@ -1120,7 +1120,7 @@ class TDTestCase:
def genMultiThreadSeq(self, sql_list): def genMultiThreadSeq(self, sql_list):
tlist = list() tlist = list()
for insert_sql in sql_list: for insert_sql in sql_list:
t = threading.Thread(target=self._conn.insert_telnet_lines,args=([insert_sql[0]],)) t = threading.Thread(target=self._conn.schemaless_insert,args=([insert_sql[0]],1))
tlist.append(t) tlist.append(t)
return tlist return tlist
...@@ -1320,8 +1320,8 @@ class TDTestCase: ...@@ -1320,8 +1320,8 @@ class TDTestCase:
def test(self): def test(self):
try: try:
input_sql = f'test_nchar 0 L"涛思数据" t0=f t1=L"涛思数据" t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64' input_sql = f'test_nchar 0 L"涛思数据" t0=f t1=L"涛思数据" t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64'
self._conn.insert_telnet_lines([input_sql]) self._conn.schemaless_insert([input_sql], 1)
except TelnetLinesError as err: except SchemalessError as err:
print(err.errno) print(err.errno)
def runAll(self): def runAll(self):
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import traceback import traceback
import random import random
import string import string
from taos.error import LinesError from taos.error import SchemalessError
import time import time
from copy import deepcopy from copy import deepcopy
import numpy as np import numpy as np
...@@ -294,7 +294,7 @@ class TDTestCase: ...@@ -294,7 +294,7 @@ class TDTestCase:
def resCmp(self, input_sql, stb_name, query_sql="select * from", condition="", ts=None, id=True, none_check_tag=None): def resCmp(self, input_sql, stb_name, query_sql="select * from", condition="", ts=None, id=True, none_check_tag=None):
expect_list = self.inputHandle(input_sql) expect_list = self.inputHandle(input_sql)
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
query_sql = f"{query_sql} {stb_name} {condition}" query_sql = f"{query_sql} {stb_name} {condition}"
res_row_list, res_field_list_without_ts, res_type_list = self.resHandle(query_sql, True) res_row_list, res_field_list_without_ts, res_type_list = self.resHandle(query_sql, True)
if ts == 0: if ts == 0:
...@@ -409,12 +409,12 @@ class TDTestCase: ...@@ -409,12 +409,12 @@ class TDTestCase:
""" """
for input_sql in [self.genLongSql(128, 1)[0], self.genLongSql(1, 4094)[0]]: for input_sql in [self.genLongSql(128, 1)[0], self.genLongSql(1, 4094)[0]]:
self.cleanStb() self.cleanStb()
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
for input_sql in [self.genLongSql(129, 1)[0], self.genLongSql(1, 4095)[0]]: for input_sql in [self.genLongSql(129, 1)[0], self.genLongSql(1, 4095)[0]]:
self.cleanStb() self.cleanStb()
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
except LinesError: except SchemalessError:
pass pass
def idIllegalNameCheckCase(self): def idIllegalNameCheckCase(self):
...@@ -427,8 +427,8 @@ class TDTestCase: ...@@ -427,8 +427,8 @@ class TDTestCase:
for i in rstr: for i in rstr:
input_sql = self.genFullTypeSql(tb_name=f"\"aaa{i}bbb\"")[0] input_sql = self.genFullTypeSql(tb_name=f"\"aaa{i}bbb\"")[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
except LinesError: except SchemalessError:
pass pass
def idStartWithNumCheckCase(self): def idStartWithNumCheckCase(self):
...@@ -438,8 +438,8 @@ class TDTestCase: ...@@ -438,8 +438,8 @@ class TDTestCase:
self.cleanStb() self.cleanStb()
input_sql = self.genFullTypeSql(tb_name=f"\"1aaabbb\"")[0] input_sql = self.genFullTypeSql(tb_name=f"\"1aaabbb\"")[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
except LinesError: except SchemalessError:
pass pass
def nowTsCheckCase(self): def nowTsCheckCase(self):
...@@ -449,8 +449,8 @@ class TDTestCase: ...@@ -449,8 +449,8 @@ class TDTestCase:
self.cleanStb() self.cleanStb()
input_sql = self.genFullTypeSql(ts="now")[0] input_sql = self.genFullTypeSql(ts="now")[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
except LinesError: except SchemalessError:
pass pass
def dateFormatTsCheckCase(self): def dateFormatTsCheckCase(self):
...@@ -460,8 +460,8 @@ class TDTestCase: ...@@ -460,8 +460,8 @@ class TDTestCase:
self.cleanStb() self.cleanStb()
input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0] input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
except LinesError: except SchemalessError:
pass pass
def illegalTsCheckCase(self): def illegalTsCheckCase(self):
...@@ -471,8 +471,8 @@ class TDTestCase: ...@@ -471,8 +471,8 @@ class TDTestCase:
self.cleanStb() self.cleanStb()
input_sql = self.genFullTypeSql(ts="16260068336390us19")[0] input_sql = self.genFullTypeSql(ts="16260068336390us19")[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
except LinesError: except SchemalessError:
pass pass
def tagValueLengthCheckCase(self): def tagValueLengthCheckCase(self):
...@@ -487,8 +487,8 @@ class TDTestCase: ...@@ -487,8 +487,8 @@ class TDTestCase:
for t1 in ["-128i8", "128i8"]: for t1 in ["-128i8", "128i8"]:
input_sql = self.genFullTypeSql(t1=t1)[0] input_sql = self.genFullTypeSql(t1=t1)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
except LinesError: except SchemalessError:
pass pass
#i16 #i16
...@@ -498,8 +498,8 @@ class TDTestCase: ...@@ -498,8 +498,8 @@ class TDTestCase:
for t2 in ["-32768i16", "32768i16"]: for t2 in ["-32768i16", "32768i16"]:
input_sql = self.genFullTypeSql(t2=t2)[0] input_sql = self.genFullTypeSql(t2=t2)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
except LinesError: except SchemalessError:
pass pass
#i32 #i32
...@@ -509,8 +509,8 @@ class TDTestCase: ...@@ -509,8 +509,8 @@ class TDTestCase:
for t3 in ["-2147483648i32", "2147483648i32"]: for t3 in ["-2147483648i32", "2147483648i32"]:
input_sql = self.genFullTypeSql(t3=t3)[0] input_sql = self.genFullTypeSql(t3=t3)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
except LinesError: except SchemalessError:
pass pass
#i64 #i64
...@@ -520,8 +520,8 @@ class TDTestCase: ...@@ -520,8 +520,8 @@ class TDTestCase:
for t4 in ["-9223372036854775808i64", "9223372036854775808i64"]: for t4 in ["-9223372036854775808i64", "9223372036854775808i64"]:
input_sql = self.genFullTypeSql(t4=t4)[0] input_sql = self.genFullTypeSql(t4=t4)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
except LinesError: except SchemalessError:
pass pass
# f32 # f32
...@@ -532,9 +532,9 @@ class TDTestCase: ...@@ -532,9 +532,9 @@ class TDTestCase:
for t5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]: for t5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]:
input_sql = self.genFullTypeSql(t5=t5)[0] input_sql = self.genFullTypeSql(t5=t5)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
...@@ -546,34 +546,34 @@ class TDTestCase: ...@@ -546,34 +546,34 @@ class TDTestCase:
for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']: for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']:
input_sql = self.genFullTypeSql(c6=c6)[0] input_sql = self.genFullTypeSql(c6=c6)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# binary # binary
stb_name = self.getLongName(7, "letters") stb_name = self.getLongName(7, "letters")
input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}" c0=f 1626006833639000000ns' input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}" c0=f 1626006833639000000ns'
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16375, "letters")}" c0=f 1626006833639000000ns' input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16375, "letters")}" c0=f 1626006833639000000ns'
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
pass pass
# nchar # nchar
# * legal nchar could not be larger than 16374/4 # * legal nchar could not be larger than 16374/4
stb_name = self.getLongName(7, "letters") stb_name = self.getLongName(7, "letters")
input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}" c0=f 1626006833639000000ns' input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}" c0=f 1626006833639000000ns'
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4094, "letters")}" c0=f 1626006833639000000ns' input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4094, "letters")}" c0=f 1626006833639000000ns'
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def colValueLengthCheckCase(self): def colValueLengthCheckCase(self):
...@@ -589,9 +589,9 @@ class TDTestCase: ...@@ -589,9 +589,9 @@ class TDTestCase:
for c1 in ["-128i8", "128i8"]: for c1 in ["-128i8", "128i8"]:
input_sql = self.genFullTypeSql(c1=c1)[0] input_sql = self.genFullTypeSql(c1=c1)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i16 # i16
for c2 in ["-32767i16"]: for c2 in ["-32767i16"]:
...@@ -600,9 +600,9 @@ class TDTestCase: ...@@ -600,9 +600,9 @@ class TDTestCase:
for c2 in ["-32768i16", "32768i16"]: for c2 in ["-32768i16", "32768i16"]:
input_sql = self.genFullTypeSql(c2=c2)[0] input_sql = self.genFullTypeSql(c2=c2)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i32 # i32
...@@ -612,9 +612,9 @@ class TDTestCase: ...@@ -612,9 +612,9 @@ class TDTestCase:
for c3 in ["-2147483648i32", "2147483648i32"]: for c3 in ["-2147483648i32", "2147483648i32"]:
input_sql = self.genFullTypeSql(c3=c3)[0] input_sql = self.genFullTypeSql(c3=c3)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i64 # i64
...@@ -624,9 +624,9 @@ class TDTestCase: ...@@ -624,9 +624,9 @@ class TDTestCase:
for c4 in ["-9223372036854775808i64", "9223372036854775808i64"]: for c4 in ["-9223372036854775808i64", "9223372036854775808i64"]:
input_sql = self.genFullTypeSql(c4=c4)[0] input_sql = self.genFullTypeSql(c4=c4)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# f32 # f32
...@@ -637,9 +637,9 @@ class TDTestCase: ...@@ -637,9 +637,9 @@ class TDTestCase:
for c5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]: for c5 in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]:
input_sql = self.genFullTypeSql(c5=c5)[0] input_sql = self.genFullTypeSql(c5=c5)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# f64 # f64
...@@ -650,34 +650,34 @@ class TDTestCase: ...@@ -650,34 +650,34 @@ class TDTestCase:
for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']: for c6 in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']:
input_sql = self.genFullTypeSql(c6=c6)[0] input_sql = self.genFullTypeSql(c6=c6)[0]
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# # binary # # binary
stb_name = self.getLongName(7, "letters") stb_name = self.getLongName(7, "letters")
input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}" 1626006833639000000ns' input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}" 1626006833639000000ns'
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16375, "letters")}" 1626006833639000000ns' input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16375, "letters")}" 1626006833639000000ns'
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# nchar # nchar
# * legal nchar could not be larger than 16374/4 # * legal nchar could not be larger than 16374/4
stb_name = self.getLongName(7, "letters") stb_name = self.getLongName(7, "letters")
input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}" 1626006833639000000ns' input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}" 1626006833639000000ns'
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4094, "letters")}" 1626006833639000000ns' input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4094, "letters")}" 1626006833639000000ns'
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def tagColIllegalValueCheckCase(self): def tagColIllegalValueCheckCase(self):
...@@ -690,15 +690,15 @@ class TDTestCase: ...@@ -690,15 +690,15 @@ class TDTestCase:
for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]: for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]:
input_sql1 = self.genFullTypeSql(t0=i)[0] input_sql1 = self.genFullTypeSql(t0=i)[0]
try: try:
self._conn.insert_lines([input_sql1]) self._conn.schemaless_insert([input_sql1], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
input_sql2 = self.genFullTypeSql(c0=i)[0] input_sql2 = self.genFullTypeSql(c0=i)[0]
try: try:
self._conn.insert_lines([input_sql2]) self._conn.schemaless_insert([input_sql2], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# i8 i16 i32 i64 f32 f64 # i8 i16 i32 i64 f32 f64
...@@ -718,9 +718,9 @@ class TDTestCase: ...@@ -718,9 +718,9 @@ class TDTestCase:
self.genFullTypeSql(c9="1s1u64")[0] self.genFullTypeSql(c9="1s1u64")[0]
]: ]:
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# check binary and nchar blank # check binary and nchar blank
...@@ -731,9 +731,9 @@ class TDTestCase: ...@@ -731,9 +731,9 @@ class TDTestCase:
input_sql4 = f'{stb_name},t0=t,t1=L"abc aaa" c0=f 1626006833639000000ns' input_sql4 = f'{stb_name},t0=t,t1=L"abc aaa" c0=f 1626006833639000000ns'
for input_sql in [input_sql1, input_sql2, input_sql3, input_sql4]: for input_sql in [input_sql1, input_sql2, input_sql3, input_sql4]:
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
# check accepted binary and nchar symbols # check accepted binary and nchar symbols
...@@ -741,8 +741,8 @@ class TDTestCase: ...@@ -741,8 +741,8 @@ class TDTestCase:
for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'): for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'):
input_sql1 = f'{stb_name},t0=t c0=f,c1="abc{symbol}aaa" 1626006833639000000ns' input_sql1 = f'{stb_name},t0=t c0=f,c1="abc{symbol}aaa" 1626006833639000000ns'
input_sql2 = f'{stb_name},t0=t,t1="abc{symbol}aaa" c0=f 1626006833639000000ns' input_sql2 = f'{stb_name},t0=t,t1="abc{symbol}aaa" c0=f 1626006833639000000ns'
self._conn.insert_lines([input_sql1]) self._conn.schemaless_insert([input_sql1], 0)
self._conn.insert_lines([input_sql2]) self._conn.schemaless_insert([input_sql2], 0)
def duplicateIdTagColInsertCheckCase(self): def duplicateIdTagColInsertCheckCase(self):
...@@ -752,33 +752,33 @@ class TDTestCase: ...@@ -752,33 +752,33 @@ class TDTestCase:
self.cleanStb() self.cleanStb()
input_sql_id = self.genFullTypeSql(id_double_tag=True)[0] input_sql_id = self.genFullTypeSql(id_double_tag=True)[0]
try: try:
self._conn.insert_lines([input_sql_id]) self._conn.schemaless_insert([input_sql_id], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
input_sql = self.genFullTypeSql()[0] input_sql = self.genFullTypeSql()[0]
input_sql_tag = input_sql.replace("t5", "t6") input_sql_tag = input_sql.replace("t5", "t6")
try: try:
self._conn.insert_lines([input_sql_tag]) self._conn.schemaless_insert([input_sql_tag], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
input_sql = self.genFullTypeSql()[0] input_sql = self.genFullTypeSql()[0]
input_sql_col = input_sql.replace("c5", "c6") input_sql_col = input_sql.replace("c5", "c6")
try: try:
self._conn.insert_lines([input_sql_col]) self._conn.schemaless_insert([input_sql_col], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
input_sql = self.genFullTypeSql()[0] input_sql = self.genFullTypeSql()[0]
input_sql_col = input_sql.replace("c5", "C6") input_sql_col = input_sql.replace("c5", "C6")
try: try:
self._conn.insert_lines([input_sql_col]) self._conn.schemaless_insert([input_sql_col], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
##### stb exist ##### ##### stb exist #####
...@@ -802,7 +802,7 @@ class TDTestCase: ...@@ -802,7 +802,7 @@ class TDTestCase:
self.cleanStb() self.cleanStb()
input_sql, stb_name = self.genFullTypeSql() input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
self.resCmp(input_sql, stb_name) self.resCmp(input_sql, stb_name)
def tagColBinaryNcharLengthCheckCase(self): def tagColBinaryNcharLengthCheckCase(self):
...@@ -869,7 +869,7 @@ class TDTestCase: ...@@ -869,7 +869,7 @@ class TDTestCase:
tdSql.checkRows(1) tdSql.checkRows(1)
tdSql.checkEqual(tb_name1, tb_name2) tdSql.checkEqual(tb_name1, tb_name2)
input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", c0="f", id_noexist_tag=True, ct_add_tag=True) input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", c0="f", id_noexist_tag=True, ct_add_tag=True)
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
tb_name3 = self.getNoIdTbName(stb_name) tb_name3 = self.getNoIdTbName(stb_name)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2) tdSql.checkRows(2)
...@@ -884,34 +884,34 @@ class TDTestCase: ...@@ -884,34 +884,34 @@ class TDTestCase:
stb_name = self.getLongName(7, "letters") stb_name = self.getLongName(7, "letters")
tb_name = f'{stb_name}_1' tb_name = f'{stb_name}_1'
input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns' input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns'
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
# * every binary and nchar must be length+2, so here is two tag, max length could not larger than 16384-2*2 # * every binary and nchar must be length+2, so here is two tag, max length could not larger than 16384-2*2
input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}",t2="{self.getLongName(5, "letters")}" c0=f 1626006833639000000ns' input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}",t2="{self.getLongName(5, "letters")}" c0=f 1626006833639000000ns'
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2) tdSql.checkRows(2)
input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}",t2="{self.getLongName(6, "letters")}" c0=f 1626006833639000000ns' input_sql = f'{stb_name},t0=t,t1="{self.getLongName(16374, "letters")}",t2="{self.getLongName(6, "letters")}" c0=f 1626006833639000000ns'
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError: except SchemalessError:
pass pass
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2) tdSql.checkRows(2)
# # * check col,col+ts max in describe ---> 16143 # # * check col,col+ts max in describe ---> 16143
input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}",c2="{self.getLongName(16374, "letters")}",c3="{self.getLongName(16374, "letters")}",c4="{self.getLongName(12, "letters")}" 1626006833639000000ns' input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}",c2="{self.getLongName(16374, "letters")}",c3="{self.getLongName(16374, "letters")}",c4="{self.getLongName(12, "letters")}" 1626006833639000000ns'
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(3) tdSql.checkRows(3)
input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}",c2="{self.getLongName(16374, "letters")}",c3="{self.getLongName(16374, "letters")}",c4="{self.getLongName(13, "letters")}" 1626006833639000000ns' input_sql = f'{stb_name},t0=t c0=f,c1="{self.getLongName(16374, "letters")}",c2="{self.getLongName(16374, "letters")}",c3="{self.getLongName(16374, "letters")}",c4="{self.getLongName(13, "letters")}" 1626006833639000000ns'
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(3) tdSql.checkRows(3)
...@@ -925,31 +925,31 @@ class TDTestCase: ...@@ -925,31 +925,31 @@ class TDTestCase:
stb_name = self.getLongName(7, "letters") stb_name = self.getLongName(7, "letters")
tb_name = f'{stb_name}_1' tb_name = f'{stb_name}_1'
input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns' input_sql = f'{stb_name},id="{tb_name}",t0=t c0=f 1626006833639000000ns'
code = self._conn.insert_lines([input_sql]) code = self._conn.schemaless_insert([input_sql], 0)
# * legal nchar could not be larger than 16374/4 # * legal nchar could not be larger than 16374/4
input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}",t2=L"{self.getLongName(1, "letters")}" c0=f 1626006833639000000ns' input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}",t2=L"{self.getLongName(1, "letters")}" c0=f 1626006833639000000ns'
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2) tdSql.checkRows(2)
input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}",t2=L"{self.getLongName(2, "letters")}" c0=f 1626006833639000000ns' input_sql = f'{stb_name},t0=t,t1=L"{self.getLongName(4093, "letters")}",t2=L"{self.getLongName(2, "letters")}" c0=f 1626006833639000000ns'
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(2) tdSql.checkRows(2)
input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}",c2=L"{self.getLongName(4093, "letters")}",c3=L"{self.getLongName(4093, "letters")}",c4=L"{self.getLongName(4, "letters")}" 1626006833639000000ns' input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}",c2=L"{self.getLongName(4093, "letters")}",c3=L"{self.getLongName(4093, "letters")}",c4=L"{self.getLongName(4, "letters")}" 1626006833639000000ns'
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(3) tdSql.checkRows(3)
input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}",c2=L"{self.getLongName(4093, "letters")}",c3=L"{self.getLongName(4093, "letters")}",c4=L"{self.getLongName(5, "letters")}" 1626006833639000000ns' input_sql = f'{stb_name},t0=t c0=f,c1=L"{self.getLongName(4093, "letters")}",c2=L"{self.getLongName(4093, "letters")}",c3=L"{self.getLongName(4093, "letters")}",c4=L"{self.getLongName(5, "letters")}" 1626006833639000000ns'
try: try:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
tdSql.query(f"select * from {stb_name}") tdSql.query(f"select * from {stb_name}")
tdSql.checkRows(3) tdSql.checkRows(3)
...@@ -971,7 +971,7 @@ class TDTestCase: ...@@ -971,7 +971,7 @@ class TDTestCase:
"st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns", "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64,c6=7u64 1626006933640000000ns",
"st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns" "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=false,c5=5f64,c6=7u64 1626006933641000000ns"
] ]
self._conn.insert_lines(lines) self._conn.schemaless_insert(lines, 0)
def multiInsertCheckCase(self, count): def multiInsertCheckCase(self, count):
""" """
...@@ -984,7 +984,7 @@ class TDTestCase: ...@@ -984,7 +984,7 @@ class TDTestCase:
for i in range(count): for i in range(count):
input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True)[0] input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{self.getLongName(8, "letters")}"', c7=f'"{self.getLongName(8, "letters")}"', id_noexist_tag=True)[0]
sql_list.append(input_sql) sql_list.append(input_sql)
self._conn.insert_lines(sql_list) self._conn.schemaless_insert(sql_list, 0)
def batchErrorInsertCheckCase(self): def batchErrorInsertCheckCase(self):
""" """
...@@ -995,9 +995,9 @@ class TDTestCase: ...@@ -995,9 +995,9 @@ class TDTestCase:
lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns", lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000ns",
f"{stb_name},t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"] f"{stb_name},t2=5f64,t3=L\"ste\" c1=tRue,c2=4i64,c3=\"iam\" 1626056811823316532ns"]
try: try:
self._conn.insert_lines(lines) self._conn.schemaless_insert(lines, 0)
raise Exception("should not reach here") raise Exception("should not reach here")
except LinesError as err: except SchemalessError as err:
tdSql.checkNotEqual(err.errno, 0) tdSql.checkNotEqual(err.errno, 0)
def genSqlList(self, count=5, stb_name="", tb_name=""): def genSqlList(self, count=5, stb_name="", tb_name=""):
...@@ -1049,7 +1049,7 @@ class TDTestCase: ...@@ -1049,7 +1049,7 @@ class TDTestCase:
def genMultiThreadSeq(self, sql_list): def genMultiThreadSeq(self, sql_list):
tlist = list() tlist = list()
for insert_sql in sql_list: for insert_sql in sql_list:
t = threading.Thread(target=self._conn.insert_lines,args=([insert_sql[0]],)) t = threading.Thread(target=self._conn.schemaless_insert,args=([insert_sql[0]], 0))
tlist.append(t) tlist.append(t)
return tlist return tlist
...@@ -1248,17 +1248,17 @@ class TDTestCase: ...@@ -1248,17 +1248,17 @@ class TDTestCase:
input_sql1 = "rfasta,id=\"rfasta_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"ddzhiksj\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"bnhwlgvj\",c8=L\"ncharTagValue\",c9=7u64 1626006933640000000ns" input_sql1 = "rfasta,id=\"rfasta_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"ddzhiksj\",t8=L\"ncharTagValue\" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"bnhwlgvj\",c8=L\"ncharTagValue\",c9=7u64 1626006933640000000ns"
input_sql2 = "rfasta,id=\"rfasta_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64 1626006933640000000ns" input_sql2 = "rfasta,id=\"rfasta_1\",t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64 c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64 1626006933640000000ns"
try: try:
self._conn.insert_lines([input_sql1]) self._conn.schemaless_insert([input_sql1], 0)
self._conn.insert_lines([input_sql2]) self._conn.schemaless_insert([input_sql2], 0)
except LinesError as err: except SchemalessError as err:
print(err.errno) print(err.errno)
# self._conn.insert_lines([input_sql2]) # self._conn.schemaless_insert([input_sql2], 0)
# input_sql3 = f'abcd,id="cc¥Ec",t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="ndsfdrum",t8=L"ncharTagValue" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="igwoehkm",c8=L"ncharColValue",c9=7u64 0' # input_sql3 = f'abcd,id="cc¥Ec",t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="ndsfdrum",t8=L"ncharTagValue" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="igwoehkm",c8=L"ncharColValue",c9=7u64 0'
# print(input_sql3) # print(input_sql3)
# input_sql4 = 'hmemeb,id="kilrcrldgf",t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="fysodjql",t8=L"ncharTagValue" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="waszbfvc",c8=L"ncharColValue",c9=7u64 0' # input_sql4 = 'hmemeb,id="kilrcrldgf",t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="fysodjql",t8=L"ncharTagValue" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="waszbfvc",c8=L"ncharColValue",c9=7u64 0'
# code = self._conn.insert_lines([input_sql3]) # code = self._conn.schemaless_insert([input_sql3], 0)
# print(code) # print(code)
# self._conn.insert_lines([input_sql4]) # self._conn.schemaless_insert([input_sql4], 0)
def runAll(self): def runAll(self):
self.initCheckCase() self.initCheckCase()
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import traceback import traceback
import random import random
import string import string
from taos.error import LinesError from taos.error import SchemalessError
import datetime import datetime
import time import time
from copy import deepcopy from copy import deepcopy
...@@ -172,28 +172,28 @@ class TDTestCase: ...@@ -172,28 +172,28 @@ class TDTestCase:
def perfTableInsert(self): def perfTableInsert(self):
table_generator = self.tableGenerator() table_generator = self.tableGenerator()
for input_sql in table_generator: for input_sql in table_generator:
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
# for i in range(10): # for i in range(10):
# self._conn.insert_lines([input_sql]) # self._conn.schemaless_insert([input_sql], 0)
def perfDataInsert(self, count=4): def perfDataInsert(self, count=4):
table_generator = self.tableGenerator(count=count) table_generator = self.tableGenerator(count=count)
ts = int(time.time()) ts = int(time.time())
for input_sql in table_generator: for input_sql in table_generator:
print("input_sql-----------", input_sql) print("input_sql-----------", input_sql)
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
for i in range(100000): for i in range(100000):
ts -= 1 ts -= 1
input_sql_new = self.replaceLastStr(input_sql, str(ts)) + 's' input_sql_new = self.replaceLastStr(input_sql, str(ts)) + 's'
print("input_sql_new---------", input_sql_new) print("input_sql_new---------", input_sql_new)
self._conn.insert_lines([input_sql_new]) self._conn.schemaless_insert([input_sql_new], 0)
def batchInsertTable(self, batch_list): def batchInsertTable(self, batch_list):
for insert_list in batch_list: for insert_list in batch_list:
print(threading.current_thread().name, "length=", len(insert_list)) print(threading.current_thread().name, "length=", len(insert_list))
print(threading.current_thread().name, 'firstline', insert_list[0]) print(threading.current_thread().name, 'firstline', insert_list[0])
print(threading.current_thread().name, 'lastline:', insert_list[-1]) print(threading.current_thread().name, 'lastline:', insert_list[-1])
self._conn.insert_lines(insert_list) self._conn.schemaless_insert(insert_list, 0)
print(threading.current_thread().name, 'end') print(threading.current_thread().name, 'end')
def genTableThread(self, thread_count=10): def genTableThread(self, thread_count=10):
...@@ -218,7 +218,7 @@ class TDTestCase: ...@@ -218,7 +218,7 @@ class TDTestCase:
def createStb(self, count=4): def createStb(self, count=4):
input_sql = self.getPerfSql(count=count, init=True) input_sql = self.getPerfSql(count=count, init=True)
self._conn.insert_lines([input_sql]) self._conn.schemaless_insert([input_sql], 0)
def threadInsertTable(self, end_list, thread_count=10): def threadInsertTable(self, end_list, thread_count=10):
threads = list() threads = list()
...@@ -238,7 +238,7 @@ class TDTestCase: ...@@ -238,7 +238,7 @@ class TDTestCase:
# def createTb(self, count=4): # def createTb(self, count=4):
# input_sql = self.getPerfSql(count=count) # input_sql = self.getPerfSql(count=count)
# for i in range(10000): # for i in range(10000):
# self._conn.insert_lines([input_sql]) # self._conn.schemaless_insert([input_sql], 0)
# def createTb1(self, count=4): # def createTb1(self, count=4):
# start_time = time.time() # start_time = time.time()
...@@ -273,8 +273,8 @@ class TDTestCase: ...@@ -273,8 +273,8 @@ class TDTestCase:
# def test(self): # def test(self):
# sql1 = 'stb,id="init",t0=14865i32,t1="tvnqbjuqck" c0=37i32,c1=217i32,c2=3i32,c3=88i32 1626006833640ms' # sql1 = 'stb,id="init",t0=14865i32,t1="tvnqbjuqck" c0=37i32,c1=217i32,c2=3i32,c3=88i32 1626006833640ms'
# sql2 = 'stb,id="init",t0=14865i32,t1="tvnqbjuqck" c0=38i32,c1=217i32,c2=3i32,c3=88i32 1626006833641ms' # sql2 = 'stb,id="init",t0=14865i32,t1="tvnqbjuqck" c0=38i32,c1=217i32,c2=3i32,c3=88i32 1626006833641ms'
# self._conn.insert_lines([sql1]) # self._conn.schemaless_insert([sql1], 0)
# self._conn.insert_lines([sql2]) # self._conn.schemaless_insert([sql2], 0)
def run(self): def run(self):
print("running {}".format(__file__)) print("running {}".format(__file__))
......
...@@ -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_insert_lines(taos, lines0, 3, 1); code = taos_schemaless_insert(taos, lines0, 3, 1);
if (code) { if (code) {
printf("lines0 code: %d, %s.\n", code, tstrerror(code)); printf("lines0 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -40,7 +40,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -40,7 +40,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb1 1626006833651ms 5i8 host=\"host0\"", "stb1 1626006833651ms 5i8 host=\"host0\"",
"stb1 0 6i8 host=\"host0\"", "stb1 0 6i8 host=\"host0\"",
}; };
code = taos_insert_lines(taos, lines1, 6, 1); code = taos_schemaless_insert(taos, lines1, 6, 1);
if (code) { if (code) {
printf("lines1 code: %d, %s.\n", code, tstrerror(code)); printf("lines1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -51,7 +51,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -51,7 +51,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_insert_lines(taos, lines2_0, 2, 1); code = taos_schemaless_insert(taos, lines2_0, 2, 1);
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 +61,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -61,7 +61,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_insert_lines(taos, lines2_1, 2, 1); code = taos_schemaless_insert(taos, lines2_1, 2, 1);
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 +71,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -71,7 +71,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_insert_lines(taos, lines2_2, 2, 1); code = taos_schemaless_insert(taos, lines2_2, 2, 1);
if (code) { if (code) {
printf("lines2_2 code: %d, %s.\n", code, tstrerror(code)); printf("lines2_2 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -82,7 +82,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -82,7 +82,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\"", "stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833662ms 9223372036854775807 host=\"host0\"" "stb2_3 1626006833662ms 9223372036854775807 host=\"host0\""
}; };
code = taos_insert_lines(taos, lines2_3, 3, 1); code = taos_schemaless_insert(taos, lines2_3, 3, 1);
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_insert_lines(taos, lines2_4, 10, 1); code = taos_schemaless_insert(taos, lines2_4, 10, 1);
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_insert_lines(taos, lines2_5, 11, 1); code = taos_schemaless_insert(taos, lines2_5, 11, 1);
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_insert_lines(taos, lines2_6, 10, 1); code = taos_schemaless_insert(taos, lines2_6, 10, 1);
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_insert_lines(taos, lines2_7, 3, 1); code = taos_schemaless_insert(taos, lines2_7, 3, 1);
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_insert_lines(taos, lines2_8, 2, 1); code = taos_schemaless_insert(taos, lines2_8, 2, 1);
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,7 +169,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -169,7 +169,7 @@ 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_insert_lines(taos, lines3_0, 2, 1); code = taos_schemaless_insert(taos, lines3_0, 2, 1);
if (code) { if (code) {
printf("lines3_0 code: %d, %s.\n", code, tstrerror(code)); printf("lines3_0 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -180,7 +180,7 @@ void verify_telnet_insert(TAOS* taos) { ...@@ -180,7 +180,7 @@ 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_insert_lines(taos, lines3_1, 3, 1); code = taos_schemaless_insert(taos, lines3_1, 3, 1);
if (code) { if (code) {
printf("lines3_1 code: %d, %s.\n", code, tstrerror(code)); printf("lines3_1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -214,7 +214,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -214,7 +214,7 @@ void verify_json_insert(TAOS* taos) {
} \ } \
}"}; }"};
code = taos_insert_lines(taos, message, 0, 2); code = taos_schemaless_insert(taos, message, 0, 2);
if (code) { if (code) {
printf("payload_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload_0 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -245,7 +245,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -245,7 +245,7 @@ void verify_json_insert(TAOS* taos) {
} \ } \
]"}; ]"};
code = taos_insert_lines(taos, message1, 0, 2); code = taos_schemaless_insert(taos, message1, 0, 2);
if (code) { if (code) {
printf("payload_1 code: %d, %s.\n", code, tstrerror(code)); printf("payload_1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -296,7 +296,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -296,7 +296,7 @@ void verify_json_insert(TAOS* taos) {
} \ } \
} \ } \
]"}; ]"};
code = taos_insert_lines(taos, message2, 0, 2); code = taos_schemaless_insert(taos, message2, 0, 2);
if (code) { if (code) {
printf("payload_2 code: %d, %s.\n", code, tstrerror(code)); printf("payload_2 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload0_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_0 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload0_1 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload0_2 code: %d, %s.\n", code, tstrerror(code)); printf("payload0_2 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
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,39 +485,13 @@ void verify_json_insert(TAOS* taos) { ...@@ -485,39 +485,13 @@ 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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
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);
//nanoseconds
payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_3");
timestamp = cJSON_CreateObject();
cJSON_AddNumberToObject(timestamp, "value", (double)1626006833610123321);
cJSON_AddStringToObject(timestamp, "type", "ns");
cJSON_AddItemToObject(payload, "timestamp", timestamp);
cJSON_AddNumberToObject(payload, "value", 10);
tags = cJSON_CreateObject();
cJSON_AddTrueToObject(tags, "t1");
cJSON_AddFalseToObject(tags, "t2");
cJSON_AddNumberToObject(tags, "t3", 10);
cJSON_AddStringToObject(tags, "t4", "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>");
cJSON_AddItemToObject(payload, "tags", tags);
*payload_str = cJSON_Print(payload);
//printf("%s\n", payload_str);
code = taos_insert_lines(taos, payload_str, 0, 2);
if (code) {
printf("payload1_3 code: %d, %s.\n", code, tstrerror(code));
}
free(*payload_str);
cJSON_Delete(payload);
//now //now
payload = cJSON_CreateObject(); payload = cJSON_CreateObject();
cJSON_AddStringToObject(payload, "metric", "stb1_4"); cJSON_AddStringToObject(payload, "metric", "stb1_4");
...@@ -537,7 +511,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -537,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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload1_4 code: %d, %s.\n", code, tstrerror(code)); printf("payload1_4 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -569,7 +543,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -569,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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload2_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_0 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -599,7 +573,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -599,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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload2_1 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_1 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -629,7 +603,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -629,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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload2_2 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_2 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -659,7 +633,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -659,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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload2_3 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_3 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -689,7 +663,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -689,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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload2_4 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_4 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -719,7 +693,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -719,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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload2_5 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_5 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -749,7 +723,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -749,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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload2_6 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_6 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -779,7 +753,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -779,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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload2_7 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_7 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -809,7 +783,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -809,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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload2_8 code: %d, %s.\n", code, tstrerror(code)); printf("payload2_8 code: %d, %s.\n", code, tstrerror(code));
} }
...@@ -889,7 +863,7 @@ void verify_json_insert(TAOS* taos) { ...@@ -889,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_insert_lines(taos, payload_str, 0, 2); code = taos_schemaless_insert(taos, payload_str, 0, 2);
if (code) { if (code) {
printf("payload3_0 code: %d, %s.\n", code, tstrerror(code)); printf("payload3_0 code: %d, %s.\n", code, tstrerror(code));
} }
......
...@@ -1084,7 +1084,7 @@ bool simExecuteLineInsertCmd(SScript *script, char *rest) { ...@@ -1084,7 +1084,7 @@ bool simExecuteLineInsertCmd(SScript *script, char *rest) {
simInfo("script:%s, %s", script->fileName, rest); simInfo("script:%s, %s", script->fileName, rest);
simLogSql(buf, true); simLogSql(buf, true);
char * lines[] = {rest}; char * lines[] = {rest};
int32_t ret = taos_insert_lines(script->taos, lines, 1, 0); int32_t ret = taos_schemaless_insert(script->taos, lines, 1, 0);
if (ret == TSDB_CODE_SUCCESS) { if (ret == TSDB_CODE_SUCCESS) {
simDebug("script:%s, taos:%p, %s executed. success.", script->fileName, script->taos, rest); simDebug("script:%s, taos:%p, %s executed. success.", script->fileName, script->taos, rest);
script->linePos++; script->linePos++;
...@@ -1107,7 +1107,7 @@ bool simExecuteLineInsertErrorCmd(SScript *script, char *rest) { ...@@ -1107,7 +1107,7 @@ bool simExecuteLineInsertErrorCmd(SScript *script, char *rest) {
simInfo("script:%s, %s", script->fileName, rest); simInfo("script:%s, %s", script->fileName, rest);
simLogSql(buf, true); simLogSql(buf, true);
char * lines[] = {rest}; char * lines[] = {rest};
int32_t ret = taos_insert_lines(script->taos, lines, 1, 0); int32_t ret = taos_schemaless_insert(script->taos, lines, 1, 0);
if (ret == TSDB_CODE_SUCCESS) { if (ret == TSDB_CODE_SUCCESS) {
sprintf(script->error, "script:%s, taos:%p, %s executed. expect failed, but success.", script->fileName, script->taos, rest); sprintf(script->error, "script:%s, taos:%p, %s executed. expect failed, but success.", script->fileName, script->taos, rest);
script->linePos++; script->linePos++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册