Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
005d7349
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
005d7349
编写于
9月 23, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10445]<enhance>: Unify OpenTSDB APIs to taos_insert_lines
上级
efccb8b0
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
284 addition
and
260 deletion
+284
-260
src/client/inc/tscParseLine.h
src/client/inc/tscParseLine.h
+11
-0
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+2
-2
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+20
-1
src/connector/python/taos/cinterface.py
src/connector/python/taos/cinterface.py
+2
-2
src/connector/python/taos/connection.py
src/connector/python/taos/connection.py
+16
-20
src/inc/taos.h
src/inc/taos.h
+1
-5
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/util/src/terror.c
src/util/src/terror.c
+1
-0
tests/examples/c/apitest.c
tests/examples/c/apitest.c
+8
-8
tests/examples/c/schemaless.c
tests/examples/c/schemaless.c
+1
-1
tests/pytest/insert/insertJSONPayload.py
tests/pytest/insert/insertJSONPayload.py
+104
-104
tests/pytest/insert/insertTelnetLines.py
tests/pytest/insert/insertTelnetLines.py
+26
-26
tests/pytest/insert/line_insert.py
tests/pytest/insert/line_insert.py
+6
-6
tests/script/api/openTSDBTest.c
tests/script/api/openTSDBTest.c
+83
-83
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+2
-2
未找到文件。
src/client/inc/tscParseLine.h
浏览文件 @
005d7349
...
...
@@ -47,6 +47,12 @@ typedef enum {
SML_TIME_STAMP_NANO_SECONDS
}
SMLTimeStampType
;
typedef
enum
{
SML_LINE_PROTOCOL
=
0
,
SML_TELNET_PROTOCOL
=
1
,
SML_JSON_PROTOCOL
=
2
,
}
SMLProtocolType
;
typedef
struct
{
uint64_t
id
;
SHashObj
*
smlDataToSchema
;
...
...
@@ -66,6 +72,11 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
void
destroySmlDataPoint
(
TAOS_SML_DATA_POINT
*
point
);
int
taos_insert_sml_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
);
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
);
int
taos_insert_json_payload
(
TAOS
*
taos
,
char
*
payload
);
#ifdef __cplusplus
}
#endif
...
...
src/client/src/TSDBJNIConnector.c
浏览文件 @
005d7349
...
...
@@ -1070,7 +1070,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(J
c_lines
[
i
]
=
(
char
*
)(
*
env
)
->
GetStringUTFChars
(
env
,
line
,
0
);
}
int
code
=
taos_insert_lines
(
taos
,
c_lines
,
numLines
);
int
code
=
taos_insert_lines
(
taos
,
c_lines
,
numLines
,
0
);
for
(
int
i
=
0
;
i
<
numLines
;
++
i
)
{
jstring
line
=
(
jstring
)((
*
env
)
->
GetObjectArrayElement
(
env
,
lines
,
i
));
...
...
@@ -1084,4 +1084,4 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(J
return
JNI_TDENGINE_ERROR
;
}
return
code
;
}
\ No newline at end of file
}
src/client/src/tscParseLineProtocol.c
浏览文件 @
005d7349
...
...
@@ -2127,7 +2127,7 @@ int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* faile
return
TSDB_CODE_SUCCESS
;
}
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
)
{
int
taos_insert_
sml_
lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
)
{
int32_t
code
=
0
;
SSmlLinesInfo
*
info
=
tcalloc
(
1
,
sizeof
(
SSmlLinesInfo
));
...
...
@@ -2184,3 +2184,22 @@ cleanup:
return
code
;
}
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
)
{
int
code
;
switch
(
protocol
)
{
case
SML_LINE_PROTOCOL
:
code
=
taos_insert_sml_lines
(
taos
,
lines
,
numLines
);
break
;
case
SML_TELNET_PROTOCOL
:
code
=
taos_insert_telnet_lines
(
taos
,
lines
,
numLines
);
break
;
case
SML_JSON_PROTOCOL
:
code
=
taos_insert_json_payload
(
taos
,
*
lines
);
break
;
default:
code
=
TSDB_CODE_TSC_INVALID_PROTOCOL_TYPE
;
break
;
}
return
code
;
}
src/connector/python/taos/cinterface.py
浏览文件 @
005d7349
...
...
@@ -817,13 +817,13 @@ except AttributeError:
def
taos_insert_lines
(
connection
,
lines
):
def
taos_insert_lines
(
connection
,
lines
,
protocol
):
# 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_lines
(
connection
,
p_lines
,
num_of_lines
)
errno
=
_libtaos
.
taos_insert_lines
(
connection
,
p_lines
,
num_of_lines
,
protocol
)
if
errno
!=
0
:
raise
LinesError
(
"insert lines error"
,
errno
)
...
...
src/connector/python/taos/connection.py
浏览文件 @
005d7349
...
...
@@ -117,9 +117,10 @@ class TaosConnection(object):
stream
=
taos_open_stream
(
self
.
_conn
,
sql
,
callback
,
stime
,
param
,
callback2
)
return
TaosStream
(
stream
)
def
insert_lines
(
self
,
lines
):
def
insert_lines
(
self
,
lines
,
protocol
):
# type: (list[str]) -> None
"""Line protocol and schemaless support
"""
1.Line protocol and schemaless support
## Example
...
...
@@ -134,28 +135,13 @@ class TaosConnection(object):
conn.insert_lines(lines)
```
## Exception
```python
try:
conn.insert_lines(lines)
except SchemalessError as err:
print(err)
```
"""
return
taos_insert_lines
(
self
.
_conn
,
lines
)
def
insert_telnet_lines
(
self
,
lines
):
"""OpenTSDB telnet style API format support
2.OpenTSDB telnet style API format support
## Example
cpu_load 1626056811855516532ns 2.0f32 id="tb1",host="host0",interface="eth0"
"""
return
taos_insert_telnet_lines
(
self
.
_conn
,
lines
)
def
insert_json_payload
(
self
,
payload
):
"""OpenTSDB HTTP JSON format support
3.OpenTSDB HTTP JSON format support
## Example
"{
...
...
@@ -170,8 +156,18 @@ class TaosConnection(object):
}
}"
## Exception
```python
try:
conn.insert_lines(lines)
except SchemalessError as err:
print(err)
```
"""
return
taos_insert_json_payload
(
self
.
_conn
,
payload
)
return
taos_insert_lines
(
self
.
_conn
,
lines
,
protocol
)
def
cursor
(
self
):
# type: () -> TaosCursor
...
...
src/inc/taos.h
浏览文件 @
005d7349
...
...
@@ -187,11 +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_insert_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
);
DLL_EXPORT
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
);
DLL_EXPORT
int
taos_insert_json_payload
(
TAOS
*
taos
,
char
*
payload
);
DLL_EXPORT
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
);
#ifdef __cplusplus
}
...
...
src/inc/taoserror.h
浏览文件 @
005d7349
...
...
@@ -112,6 +112,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TSC_INVALID_JSON_TYPE TAOS_DEF_ERROR_CODE(0, 0x0222) //"Invalid JSON data type")
#define TSDB_CODE_TSC_INVALID_JSON_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0223) //"Invalid JSON configuration")
#define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0224) //"Value out of range")
#define TSDB_CODE_TSC_INVALID_PROTOCOL_TYPE TAOS_DEF_ERROR_CODE(0, 0x0225) //"Invalid line protocol type")
// mnode
#define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300) //"Message not processed")
...
...
src/util/src/terror.c
浏览文件 @
005d7349
...
...
@@ -120,6 +120,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_JSON, "Invalid JSON format")
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_JSON_TYPE
,
"Invalid JSON data type"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_JSON_CONFIG
,
"Invalid JSON configuration"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
,
"Value out of range"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_PROTOCOL_TYPE
,
"Invalid line protocol type"
)
// mnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MSG_NOT_PROCESSED
,
"Message not processed"
)
...
...
tests/examples/c/apitest.c
浏览文件 @
005d7349
...
...
@@ -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"
};
code
=
taos_insert_lines
(
taos
,
lines
,
sizeof
(
lines
)
/
sizeof
(
char
*
));
code
=
taos_insert_lines
(
taos
,
lines
,
sizeof
(
lines
)
/
sizeof
(
char
*
)
,
0
);
char
*
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"
};
code
=
taos_insert_lines
(
taos
,
&
lines2
[
0
],
1
);
code
=
taos_insert_lines
(
taos
,
&
lines2
[
1
],
1
);
code
=
taos_insert_lines
(
taos
,
&
lines2
[
0
],
1
,
0
);
code
=
taos_insert_lines
(
taos
,
&
lines2
[
1
],
1
,
0
);
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 c1=3i64,c3=L
\"
passitagin_stf
\"
,c2=false,c5=5f64,c6=7u64 1626006933654ms"
};
code
=
taos_insert_lines
(
taos
,
lines3
,
2
);
code
=
taos_insert_lines
(
taos
,
lines3
,
2
,
0
);
char
*
lines4
[]
=
{
"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"
};
code
=
taos_insert_lines
(
taos
,
lines4
,
2
);
code
=
taos_insert_lines
(
taos
,
lines4
,
2
,
0
);
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,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
);
code
=
taos_insert_lines
(
taos
,
&
lines5
[
1
],
1
);
code
=
taos_insert_lines
(
taos
,
&
lines5
[
0
],
1
,
0
);
code
=
taos_insert_lines
(
taos
,
&
lines5
[
1
],
1
,
0
);
char
*
lines6
[]
=
{
"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"
};
code
=
taos_insert_lines
(
taos
,
lines6
,
2
);
code
=
taos_insert_lines
(
taos
,
lines6
,
2
,
0
);
return
(
code
);
}
...
...
tests/examples/c/schemaless.c
浏览文件 @
005d7349
...
...
@@ -79,7 +79,7 @@ int main(int argc, char* argv[]) {
printf
(
"%s
\n
"
,
"begin taos_insert_lines"
);
int64_t
begin
=
getTimeInUs
();
int32_t
code
=
taos_insert_lines
(
taos
,
lines
,
numSuperTables
*
numChildTables
*
numRowsPerChildTable
);
int32_t
code
=
taos_insert_lines
(
taos
,
lines
,
numSuperTables
*
numChildTables
*
numRowsPerChildTable
,
0
);
int64_t
end
=
getTimeInUs
();
printf
(
"code: %d, %s. time used: %"
PRId64
"
\n
"
,
code
,
tstrerror
(
code
),
end
-
begin
);
...
...
tests/pytest/insert/insertJSONPayload.py
浏览文件 @
005d7349
...
...
@@ -33,7 +33,7 @@ class TDTestCase:
### Default format ###
### metric ###
print
(
"============= step0 : test metric ================"
)
payload
=
'''
payload
=
[
'''
{
"metric": ".stb.0.",
"timestamp": 1626006833610123,
...
...
@@ -45,16 +45,16 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe _stb_0_"
)
tdSql
.
checkRows
(
6
)
### metric value ###
print
(
"============= step1 : test metric value types ================"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb0_0",
"timestamp": 1626006833610123,
...
...
@@ -66,14 +66,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_0"
)
tdSql
.
checkData
(
1
,
1
,
"BIGINT"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb0_1",
"timestamp": 1626006833610123,
...
...
@@ -85,14 +85,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_1"
)
tdSql
.
checkData
(
1
,
1
,
"BOOL"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb0_2",
"timestamp": 1626006833610123,
...
...
@@ -104,14 +104,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_2"
)
tdSql
.
checkData
(
1
,
1
,
"BOOL"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb0_3",
"timestamp": 1626006833610123,
...
...
@@ -123,14 +123,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_3"
)
tdSql
.
checkData
(
1
,
1
,
"BINARY"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb0_4",
"timestamp": 1626006833610123,
...
...
@@ -142,14 +142,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_4"
)
tdSql
.
checkData
(
1
,
1
,
"DOUBLE"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb0_5",
"timestamp": 1626006833610123,
...
...
@@ -161,9 +161,9 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_5"
)
tdSql
.
checkData
(
1
,
1
,
"DOUBLE"
)
...
...
@@ -171,7 +171,7 @@ class TDTestCase:
print
(
"============= step2 : test timestamp ================"
)
### timestamp 0 ###
payload
=
'''
payload
=
[
'''
{
"metric": "stb0_6",
"timestamp": 0,
...
...
@@ -183,14 +183,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
print
(
"============= step3 : test tags ================"
)
### Default tag numeric types ###
payload
=
'''
payload
=
[
'''
{
"metric": "stb0_8",
"timestamp": 0,
...
...
@@ -199,14 +199,14 @@ class TDTestCase:
"t1": 123
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_8"
)
tdSql
.
checkData
(
2
,
1
,
"BIGINT"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb0_9",
"timestamp": 0,
...
...
@@ -215,14 +215,14 @@ class TDTestCase:
"t1": 123.00
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_9"
)
tdSql
.
checkData
(
2
,
1
,
"DOUBLE"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb0_10",
"timestamp": 0,
...
...
@@ -231,9 +231,9 @@ class TDTestCase:
"t1": 123E-1
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_10"
)
tdSql
.
checkData
(
2
,
1
,
"DOUBLE"
)
...
...
@@ -242,7 +242,7 @@ class TDTestCase:
print
(
"============= step4 : test nested format ================"
)
### timestamp ###
#seconds
payload
=
'''
payload
=
[
'''
{
"metric": "stb1_0",
"timestamp": {
...
...
@@ -257,15 +257,15 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"select ts from stb1_0"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-11 20:33:53.000000"
)
#milliseconds
payload
=
'''
payload
=
[
'''
{
"metric": "stb1_1",
"timestamp": {
...
...
@@ -280,15 +280,15 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"select ts from stb1_1"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-11 20:33:53.610000"
)
#microseconds
payload
=
'''
payload
=
[
'''
{
"metric": "stb1_2",
"timestamp": {
...
...
@@ -303,15 +303,15 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"select ts from stb1_2"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-11 20:33:53.610123"
)
#nanoseconds
payload
=
'''
payload
=
[
'''
{
"metric": "stb1_3",
"timestamp": {
...
...
@@ -326,16 +326,16 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"select ts from stb1_3"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-11 20:33:53.610123"
)
#now
tdSql
.
execute
(
'use test'
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb1_4",
"timestamp": {
...
...
@@ -350,12 +350,12 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
### metric value ###
payload
=
'''
payload
=
[
'''
{
"metric": "stb2_0",
"timestamp": {
...
...
@@ -373,14 +373,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb2_0"
)
tdSql
.
checkData
(
1
,
1
,
"BOOL"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb2_1",
"timestamp": {
...
...
@@ -398,14 +398,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb2_1"
)
tdSql
.
checkData
(
1
,
1
,
"TINYINT"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb2_2",
"timestamp": {
...
...
@@ -423,14 +423,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb2_2"
)
tdSql
.
checkData
(
1
,
1
,
"SMALLINT"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb2_3",
"timestamp": {
...
...
@@ -448,14 +448,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb2_3"
)
tdSql
.
checkData
(
1
,
1
,
"INT"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb2_4",
"timestamp": {
...
...
@@ -473,14 +473,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb2_4"
)
tdSql
.
checkData
(
1
,
1
,
"BIGINT"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb2_5",
"timestamp": {
...
...
@@ -498,14 +498,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb2_5"
)
tdSql
.
checkData
(
1
,
1
,
"FLOAT"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb2_6",
"timestamp": {
...
...
@@ -523,14 +523,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb2_6"
)
tdSql
.
checkData
(
1
,
1
,
"DOUBLE"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb2_7",
"timestamp": {
...
...
@@ -548,14 +548,14 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb2_7"
)
tdSql
.
checkData
(
1
,
1
,
"BINARY"
)
payload
=
'''
payload
=
[
'''
{
"metric": "stb2_8",
"timestamp": {
...
...
@@ -573,16 +573,16 @@ class TDTestCase:
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb2_8"
)
tdSql
.
checkData
(
1
,
1
,
"NCHAR"
)
### tag value ###
payload
=
'''
payload
=
[
'''
{
"metric": "stb3_0",
"timestamp": {
...
...
@@ -632,9 +632,9 @@ class TDTestCase:
}
}
}
'''
code
=
self
.
_conn
.
insert_
json_payload
(
payload
)
print
(
"insert_
json_payload
result {}"
.
format
(
code
))
'''
]
code
=
self
.
_conn
.
insert_
lines
(
payload
,
2
)
print
(
"insert_
lines
result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb3_0"
)
tdSql
.
checkData
(
2
,
1
,
"BOOL"
)
...
...
tests/pytest/insert/insertTelnetLines.py
浏览文件 @
005d7349
...
...
@@ -39,8 +39,8 @@ class TDTestCase:
".stb0.3. 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines0
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines0
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
4
)
...
...
@@ -68,8 +68,8 @@ class TDTestCase:
"stb1 0 6i8 host=
\"
host0
\"
"
,
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines
1
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines1
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb1"
)
tdSql
.
checkRows
(
6
)
...
...
@@ -82,8 +82,8 @@ class TDTestCase:
"stb2_0 1626006833651ms -127i8 host=
\"
host0
\"
"
,
"stb2_0 1626006833652ms 127i8 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines2_0
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines2_0
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_0"
)
tdSql
.
checkRows
(
2
)
...
...
@@ -97,8 +97,8 @@ class TDTestCase:
"stb2_1 1626006833651ms -32767i16 host=
\"
host0
\"
"
,
"stb2_1 1626006833652ms 32767i16 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines2_
1
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines2_1
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_1"
)
tdSql
.
checkRows
(
2
)
...
...
@@ -113,8 +113,8 @@ class TDTestCase:
"stb2_2 1626006833652ms 2147483647i32 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines2_2
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines2_2
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_2"
)
tdSql
.
checkRows
(
2
)
...
...
@@ -130,8 +130,8 @@ class TDTestCase:
"stb2_3 1626006833662ms 9223372036854775807 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines2_3
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines2_3
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_3"
)
tdSql
.
checkRows
(
3
)
...
...
@@ -154,8 +154,8 @@ class TDTestCase:
"stb2_4 1626006833710ms -3.4E38f32 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines2_4
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines2_4
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_4"
)
tdSql
.
checkRows
(
10
)
...
...
@@ -179,8 +179,8 @@ class TDTestCase:
"stb2_5 1626006833710ms 3.15 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines2_5
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines2_5
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_5"
)
tdSql
.
checkRows
(
11
)
...
...
@@ -203,8 +203,8 @@ class TDTestCase:
"stb2_6 1626006833700ms FALSE host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines2_6
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines2_6
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_6"
)
tdSql
.
checkRows
(
10
)
...
...
@@ -220,8 +220,8 @@ class TDTestCase:
"stb2_7 1626006833630ms
\"
binary_val.()[]{}<>
\"
host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines2_7
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines2_7
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_7"
)
tdSql
.
checkRows
(
3
)
...
...
@@ -236,8 +236,8 @@ class TDTestCase:
"stb2_8 1626006833620ms L
\"
nchar_val数值二
\"
host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines2_8
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines2_8
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_8"
)
tdSql
.
checkRows
(
2
)
...
...
@@ -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
\"
"
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines3_0
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines3_0
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb3_0"
)
tdSql
.
checkRows
(
2
)
...
...
@@ -298,8 +298,8 @@ class TDTestCase:
"stb3_1 1626006833610ms 3 ID=
\"
child_table3
\"
host=
\"
host3
\"
"
]
code
=
self
.
_conn
.
insert_
telnet_lines
(
lines3_
1
)
print
(
"insert_
telnet_
lines result {}"
.
format
(
code
))
code
=
self
.
_conn
.
insert_
lines
(
lines3_1
,
1
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb3_1"
)
tdSql
.
checkRows
(
3
)
...
...
tests/pytest/insert/line_insert.py
浏览文件 @
005d7349
...
...
@@ -42,17 +42,17 @@ class TDTestCase:
"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
)
code
=
self
.
_conn
.
insert_lines
(
lines
,
0
)
print
(
"insert_lines result {}"
.
format
(
code
))
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"
]
code
=
self
.
_conn
.
insert_lines
([
lines2
[
0
]
])
code
=
self
.
_conn
.
insert_lines
([
lines2
[
0
]
]
,
0
)
print
(
"insert_lines result {}"
.
format
(
code
))
self
.
_conn
.
insert_lines
([
lines2
[
1
]
])
self
.
_conn
.
insert_lines
([
lines2
[
1
]
]
,
0
)
print
(
"insert_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from st"
)
...
...
@@ -75,8 +75,8 @@ class TDTestCase:
self
.
_conn
.
insert_lines
([
"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
)
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
query
(
'select tbname, * from sth'
)
...
...
tests/script/api/openTSDBTest.c
浏览文件 @
005d7349
...
...
@@ -26,7 +26,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb0_1 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"stb0_2 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines0
,
3
);
code
=
taos_insert_
lines
(
taos
,
lines0
,
3
,
1
);
if
(
code
)
{
printf
(
"lines0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -40,7 +40,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb1 1626006833651ms 5i8 host=
\"
host0
\"
"
,
"stb1 0 6i8 host=
\"
host0
\"
"
,
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines1
,
6
);
code
=
taos_insert_
lines
(
taos
,
lines1
,
6
,
1
);
if
(
code
)
{
printf
(
"lines1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -51,7 +51,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_0 1626006833651ms -127i8 host=
\"
host0
\"
"
,
"stb2_0 1626006833652ms 127i8 host=
\"
host0
\"
"
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines2_0
,
2
);
code
=
taos_insert_
lines
(
taos
,
lines2_0
,
2
,
1
);
if
(
code
)
{
printf
(
"lines2_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -61,7 +61,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_1 1626006833651ms -32767i16 host=
\"
host0
\"
"
,
"stb2_1 1626006833652ms 32767i16 host=
\"
host0
\"
"
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines2_1
,
2
);
code
=
taos_insert_
lines
(
taos
,
lines2_1
,
2
,
1
);
if
(
code
)
{
printf
(
"lines2_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -71,7 +71,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_2 1626006833651ms -2147483647i32 host=
\"
host0
\"
"
,
"stb2_2 1626006833652ms 2147483647i32 host=
\"
host0
\"
"
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines2_2
,
2
);
code
=
taos_insert_
lines
(
taos
,
lines2_2
,
2
,
1
);
if
(
code
)
{
printf
(
"lines2_2 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -82,7 +82,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_3 1626006833652ms 9223372036854775807i64 host=
\"
host0
\"
"
,
"stb2_3 1626006833662ms 9223372036854775807 host=
\"
host0
\"
"
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines2_3
,
3
);
code
=
taos_insert_
lines
(
taos
,
lines2_3
,
3
,
1
);
if
(
code
)
{
printf
(
"lines2_3 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -100,7 +100,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_4 1626006833700ms 3.4E38f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833710ms -3.4E38f32 host=
\"
host0
\"
"
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines2_4
,
10
);
code
=
taos_insert_
lines
(
taos
,
lines2_4
,
10
,
1
);
if
(
code
)
{
printf
(
"lines2_4 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -119,7 +119,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_5 1626006833700ms -1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833710ms 3.15 host=
\"
host0
\"
"
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines2_5
,
1
1
);
code
=
taos_insert_
lines
(
taos
,
lines2_5
,
11
,
1
);
if
(
code
)
{
printf
(
"lines2_5 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -137,7 +137,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_6 1626006833690ms False host=
\"
host0
\"
"
,
"stb2_6 1626006833700ms FALSE host=
\"
host0
\"
"
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines2_6
,
10
);
code
=
taos_insert_
lines
(
taos
,
lines2_6
,
10
,
1
);
if
(
code
)
{
printf
(
"lines2_6 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -148,7 +148,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_7 1626006833620ms
\"
binary_val.:;,./?|+-=
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833630ms
\"
binary_val.()[]{}<>
\"
host=
\"
host0
\"
"
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines2_7
,
3
);
code
=
taos_insert_
lines
(
taos
,
lines2_7
,
3
,
1
);
if
(
code
)
{
printf
(
"lines2_7 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -158,7 +158,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_8 1626006833610ms L
\"
nchar_val数值一
\"
host=
\"
host0
\"
"
,
"stb2_8 1626006833620ms L
\"
nchar_val数值二
\"
host=
\"
host0
\"
"
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines2_8
,
2
);
code
=
taos_insert_
lines
(
taos
,
lines2_8
,
2
,
1
);
if
(
code
)
{
printf
(
"lines2_8 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -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 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_
telnet_lines
(
taos
,
lines3_0
,
2
);
code
=
taos_insert_
lines
(
taos
,
lines3_0
,
2
,
1
);
if
(
code
)
{
printf
(
"lines3_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -180,7 +180,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb3_1 1626006833610ms 2 host=
\"
host2
\"
iD=
\"
child_table2
\"
"
,
"stb3_1 1626006833610ms 3 ID=
\"
child_table3
\"
host=
\"
host3
\"
"
};
code
=
taos_insert_
telnet_lines
(
taos
,
lines3_1
,
3
);
code
=
taos_insert_
lines
(
taos
,
lines3_1
,
3
,
1
);
if
(
code
)
{
printf
(
"lines3_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -201,7 +201,7 @@ void verify_json_insert(TAOS* taos) {
(
void
)
taos_select_db
(
taos
,
"db"
);
int32_t
code
=
0
;
char
*
message
=
char
*
message
[]
=
{
"{ \
\"
metric
\"
:
\"
cpu_load_0
\"
, \
\"
timestamp
\"
: 1626006833610123, \
...
...
@@ -212,14 +212,14 @@ void verify_json_insert(TAOS* taos) {
\"
interface1
\"
:
\"
eth0
\"
, \
\"
Id
\"
:
\"
tb0
\"
\
} \
}"
;
}"
}
;
code
=
taos_insert_
json_payload
(
taos
,
message
);
code
=
taos_insert_
lines
(
taos
,
message
,
0
,
2
);
if
(
code
)
{
printf
(
"payload_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
char
*
message1
=
char
*
message1
[]
=
{
"[ \
{ \
\"
metric
\"
:
\"
cpu_load_1
\"
, \
...
...
@@ -243,14 +243,14 @@ void verify_json_insert(TAOS* taos) {
\"
Id
\"
:
\"
tb2
\"
\
} \
} \
]"
;
]"
}
;
code
=
taos_insert_
json_payload
(
taos
,
message1
);
code
=
taos_insert_
lines
(
taos
,
message1
,
0
,
2
);
if
(
code
)
{
printf
(
"payload_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
char
*
message2
=
char
*
message2
[]
=
{
"[ \
{ \
\"
metric
\"
:
\"
cpu_load_3
\"
, \
...
...
@@ -295,15 +295,15 @@ void verify_json_insert(TAOS* taos) {
\"
Id
\"
:
\"
tb4
\"
\
} \
} \
]"
;
code
=
taos_insert_
json_payload
(
taos
,
message
2
);
]"
}
;
code
=
taos_insert_
lines
(
taos
,
message2
,
0
,
2
);
if
(
code
)
{
printf
(
"payload_2 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
cJSON
*
payload
,
*
tags
;
char
*
payload_str
;
char
*
payload_str
[
1
]
;
/* Default format */
//number
...
...
@@ -317,14 +317,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload0_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//true
...
...
@@ -338,14 +338,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload0_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//false
...
...
@@ -359,14 +359,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload0_2 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//string
...
...
@@ -380,14 +380,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload0_3 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//timestamp 0 -> current time
...
...
@@ -401,14 +401,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload0_4 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
/* Nested format */
...
...
@@ -430,14 +430,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload1_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//milleseconds
...
...
@@ -456,14 +456,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload1_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//microseconds
...
...
@@ -482,14 +482,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload1_2 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//nanoseconds
...
...
@@ -508,14 +508,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
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
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//now
...
...
@@ -534,14 +534,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload1_4 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//metric value
...
...
@@ -566,14 +566,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload2_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//tinyint
...
...
@@ -596,14 +596,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload2_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//smallint
...
...
@@ -626,14 +626,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload2_2 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//int
...
...
@@ -656,14 +656,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload2_3 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//bigint
...
...
@@ -686,14 +686,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload2_4 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//float
...
...
@@ -716,14 +716,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload2_5 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//double
...
...
@@ -746,14 +746,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload2_6 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//binary
...
...
@@ -776,14 +776,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload2_7 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//nchar
...
...
@@ -806,14 +806,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddNumberToObject
(
tags
,
"t3"
,
10
);
cJSON_AddStringToObject
(
tags
,
"t4"
,
"123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
);
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload2_8 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
//tag value
...
...
@@ -886,14 +886,14 @@ void verify_json_insert(TAOS* taos) {
cJSON_AddItemToObject
(
payload
,
"tags"
,
tags
);
payload_str
=
cJSON_Print
(
payload
);
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_insert_
json_payload
(
taos
,
payload_str
);
code
=
taos_insert_
lines
(
taos
,
payload_str
,
0
,
2
);
if
(
code
)
{
printf
(
"payload3_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
free
(
payload_str
);
free
(
*
payload_str
);
cJSON_Delete
(
payload
);
}
...
...
tests/tsim/src/simExe.c
浏览文件 @
005d7349
...
...
@@ -1084,7 +1084,7 @@ bool simExecuteLineInsertCmd(SScript *script, char *rest) {
simInfo
(
"script:%s, %s"
,
script
->
fileName
,
rest
);
simLogSql
(
buf
,
true
);
char
*
lines
[]
=
{
rest
};
int32_t
ret
=
taos_insert_lines
(
script
->
taos
,
lines
,
1
);
int32_t
ret
=
taos_insert_lines
(
script
->
taos
,
lines
,
1
,
0
);
if
(
ret
==
TSDB_CODE_SUCCESS
)
{
simDebug
(
"script:%s, taos:%p, %s executed. success."
,
script
->
fileName
,
script
->
taos
,
rest
);
script
->
linePos
++
;
...
...
@@ -1107,7 +1107,7 @@ bool simExecuteLineInsertErrorCmd(SScript *script, char *rest) {
simInfo
(
"script:%s, %s"
,
script
->
fileName
,
rest
);
simLogSql
(
buf
,
true
);
char
*
lines
[]
=
{
rest
};
int32_t
ret
=
taos_insert_lines
(
script
->
taos
,
lines
,
1
);
int32_t
ret
=
taos_insert_lines
(
script
->
taos
,
lines
,
1
,
0
);
if
(
ret
==
TSDB_CODE_SUCCESS
)
{
sprintf
(
script
->
error
,
"script:%s, taos:%p, %s executed. expect failed, but success."
,
script
->
fileName
,
script
->
taos
,
rest
);
script
->
linePos
++
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录