Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ec4b54d7
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看板
未验证
提交
ec4b54d7
编写于
6月 26, 2023
作者:
H
Haojun Liao
提交者:
GitHub
6月 26, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21726 from taosdata/mark/sml
fix:quote process error in sml
上级
25e6b123
4be3f513
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
13 deletion
+16
-13
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+11
-10
source/client/test/smlTest.cpp
source/client/test/smlTest.cpp
+2
-0
utils/test/c/sml_test.c
utils/test/c/sml_test.c
+3
-3
未找到文件。
source/client/src/clientSmlLine.c
浏览文件 @
ec4b54d7
...
...
@@ -202,7 +202,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
bool
keyEscaped
=
false
;
size_t
keyLenEscaped
=
0
;
while
(
*
sql
<
sqlEnd
)
{
if
(
unlikely
(
IS_COMMA
(
*
sql
)))
{
if
(
unlikely
(
IS_
SPACE
(
*
sql
)
||
IS_
COMMA
(
*
sql
)))
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"invalid data"
,
*
sql
);
return
TSDB_CODE_SML_INVALID_DATA
;
}
...
...
@@ -410,7 +410,7 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
bool
keyEscaped
=
false
;
size_t
keyLenEscaped
=
0
;
while
(
*
sql
<
sqlEnd
)
{
if
(
unlikely
(
IS_COMMA
(
*
sql
)))
{
if
(
unlikely
(
IS_
SPACE
(
*
sql
)
||
IS_
COMMA
(
*
sql
)))
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"invalid data"
,
*
sql
);
return
TSDB_CODE_SML_INVALID_DATA
;
}
...
...
@@ -436,19 +436,20 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
size_t
valueLen
=
0
;
bool
valueEscaped
=
false
;
size_t
valueLenEscaped
=
0
;
bool
isInQuote
=
false
;
int
quoteNum
=
0
;
const
char
*
escapeChar
=
NULL
;
while
(
*
sql
<
sqlEnd
)
{
// parse value
if
(
unlikely
(
*
(
*
sql
)
==
QUOTE
&&
(
*
(
*
sql
-
1
)
!=
SLASH
||
(
*
sql
-
1
)
==
escapeChar
)))
{
isInQuote
=
!
isInQuote
;
quoteNum
++
;
(
*
sql
)
++
;
continue
;
}
if
(
!
isInQuote
)
{
if
(
unlikely
(
IS_SPACE
(
*
sql
)
||
IS_COMMA
(
*
sql
)))
{
if
(
quoteNum
>
2
){
break
;
}
continue
;
}
if
(
quoteNum
%
2
==
0
&&
(
unlikely
(
IS_SPACE
(
*
sql
)
||
IS_COMMA
(
*
sql
))))
{
break
;
}
if
(
IS_SLASH_LETTER_IN_FIELD_VALUE
(
*
sql
)
&&
(
*
sql
-
1
)
!=
escapeChar
)
{
escapeChar
=
*
sql
;
...
...
@@ -460,8 +461,8 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
}
valueLen
=
*
sql
-
value
;
if
(
unlikely
(
isInQuote
))
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"
only one quote
"
,
value
);
if
(
unlikely
(
quoteNum
!=
0
&&
quoteNum
!=
2
))
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"
unbalanced quotes
"
,
value
);
return
TSDB_CODE_SML_INVALID_DATA
;
}
if
(
unlikely
(
valueLen
==
0
))
{
...
...
source/client/test/smlTest.cpp
浏览文件 @
ec4b54d7
...
...
@@ -224,6 +224,8 @@ TEST(testCase, smlParseCols_Error_Test) {
"st,tt=aa c 1=2 1626006833639000000,"
,
//field value double quote,slash
"st,tt=aa c=
\"
a
\"
a
\"
1626006833639000000,"
,
"escape_test,tag1=
\"
tag1_value
\"
,tag2=
\"
tag2_value
\"
co l0=
\"
col0_value
\"
,col1=
\"
col1_value
\"
1680918783010000000"
,
"escape_test,tag1=
\"
tag1_value
\"
,tag2=
\"
tag2_value
\"
col0=
\"
co
\"
l
\"
0_value
\"
,col1=
\"
col1_value
\"
1680918783010000000"
};
SSmlHandle
*
info
=
smlBuildSmlInfo
(
NULL
);
...
...
utils/test/c/sml_test.c
浏览文件 @
ec4b54d7
...
...
@@ -1536,9 +1536,9 @@ int main(int argc, char *argv[]) {
ASSERT
(
!
ret
);
ret
=
sml_ts3116_Test
();
ASSERT
(
!
ret
);
//
ret = sml_ts2385_Test(); // this test case need config sml table name using ./sml_test config_file
//
ASSERT(!ret);
ret
=
sml_ts3303_Test
();
// this test case need config sml table name using ./sml_test config_file
ret
=
sml_ts2385_Test
();
// this test case need config sml table name using ./sml_test config_file
ASSERT
(
!
ret
);
ret
=
sml_ts3303_Test
();
ASSERT
(
!
ret
);
// for(int i = 0; i < sizeof(str)/sizeof(str[0]); i++){
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录