Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0318c20e
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0318c20e
编写于
10月 08, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:change the new interface name of schemaless
上级
c12bcc6c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
40 addition
and
39 deletion
+40
-39
src/client/inc/tscParseLine.h
src/client/inc/tscParseLine.h
+3
-3
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+22
-19
src/client/src/tscParseOpenTSDB.c
src/client/src/tscParseOpenTSDB.c
+15
-17
未找到文件。
src/client/inc/tscParseLine.h
浏览文件 @
0318c20e
...
...
@@ -103,11 +103,11 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
void
destroySmlDataPoint
(
TAOS_SML_DATA_POINT
*
point
);
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
data
,
int32_t
len
,
char
*
lines
[],
int
numLines
,
SMLProtocolType
protocol
,
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
data
,
int32_t
len
,
char
*
lines
[],
int
*
numLines
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
,
int
*
affectedRows
);
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
data
,
int32_t
len
,
char
*
lines
[],
int
numLines
,
SMLProtocolType
protocol
,
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
data
,
int32_t
len
,
char
*
lines
[],
int
*
numLines
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
,
int
*
affectedRows
);
int
taos_insert_json_payload
(
TAOS
*
taos
,
char
*
payload
,
SMLProtocolType
protocol
,
int
taos_insert_json_payload
(
TAOS
*
taos
,
char
*
payload
,
SMLProtocolType
protocol
,
int
*
numLines
,
SMLTimeStampType
tsType
,
int
*
affectedRows
);
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
0318c20e
...
...
@@ -2699,7 +2699,7 @@ int32_t tscParseLines(char* data, int32_t len, char* lines[], int numLines, SArr
return
code
;
}
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
data
,
int
len
,
char
*
lines
[],
int
numLines
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
,
int
*
affectedRows
)
{
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
data
,
int
len
,
char
*
lines
[],
int
*
numLines
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
,
int
*
affectedRows
)
{
int32_t
code
=
0
;
SSmlLinesInfo
*
info
=
tcalloc
(
1
,
sizeof
(
SSmlLinesInfo
));
...
...
@@ -2708,26 +2708,26 @@ int taos_insert_lines(TAOS* taos, char* data, int len, char* lines[], int numLin
info
->
protocol
=
protocol
;
if
(
data
){
numLines
=
0
;
*
numLines
=
0
;
for
(
int
i
=
0
;
i
<
len
;
i
++
){
if
(
data
[
i
]
==
'\0'
){
data
[
i
]
=
'0'
;
}
if
(
data
[
i
]
==
'\n'
||
i
==
len
-
1
){
numLines
++
;
(
*
numLines
)
++
;
}
}
}
if
(
numLines
<=
0
||
numLines
>
65536
*
32
)
{
tscError
(
"SML:0x%"
PRIx64
" taos_insert_lines numLines should be between 1 and 65536*32. numLines: %d"
,
info
->
id
,
numLines
);
if
(
*
numLines
<=
0
||
*
numLines
>
65536
*
32
)
{
tscError
(
"SML:0x%"
PRIx64
" taos_insert_lines numLines should be between 1 and 65536*32. numLines: %d"
,
info
->
id
,
*
numLines
);
tfree
(
info
);
code
=
TSDB_CODE_TSC_APP_ERROR
;
return
code
;
}
if
(
lines
){
for
(
int
i
=
0
;
i
<
numLines
;
++
i
)
{
for
(
int
i
=
0
;
i
<
*
numLines
;
++
i
)
{
if
(
lines
[
i
]
==
NULL
)
{
tscError
(
"SML:0x%"
PRIx64
" taos_insert_lines line %d is NULL"
,
info
->
id
,
i
);
tfree
(
info
);
...
...
@@ -2737,22 +2737,22 @@ int taos_insert_lines(TAOS* taos, char* data, int len, char* lines[], int numLin
}
}
SArray
*
lpPoints
=
taosArrayInit
(
numLines
,
sizeof
(
TAOS_SML_DATA_POINT
));
SArray
*
lpPoints
=
taosArrayInit
(
*
numLines
,
sizeof
(
TAOS_SML_DATA_POINT
));
if
(
lpPoints
==
NULL
)
{
tscError
(
"SML:0x%"
PRIx64
" taos_insert_lines failed to allocate memory"
,
info
->
id
);
tfree
(
info
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
tscDebug
(
"SML:0x%"
PRIx64
" taos_insert_lines begin inserting %d lines"
,
info
->
id
,
numLines
);
code
=
tscParseLines
(
data
,
len
,
lines
,
numLines
,
lpPoints
,
NULL
,
info
);
tscDebug
(
"SML:0x%"
PRIx64
" taos_insert_lines begin inserting %d lines"
,
info
->
id
,
*
numLines
);
code
=
tscParseLines
(
data
,
len
,
lines
,
*
numLines
,
lpPoints
,
NULL
,
info
);
size_t
numPoints
=
taosArrayGetSize
(
lpPoints
);
TAOS_SML_DATA_POINT
*
points
=
TARRAY_GET_START
(
lpPoints
);
if
(
code
!=
0
)
{
goto
cleanup
;
}
TAOS_SML_DATA_POINT
*
points
=
TARRAY_GET_START
(
lpPoints
);
code
=
tscSmlInsert
(
taos
,
points
,
(
int
)
numPoints
,
info
);
if
(
code
!=
0
)
{
tscError
(
"SML:0x%"
PRIx64
" taos_sml_insert error: %s"
,
info
->
id
,
tstrerror
((
code
)));
...
...
@@ -2762,9 +2762,7 @@ int taos_insert_lines(TAOS* taos, char* data, int len, char* lines[], int numLin
}
cleanup:
tscDebug
(
"SML:0x%"
PRIx64
" taos_insert_lines finish inserting %d lines. code: %d"
,
info
->
id
,
numLines
,
code
);
points
=
TARRAY_GET_START
(
lpPoints
);
numPoints
=
taosArrayGetSize
(
lpPoints
);
tscDebug
(
"SML:0x%"
PRIx64
" taos_insert_lines finish inserting %d lines. code: %d"
,
info
->
id
,
*
numLines
,
code
);
for
(
int
i
=
0
;
i
<
numPoints
;
++
i
)
{
destroySmlDataPoint
(
points
+
i
);
}
...
...
@@ -2860,13 +2858,13 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
switch
(
protocol
)
{
case
TSDB_SML_LINE_PROTOCOL
:
code
=
taos_insert_lines
(
taos
,
NULL
,
0
,
lines
,
numLines
,
protocol
,
tsType
,
&
affected_rows
);
code
=
taos_insert_lines
(
taos
,
NULL
,
0
,
lines
,
&
numLines
,
protocol
,
tsType
,
&
affected_rows
);
break
;
case
TSDB_SML_TELNET_PROTOCOL
:
code
=
taos_insert_telnet_lines
(
taos
,
NULL
,
0
,
lines
,
numLines
,
protocol
,
tsType
,
&
affected_rows
);
code
=
taos_insert_telnet_lines
(
taos
,
NULL
,
0
,
lines
,
&
numLines
,
protocol
,
tsType
,
&
affected_rows
);
break
;
case
TSDB_SML_JSON_PROTOCOL
:
code
=
taos_insert_json_payload
(
taos
,
*
lines
,
protocol
,
tsType
,
&
affected_rows
);
code
=
taos_insert_json_payload
(
taos
,
*
lines
,
protocol
,
&
numLines
,
tsType
,
&
affected_rows
);
break
;
default:
code
=
TSDB_CODE_TSC_INVALID_PROTOCOL_TYPE
;
...
...
@@ -2891,15 +2889,20 @@ TAOS_RES *taos_schemaless_insert_raw(TAOS* taos, char* lines, int len, int32_t *
}
}
if
(
!
totalRows
){
tscError
(
"totalRows is null"
);
return
NULL
;
}
switch
(
protocol
)
{
case
TSDB_SML_LINE_PROTOCOL
:
code
=
taos_insert_lines
(
taos
,
lines
,
len
,
NULL
,
0
,
protocol
,
tsType
,
&
affected_rows
);
code
=
taos_insert_lines
(
taos
,
lines
,
len
,
NULL
,
totalRows
,
protocol
,
tsType
,
&
affected_rows
);
break
;
case
TSDB_SML_TELNET_PROTOCOL
:
code
=
taos_insert_telnet_lines
(
taos
,
lines
,
len
,
NULL
,
0
,
protocol
,
tsType
,
&
affected_rows
);
code
=
taos_insert_telnet_lines
(
taos
,
lines
,
len
,
NULL
,
totalRows
,
protocol
,
tsType
,
&
affected_rows
);
break
;
case
TSDB_SML_JSON_PROTOCOL
:
code
=
taos_insert_json_payload
(
taos
,
lines
,
protocol
,
tsType
,
&
affected_rows
);
code
=
taos_insert_json_payload
(
taos
,
lines
,
protocol
,
t
otalRows
,
t
sType
,
&
affected_rows
);
break
;
default:
code
=
TSDB_CODE_TSC_INVALID_PROTOCOL_TYPE
;
...
...
src/client/src/tscParseOpenTSDB.c
浏览文件 @
0318c20e
...
...
@@ -450,7 +450,7 @@ static int32_t tscParseTelnetLines(char* data, int32_t len, char* lines[], int n
return
code
;
}
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
data
,
int32_t
len
,
char
*
lines
[],
int
numLines
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
,
int
*
affectedRows
)
{
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
data
,
int32_t
len
,
char
*
lines
[],
int
*
numLines
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
,
int
*
affectedRows
)
{
int32_t
code
=
0
;
SSmlLinesInfo
*
info
=
tcalloc
(
1
,
sizeof
(
SSmlLinesInfo
));
...
...
@@ -459,26 +459,26 @@ int taos_insert_telnet_lines(TAOS* taos, char* data, int32_t len, char* lines[],
info
->
protocol
=
protocol
;
if
(
data
&&
!
lines
){
numLines
=
0
;
*
numLines
=
0
;
for
(
int
i
=
0
;
i
<
len
;
i
++
){
if
(
data
[
i
]
==
'\0'
){
data
[
i
]
=
'0'
;
}
if
(
data
[
i
]
==
'\n'
||
i
==
len
-
1
){
numLines
++
;
(
*
numLines
)
++
;
}
}
}
if
(
numLines
<=
0
||
numLines
>
65536
)
{
tscError
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines numLines should be between 1 and 65536. numLines: %d"
,
info
->
id
,
numLines
);
if
(
*
numLines
<=
0
||
*
numLines
>
65536
)
{
tscError
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines numLines should be between 1 and 65536. numLines: %d"
,
info
->
id
,
*
numLines
);
tfree
(
info
);
code
=
TSDB_CODE_TSC_APP_ERROR
;
return
code
;
}
if
(
!
data
&&
lines
){
for
(
int
i
=
0
;
i
<
numLines
;
++
i
)
{
for
(
int
i
=
0
;
i
<
*
numLines
;
++
i
)
{
if
(
lines
[
i
]
==
NULL
)
{
tscError
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines line %d is NULL"
,
info
->
id
,
i
);
tfree
(
info
);
...
...
@@ -488,22 +488,22 @@ int taos_insert_telnet_lines(TAOS* taos, char* data, int32_t len, char* lines[],
}
}
SArray
*
lpPoints
=
taosArrayInit
(
numLines
,
sizeof
(
TAOS_SML_DATA_POINT
));
SArray
*
lpPoints
=
taosArrayInit
(
*
numLines
,
sizeof
(
TAOS_SML_DATA_POINT
));
if
(
lpPoints
==
NULL
)
{
tscError
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines failed to allocate memory"
,
info
->
id
);
tfree
(
info
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
tscDebug
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines begin inserting %d lines, first line: %s"
,
info
->
id
,
numLines
,
lines
[
0
]);
code
=
tscParseTelnetLines
(
data
,
len
,
lines
,
numLines
,
lpPoints
,
NULL
,
info
);
tscDebug
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines begin inserting %d lines, first line: %s"
,
info
->
id
,
*
numLines
,
lines
[
0
]);
code
=
tscParseTelnetLines
(
data
,
len
,
lines
,
*
numLines
,
lpPoints
,
NULL
,
info
);
size_t
numPoints
=
taosArrayGetSize
(
lpPoints
);
TAOS_SML_DATA_POINT
*
points
=
TARRAY_GET_START
(
lpPoints
);
if
(
code
!=
0
)
{
goto
cleanup
;
}
TAOS_SML_DATA_POINT
*
points
=
TARRAY_GET_START
(
lpPoints
);
code
=
tscSmlInsert
(
taos
,
points
,
(
int
)
numPoints
,
info
);
if
(
code
!=
0
)
{
tscError
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines error: %s"
,
info
->
id
,
tstrerror
((
code
)));
...
...
@@ -513,9 +513,7 @@ int taos_insert_telnet_lines(TAOS* taos, char* data, int32_t len, char* lines[],
}
cleanup:
tscDebug
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines finish inserting %d lines. code: %d"
,
info
->
id
,
numLines
,
code
);
points
=
TARRAY_GET_START
(
lpPoints
);
numPoints
=
taosArrayGetSize
(
lpPoints
);
tscDebug
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines finish inserting %d lines. code: %d"
,
info
->
id
,
*
numLines
,
code
);
for
(
int
i
=
0
;
i
<
numPoints
;
++
i
)
{
destroySmlDataPoint
(
points
+
i
);
}
...
...
@@ -1107,8 +1105,9 @@ PARSE_JSON_OVER:
return
ret
;
}
int
taos_insert_json_payload
(
TAOS
*
taos
,
char
*
payload
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
,
int
*
affectedRows
)
{
int
taos_insert_json_payload
(
TAOS
*
taos
,
char
*
payload
,
SMLProtocolType
protocol
,
int32_t
*
totalRows
,
SMLTimeStampType
tsType
,
int
*
affectedRows
)
{
int32_t
code
=
0
;
*
totalRows
=
0
;
SSmlLinesInfo
*
info
=
tcalloc
(
1
,
sizeof
(
SSmlLinesInfo
));
info
->
id
=
genUID
();
...
...
@@ -1132,12 +1131,12 @@ int taos_insert_json_payload(TAOS* taos, char* payload, SMLProtocolType protocol
tscDebug
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines begin inserting %d points"
,
info
->
id
,
1
);
code
=
tscParseMultiJSONPayload
(
payload
,
lpPoints
,
info
);
size_t
numPoints
=
taosArrayGetSize
(
lpPoints
);
TAOS_SML_DATA_POINT
*
points
=
TARRAY_GET_START
(
lpPoints
);
if
(
code
!=
0
)
{
goto
cleanup
;
}
TAOS_SML_DATA_POINT
*
points
=
TARRAY_GET_START
(
lpPoints
);
code
=
tscSmlInsert
(
taos
,
points
,
(
int
)
numPoints
,
info
);
if
(
code
!=
0
)
{
tscError
(
"OTD:0x%"
PRIx64
" taos_insert_json_payload error: %s"
,
info
->
id
,
tstrerror
((
code
)));
...
...
@@ -1145,11 +1144,10 @@ int taos_insert_json_payload(TAOS* taos, char* payload, SMLProtocolType protocol
if
(
affectedRows
!=
NULL
)
{
*
affectedRows
=
info
->
affectedRows
;
}
*
totalRows
=
numPoints
;
cleanup:
tscDebug
(
"OTD:0x%"
PRIx64
" taos_insert_json_payload finish inserting 1 Point. code: %d"
,
info
->
id
,
code
);
points
=
TARRAY_GET_START
(
lpPoints
);
numPoints
=
taosArrayGetSize
(
lpPoints
);
for
(
int
i
=
0
;
i
<
numPoints
;
++
i
)
{
destroySmlDataPoint
(
points
+
i
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录