Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
65ef7c62
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看板
提交
65ef7c62
编写于
5月 16, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor:add the configuration of child table name
上级
bfab8477
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
17 deletion
+19
-17
source/client/src/clientSml.c
source/client/src/clientSml.c
+3
-3
source/client/test/smlTest.cpp
source/client/test/smlTest.cpp
+16
-14
未找到文件。
source/client/src/clientSml.c
浏览文件 @
65ef7c62
...
...
@@ -1183,7 +1183,7 @@ static int32_t smlParseCols(const char* data, int32_t len, SArray *cols, char *c
PROCESS_SLASH
(
value
,
valueLen
)
//handle child table name
if
(
childTableNameLen
!=
0
&&
strncmp
(
key
,
tsSmlChildTableName
,
keyLen
)
==
0
){
if
(
childTableName
&&
childTableName
Len
!=
0
&&
strncmp
(
key
,
tsSmlChildTableName
,
keyLen
)
==
0
){
memset
(
childTableName
,
0
,
TSDB_TABLE_NAME_LEN
);
strncpy
(
childTableName
,
value
,
(
valueLen
<
TSDB_TABLE_NAME_LEN
?
valueLen
:
TSDB_TABLE_NAME_LEN
));
continue
;
...
...
@@ -1984,7 +1984,7 @@ static int32_t smlParseInfluxLine(SSmlHandle* info, const char* sql) {
if
(
info
->
dataFormat
)
taosArrayDestroy
(
cols
);
return
ret
;
}
ret
=
smlParseCols
(
elements
.
cols
,
elements
.
colsLen
,
cols
,
false
,
info
->
dumplicateKey
,
&
info
->
msgBuf
);
ret
=
smlParseCols
(
elements
.
cols
,
elements
.
colsLen
,
cols
,
NULL
,
false
,
info
->
dumplicateKey
,
&
info
->
msgBuf
);
if
(
ret
!=
TSDB_CODE_SUCCESS
){
uError
(
"SML:0x%"
PRIx64
" smlParseCols parse cloums fields failed"
,
info
->
id
);
smlDestroyCols
(
cols
);
...
...
@@ -2015,7 +2015,7 @@ static int32_t smlParseInfluxLine(SSmlHandle* info, const char* sql) {
}
if
(
!
hasTable
){
ret
=
smlParseCols
(
elements
.
tags
,
elements
.
tagsLen
,
(
*
oneTable
)
->
tags
,
true
,
info
->
dumplicateKey
,
&
info
->
msgBuf
);
ret
=
smlParseCols
(
elements
.
tags
,
elements
.
tagsLen
,
(
*
oneTable
)
->
tags
,
(
*
oneTable
)
->
childTableName
,
true
,
info
->
dumplicateKey
,
&
info
->
msgBuf
);
if
(
ret
!=
TSDB_CODE_SUCCESS
){
uError
(
"SML:0x%"
PRIx64
" smlParseCols parse tag fields failed"
,
info
->
id
);
return
ret
;
...
...
source/client/test/smlTest.cpp
浏览文件 @
65ef7c62
...
...
@@ -207,7 +207,7 @@ TEST(testCase, smlParseCols_Error_Test) {
char
*
sql
=
(
char
*
)
taosMemoryCalloc
(
256
,
1
);
memcpy
(
sql
,
data
[
i
],
len
+
1
);
SArray
*
cols
=
taosArrayInit
(
8
,
POINTER_BYTES
);
int32_t
ret
=
smlParseCols
(
sql
,
len
,
cols
,
false
,
dumplicateKey
,
&
msgBuf
);
int32_t
ret
=
smlParseCols
(
sql
,
len
,
cols
,
NULL
,
false
,
dumplicateKey
,
&
msgBuf
);
ASSERT_NE
(
ret
,
TSDB_CODE_SUCCESS
);
taosHashClear
(
dumplicateKey
);
taosMemoryFree
(
sql
);
...
...
@@ -233,7 +233,7 @@ TEST(testCase, smlParseCols_tag_Test) {
const
char
*
data
=
"cbin=
\"
passit helloc
\"
,cnch=L
\"
iisdfsf
\"
,cbool=false,cf64=4.31f64,cf64_=8.32,cf32=8.23f32,ci8=-34i8,cu8=89u8,ci16=233i16,cu16=898u16,ci32=98289i32,cu32=12323u32,ci64=-89238i64,ci=989i,cu64=8989323u64,cbooltrue=true,cboolt=t,cboolf=f,cnch_=l
\"
iuwq
\"
"
;
int32_t
len
=
strlen
(
data
);
int32_t
ret
=
smlParseCols
(
data
,
len
,
cols
,
true
,
dumplicateKey
,
&
msgBuf
);
int32_t
ret
=
smlParseCols
(
data
,
len
,
cols
,
NULL
,
true
,
dumplicateKey
,
&
msgBuf
);
ASSERT_EQ
(
ret
,
TSDB_CODE_SUCCESS
);
int32_t
size
=
taosArrayGetSize
(
cols
);
ASSERT_EQ
(
size
,
19
);
...
...
@@ -265,7 +265,7 @@ TEST(testCase, smlParseCols_tag_Test) {
len
=
0
;
memset
(
msgBuf
.
buf
,
0
,
msgBuf
.
len
);
taosHashClear
(
dumplicateKey
);
ret
=
smlParseCols
(
data
,
len
,
cols
,
true
,
dumplicateKey
,
&
msgBuf
);
ret
=
smlParseCols
(
data
,
len
,
cols
,
NULL
,
true
,
dumplicateKey
,
&
msgBuf
);
ASSERT_EQ
(
ret
,
TSDB_CODE_SUCCESS
);
size
=
taosArrayGetSize
(
cols
);
ASSERT_EQ
(
size
,
1
);
...
...
@@ -298,7 +298,7 @@ TEST(testCase, smlParseCols_Test) {
int32_t
len
=
strlen
(
data
);
char
*
sql
=
(
char
*
)
taosMemoryCalloc
(
1024
,
1
);
memcpy
(
sql
,
data
,
len
+
1
);
int32_t
ret
=
smlParseCols
(
sql
,
len
,
cols
,
false
,
dumplicateKey
,
&
msgBuf
);
int32_t
ret
=
smlParseCols
(
sql
,
len
,
cols
,
NULL
,
false
,
dumplicateKey
,
&
msgBuf
);
ASSERT_EQ
(
ret
,
TSDB_CODE_SUCCESS
);
int32_t
size
=
taosArrayGetSize
(
cols
);
ASSERT_EQ
(
size
,
19
);
...
...
@@ -516,16 +516,18 @@ TEST(testCase, smlProcess_influx_Test) {
int
ret
=
smlProcess
(
info
,
(
char
**
)
sql
,
sizeof
(
sql
)
/
sizeof
(
sql
[
0
]));
ASSERT_EQ
(
ret
,
0
);
// TAOS_RES *res = taos_query(taos, "select * from t_6885c584b98481584ee13dac399e173d");
// ASSERT_NE(res, nullptr);
// int fieldNum = taos_field_count(res);
// ASSERT_EQ(fieldNum, 5);
// int rowNum = taos_affected_rows(res);
// ASSERT_EQ(rowNum, 2);
// for (int i = 0; i < rowNum; ++i) {
// TAOS_ROW rows = taos_fetch_row(res);
// }
// taos_free_result(res);
TAOS_RES
*
res
=
taos_query
(
taos
,
"select * from t_6885c584b98481584ee13dac399e173d"
);
ASSERT_NE
(
res
,
nullptr
);
int
fieldNum
=
taos_field_count
(
res
);
//ASSERT_EQ(fieldNum, 5);
printf
(
"fieldNum:%d
\n
"
,
fieldNum
);
int
rowNum
=
taos_affected_rows
(
res
);
//ASSERT_EQ(rowNum, 2);
printf
(
"rowNum:%d
\n
"
,
rowNum
);
for
(
int
i
=
0
;
i
<
rowNum
;
++
i
)
{
TAOS_ROW
rows
=
taos_fetch_row
(
res
);
}
taos_free_result
(
res
);
destroyRequest
(
request
);
smlDestroyInfo
(
info
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录