Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ff99c42e
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
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看板
提交
ff99c42e
编写于
5月 28, 2021
作者:
S
Shuduo Sang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cherry-pick from master branch.
上级
c5682598
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
7 deletion
+17
-7
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+17
-7
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
ff99c42e
...
@@ -3812,25 +3812,29 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
...
@@ -3812,25 +3812,29 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
// dbinfo
// dbinfo
cJSON
*
stbName
=
cJSON_GetObjectItem
(
stbInfo
,
"name"
);
cJSON
*
stbName
=
cJSON_GetObjectItem
(
stbInfo
,
"name"
);
if
(
!
stbName
||
stbName
->
type
!=
cJSON_String
||
stbName
->
valuestring
==
NULL
)
{
if
(
!
stbName
||
stbName
->
type
!=
cJSON_String
||
stbName
->
valuestring
==
NULL
)
{
errorPrint
(
"%s() LN%d, failed to read json, stb name not found
\n
"
,
errorPrint
(
"%s() LN%d, failed to read json, stb name not found
\n
"
,
__func__
,
__LINE__
);
__func__
,
__LINE__
);
goto
PARSE_OVER
;
goto
PARSE_OVER
;
}
}
tstrncpy
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sTblName
,
stbName
->
valuestring
,
MAX_TB_NAME_SIZE
);
tstrncpy
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sTblName
,
stbName
->
valuestring
,
MAX_TB_NAME_SIZE
);
cJSON
*
prefix
=
cJSON_GetObjectItem
(
stbInfo
,
"childtable_prefix"
);
cJSON
*
prefix
=
cJSON_GetObjectItem
(
stbInfo
,
"childtable_prefix"
);
if
(
!
prefix
||
prefix
->
type
!=
cJSON_String
||
prefix
->
valuestring
==
NULL
)
{
if
(
!
prefix
||
prefix
->
type
!=
cJSON_String
||
prefix
->
valuestring
==
NULL
)
{
printf
(
"ERROR: failed to read json, childtable_prefix not found
\n
"
);
printf
(
"ERROR: failed to read json, childtable_prefix not found
\n
"
);
goto
PARSE_OVER
;
goto
PARSE_OVER
;
}
}
tstrncpy
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblPrefix
,
prefix
->
valuestring
,
MAX_DB_NAME_SIZE
);
tstrncpy
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblPrefix
,
prefix
->
valuestring
,
MAX_DB_NAME_SIZE
);
cJSON
*
autoCreateTbl
=
cJSON_GetObjectItem
(
stbInfo
,
"auto_create_table"
);
// yes, no, null
cJSON
*
autoCreateTbl
=
cJSON_GetObjectItem
(
stbInfo
,
"auto_create_table"
);
if
(
autoCreateTbl
if
(
autoCreateTbl
&&
autoCreateTbl
->
type
==
cJSON_String
&&
autoCreateTbl
->
type
==
cJSON_String
&&
autoCreateTbl
->
valuestring
!=
NULL
)
{
&&
autoCreateTbl
->
valuestring
!=
NULL
)
{
if
(
0
==
strncasecmp
(
autoCreateTbl
->
valuestring
,
"yes"
,
3
))
{
if
((
0
==
strncasecmp
(
autoCreateTbl
->
valuestring
,
"yes"
,
3
))
&&
(
TBL_ALREADY_EXISTS
!=
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblExists
))
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
autoCreateTable
=
AUTO_CREATE_SUBTBL
;
g_Dbs
.
db
[
i
].
superTbls
[
j
].
autoCreateTable
=
AUTO_CREATE_SUBTBL
;
}
else
if
(
0
==
strncasecmp
(
autoCreateTbl
->
valuestring
,
"no"
,
2
))
{
}
else
if
(
0
==
strncasecmp
(
autoCreateTbl
->
valuestring
,
"no"
,
2
))
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
autoCreateTable
=
PRE_CREATE_SUBTBL
;
g_Dbs
.
db
[
i
].
superTbls
[
j
].
autoCreateTable
=
PRE_CREATE_SUBTBL
;
...
@@ -3875,6 +3879,10 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
...
@@ -3875,6 +3879,10 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
goto
PARSE_OVER
;
goto
PARSE_OVER
;
}
}
if
(
TBL_ALREADY_EXISTS
==
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblExists
)
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
autoCreateTable
=
PRE_CREATE_SUBTBL
;
}
cJSON
*
count
=
cJSON_GetObjectItem
(
stbInfo
,
"childtable_count"
);
cJSON
*
count
=
cJSON_GetObjectItem
(
stbInfo
,
"childtable_count"
);
if
(
!
count
||
count
->
type
!=
cJSON_Number
||
0
>=
count
->
valueint
)
{
if
(
!
count
||
count
->
type
!=
cJSON_Number
||
0
>=
count
->
valueint
)
{
errorPrint
(
"%s() LN%d, failed to read json, childtable_count input mistake
\n
"
,
errorPrint
(
"%s() LN%d, failed to read json, childtable_count input mistake
\n
"
,
...
@@ -3932,7 +3940,8 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
...
@@ -3932,7 +3940,8 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
cJSON
*
childTbl_offset
=
cJSON_GetObjectItem
(
stbInfo
,
"childtable_offset"
);
cJSON
*
childTbl_offset
=
cJSON_GetObjectItem
(
stbInfo
,
"childtable_offset"
);
if
((
childTbl_offset
)
&&
(
g_Dbs
.
db
[
i
].
drop
!=
true
)
if
((
childTbl_offset
)
&&
(
g_Dbs
.
db
[
i
].
drop
!=
true
)
&&
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblExists
==
TBL_ALREADY_EXISTS
))
{
&&
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblExists
==
TBL_ALREADY_EXISTS
))
{
if
(
childTbl_offset
->
type
!=
cJSON_Number
||
0
>
childTbl_offset
->
valueint
)
{
if
((
childTbl_offset
->
type
!=
cJSON_Number
)
||
(
0
>
childTbl_offset
->
valueint
))
{
printf
(
"ERROR: failed to read json, childtable_offset
\n
"
);
printf
(
"ERROR: failed to read json, childtable_offset
\n
"
);
goto
PARSE_OVER
;
goto
PARSE_OVER
;
}
}
...
@@ -3988,7 +3997,8 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
...
@@ -3988,7 +3997,8 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
}
}
cJSON
*
tagsFile
=
cJSON_GetObjectItem
(
stbInfo
,
"tags_file"
);
cJSON
*
tagsFile
=
cJSON_GetObjectItem
(
stbInfo
,
"tags_file"
);
if
(
tagsFile
&&
tagsFile
->
type
==
cJSON_String
&&
tagsFile
->
valuestring
!=
NULL
)
{
if
((
tagsFile
&&
tagsFile
->
type
==
cJSON_String
)
&&
(
tagsFile
->
valuestring
!=
NULL
))
{
tstrncpy
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
tagsFile
,
tstrncpy
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
tagsFile
,
tagsFile
->
valuestring
,
MAX_FILE_NAME_LEN
);
tagsFile
->
valuestring
,
MAX_FILE_NAME_LEN
);
if
(
0
==
g_Dbs
.
db
[
i
].
superTbls
[
j
].
tagsFile
[
0
])
{
if
(
0
==
g_Dbs
.
db
[
i
].
superTbls
[
j
].
tagsFile
[
0
])
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录