Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
37998561
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
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看板
提交
37998561
编写于
11月 15, 2021
作者:
Z
zhaoyanggh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix asm error
上级
25562295
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
249 addition
and
225 deletion
+249
-225
src/kit/taosdemo/inc/demo.h
src/kit/taosdemo/inc/demo.h
+5
-2
src/kit/taosdemo/src/demoCommandOpt.c
src/kit/taosdemo/src/demoCommandOpt.c
+195
-218
src/kit/taosdemo/src/demoInsert.c
src/kit/taosdemo/src/demoInsert.c
+17
-3
src/kit/taosdemo/src/demoJsonOpt.c
src/kit/taosdemo/src/demoJsonOpt.c
+30
-1
src/kit/taosdemo/src/demoMain.c
src/kit/taosdemo/src/demoMain.c
+2
-1
未找到文件。
src/kit/taosdemo/inc/demo.h
浏览文件 @
37998561
...
...
@@ -160,7 +160,7 @@ extern char configDir[];
#define DEFAULT_SUB_INTERVAL 10000
#define DEFAULT_QUERY_INTERVAL 10000
#define S
TMT_BIND_PARAM_BATCH 1
#define S
ML_LINE_SQL_SYNTAX_OFFSET 7
#if _MSC_VER <= 1900
#define __func__ __FUNCTION__
...
...
@@ -346,6 +346,7 @@ typedef struct SSuperTable_S {
// one sql
uint8_t
autoCreateTable
;
// 0: create sub table, 1: auto create sub table
uint16_t
iface
;
// 0: taosc, 1: rest, 2: stmt
uint16_t
lineProtocol
;
int64_t
childTblLimit
;
uint64_t
childTblOffset
;
...
...
@@ -359,6 +360,7 @@ typedef struct SSuperTable_S {
// interval
int64_t
insertRows
;
int64_t
timeStampStep
;
int
tsPrecision
;
char
startTimestamp
[
MAX_TB_NAME_SIZE
];
char
sampleFormat
[
SMALL_BUFF_LEN
];
// csv, json
char
sampleFile
[
MAX_FILE_NAME_LEN
];
...
...
@@ -577,6 +579,7 @@ extern char * g_aggreFuncDemo[];
extern
char
*
g_aggreFunc
[];
extern
SArguments
g_args
;
extern
SDbs
g_Dbs
;
extern
char
*
g_dupstr
;
extern
int64_t
g_totalChildTables
;
extern
int64_t
g_actualChildTables
;
extern
SQueryMetaInfo
g_queryInfo
;
...
...
@@ -585,7 +588,7 @@ extern FILE * g_fpOfInsertResult;
#define min(a, b) (((a) < (b)) ? (a) : (b))
/* ************ Function declares ************ */
int
parse_args
(
int
argc
,
char
*
argv
[]
,
SArguments
*
arguments
);
int
parse_args
(
int
argc
,
char
*
argv
[]);
int
getInfoFromJsonFile
(
char
*
file
);
void
setupForAnsiEscape
(
void
);
int
taosRandom
();
...
...
src/kit/taosdemo/src/demoCommandOpt.c
浏览文件 @
37998561
此差异已折叠。
点击以展开。
src/kit/taosdemo/src/demoInsert.c
浏览文件 @
37998561
...
...
@@ -182,6 +182,9 @@ static int calcRowLen(SSuperTable *superTbls) {
errorPrint
(
"get error data type : %s
\n
"
,
dataType
);
exit
(
EXIT_FAILURE
);
}
if
(
superTbls
->
iface
==
SML_IFACE
)
{
lenOfOneRow
+=
SML_LINE_SQL_SYNTAX_OFFSET
;
}
}
superTbls
->
lenOfOneRow
=
lenOfOneRow
+
TIMESTAMP_BUFF_LEN
;
// timestamp
...
...
@@ -233,6 +236,15 @@ static int calcRowLen(SSuperTable *superTbls) {
errorPrint
(
"get error tag type : %s
\n
"
,
dataType
);
exit
(
EXIT_FAILURE
);
}
if
(
superTbls
->
iface
==
SML_IFACE
)
{
lenOfOneRow
+=
SML_LINE_SQL_SYNTAX_OFFSET
;
}
}
if
(
superTbls
->
iface
==
SML_IFACE
)
{
lenOfTagOfOneRow
+=
2
*
TSDB_TABLE_NAME_LEN
*
2
+
SML_LINE_SQL_SYNTAX_OFFSET
;
superTbls
->
lenOfOneRow
+=
lenOfTagOfOneRow
;
}
superTbls
->
lenOfTagOfOneRow
=
lenOfTagOfOneRow
;
...
...
@@ -1357,7 +1369,7 @@ static int prepareSampleData() {
void
postFreeResource
()
{
tmfclose
(
g_fpOfInsertResult
);
tmfree
(
g_dupstr
);
for
(
int
i
=
0
;
i
<
g_Dbs
.
dbCount
;
i
++
)
{
for
(
uint64_t
j
=
0
;
j
<
g_Dbs
.
db
[
i
].
superTblCount
;
j
++
)
{
if
(
0
!=
g_Dbs
.
db
[
i
].
superTbls
[
j
].
colsOfCreateChildTable
)
{
...
...
@@ -1918,8 +1930,10 @@ static int32_t execInsert(threadInfo *pThreadInfo, uint32_t k) {
affectedRows
=
k
;
break
;
case
SML_IFACE
:
res
=
taos_schemaless_insert
(
pThreadInfo
->
taos
,
pThreadInfo
->
lines
,
k
,
0
,
pThreadInfo
->
time_precision
);
res
=
taos_schemaless_insert
(
pThreadInfo
->
taos
,
pThreadInfo
->
lines
,
stbInfo
->
lineProtocol
==
TSDB_SML_JSON_PROTOCOL
?
0
:
k
,
stbInfo
->
lineProtocol
,
stbInfo
->
tsPrecision
);
code
=
taos_errno
(
res
);
affectedRows
=
taos_affected_rows
(
res
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/kit/taosdemo/src/demoJsonOpt.c
浏览文件 @
37998561
...
...
@@ -854,7 +854,6 @@ int getMetaFromInsertJsonFile(cJSON *root) {
g_Dbs
.
db
[
i
].
superTbls
[
j
].
iface
=
STMT_IFACE
;
}
else
if
(
0
==
strcasecmp
(
stbIface
->
valuestring
,
"sml"
))
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
iface
=
SML_IFACE
;
g_args
.
iface
=
SML_IFACE
;
}
else
{
errorPrint
(
"failed to read json, insert_mode %s not recognized
\n
"
,
...
...
@@ -869,6 +868,36 @@ int getMetaFromInsertJsonFile(cJSON *root) {
goto
PARSE_OVER
;
}
cJSON
*
stbLineProtocol
=
cJSON_GetObjectItem
(
stbInfo
,
"line_protocol"
);
if
(
stbLineProtocol
&&
stbLineProtocol
->
type
==
cJSON_String
&&
stbLineProtocol
->
valuestring
!=
NULL
)
{
if
(
0
==
strcasecmp
(
stbLineProtocol
->
valuestring
,
"line"
))
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
lineProtocol
=
TSDB_SML_LINE_PROTOCOL
;
}
else
if
(
0
==
strcasecmp
(
stbLineProtocol
->
valuestring
,
"telnet"
))
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
lineProtocol
=
TSDB_SML_TELNET_PROTOCOL
;
}
else
if
(
0
==
strcasecmp
(
stbLineProtocol
->
valuestring
,
"json"
))
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
lineProtocol
=
TSDB_SML_JSON_PROTOCOL
;
}
else
{
errorPrint
(
"failed to read json, line_protocol %s not "
"recognized
\n
"
,
stbLineProtocol
->
valuestring
);
goto
PARSE_OVER
;
}
}
else
if
(
!
stbLineProtocol
)
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
lineProtocol
=
TSDB_SML_LINE_PROTOCOL
;
}
else
{
errorPrint
(
"%s"
,
"failed to read json, line_protocol not found
\n
"
);
goto
PARSE_OVER
;
}
cJSON
*
childTbl_limit
=
cJSON_GetObjectItem
(
stbInfo
,
"childtable_limit"
);
if
((
childTbl_limit
)
&&
(
g_Dbs
.
db
[
i
].
drop
!=
true
)
&&
...
...
src/kit/taosdemo/src/demoMain.c
浏览文件 @
37998561
...
...
@@ -17,6 +17,7 @@
int64_t
g_totalChildTables
=
DEFAULT_CHILDTABLES
;
int64_t
g_actualChildTables
=
0
;
FILE
*
g_fpOfInsertResult
=
NULL
;
char
*
g_dupstr
=
NULL
;
SDbs
g_Dbs
;
SQueryMetaInfo
g_queryInfo
;
SArguments
g_args
=
{
...
...
@@ -66,7 +67,7 @@ SArguments g_args = {
};
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
parse_args
(
argc
,
argv
,
&
g_args
))
{
if
(
parse_args
(
argc
,
argv
))
{
exit
(
EXIT_FAILURE
);
}
debugPrint
(
"meta file: %s
\n
"
,
g_args
.
metaFile
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录