Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
824eb0f3
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看板
未验证
提交
824eb0f3
编写于
5月 20, 2021
作者:
sangshuduo
提交者:
GitHub
5月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-4272]<fix>: taosdemo specify columns. (#6174)
Co-authored-by:
N
Shuduo Sang
<
sdsang@taosdata.com
>
上级
c69604fd
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
42 addition
and
28 deletion
+42
-28
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+42
-28
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
824eb0f3
...
...
@@ -198,6 +198,8 @@ typedef struct {
}
SColDes
;
/* Used by main to communicate with parse_opt. */
static
char
*
g_dupstr
=
NULL
;
typedef
struct
SArguments_S
{
char
*
metaFile
;
uint32_t
test_mode
;
...
...
@@ -537,6 +539,7 @@ static int taosRandom()
#endif // ifdef Windows
static
void
prompt
();
static
int
createDatabasesAndStables
();
static
void
createChildTables
();
static
int
queryDbExec
(
TAOS
*
taos
,
char
*
command
,
QUERY_TYPE
type
,
bool
quiet
);
...
...
@@ -692,8 +695,9 @@ static void printHelp() {
"The data_type of columns, default: INT,INT,INT,INT."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-w"
,
indent
,
"The length of data_type 'BINARY' or 'NCHAR'. Default is 16"
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-l"
,
indent
,
"The number of columns per record. Default is 4."
);
printf
(
"%s%s%s%s%d
\n
"
,
indent
,
"-l"
,
indent
,
"The number of columns per record. Default is 4. Max values is "
,
MAX_NUM_DATATYPE
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-T"
,
indent
,
"The number of threads. Default is 10."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-i"
,
indent
,
...
...
@@ -737,7 +741,6 @@ static bool isStringNumber(char *input)
}
static
void
parse_args
(
int
argc
,
char
*
argv
[],
SArguments
*
arguments
)
{
char
**
sptr
;
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
strcmp
(
argv
[
i
],
"-f"
)
==
0
)
{
...
...
@@ -881,20 +884,31 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
}
arguments
->
database
=
argv
[
++
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"-l"
)
==
0
)
{
if
(
(
argc
==
i
+
1
)
||
(
!
isStringNumber
(
argv
[
i
+
1
])
))
{
if
(
argc
==
i
+
1
)
{
if
(
!
isStringNumber
(
argv
[
i
+
1
]
))
{
printHelp
();
errorPrint
(
"%s"
,
"
\n\t
-l need a number following!
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
arguments
->
num_of_CPR
=
atoi
(
argv
[
++
i
]);
if
(
arguments
->
num_of_CPR
>
MAX_NUM_DATATYPE
)
{
printf
(
"WARNING: max acceptible columns count is %d
\n
"
,
MAX_NUM_DATATYPE
);
prompt
();
arguments
->
num_of_CPR
=
MAX_NUM_DATATYPE
;
}
for
(
int
col
=
arguments
->
num_of_CPR
;
col
<
MAX_NUM_DATATYPE
;
col
++
)
{
arguments
->
datatype
[
col
]
=
NULL
;
}
}
else
if
(
strcmp
(
argv
[
i
],
"-b"
)
==
0
)
{
if
(
argc
==
i
+
1
)
{
printHelp
();
errorPrint
(
"%s"
,
"
\n\t
-b need valid string following!
\n
"
);
exit
(
EXIT_FAILURE
);
}
sptr
=
arguments
->
datatype
;
++
i
;
if
(
strstr
(
argv
[
i
],
","
)
==
NULL
)
{
// only one col
...
...
@@ -911,12 +925,12 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
errorPrint
(
"%s"
,
"-b: Invalid data_type!
\n
"
);
exit
(
EXIT_FAILURE
);
}
sptr
[
0
]
=
argv
[
i
];
arguments
->
datatype
[
0
]
=
argv
[
i
];
}
else
{
// more than one col
int
index
=
0
;
char
*
dupstr
=
strdup
(
argv
[
i
]);
char
*
running
=
dupstr
;
g_
dupstr
=
strdup
(
argv
[
i
]);
char
*
running
=
g_
dupstr
;
char
*
token
=
strsep
(
&
running
,
","
);
while
(
token
!=
NULL
)
{
if
(
strcasecmp
(
token
,
"INT"
)
...
...
@@ -929,16 +943,15 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
&&
strcasecmp
(
token
,
"BINARY"
)
&&
strcasecmp
(
token
,
"NCHAR"
))
{
printHelp
();
free
(
dupstr
);
free
(
g_
dupstr
);
errorPrint
(
"%s"
,
"-b: Invalid data_type!
\n
"
);
exit
(
EXIT_FAILURE
);
}
sptr
[
index
++
]
=
token
;
arguments
->
datatype
[
index
++
]
=
token
;
token
=
strsep
(
&
running
,
","
);
if
(
index
>=
MAX_NUM_DATATYPE
)
break
;
}
free
(
dupstr
);
sptr
[
index
]
=
NULL
;
arguments
->
datatype
[
index
]
=
NULL
;
}
}
else
if
(
strcmp
(
argv
[
i
],
"-w"
)
==
0
)
{
if
((
argc
==
i
+
1
)
||
...
...
@@ -3464,10 +3477,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
g_args
.
interlace_rows
,
g_args
.
num_of_RPR
);
printf
(
" interlace rows value will be set to num_of_records_per_req %"
PRIu64
"
\n\n
"
,
g_args
.
num_of_RPR
);
if
(
!
g_args
.
answer_yes
)
{
printf
(
" press Enter key to continue or Ctrl-C to stop."
);
(
void
)
getchar
();
}
prompt
();
g_args
.
interlace_rows
=
g_args
.
num_of_RPR
;
}
}
else
if
(
!
interlaceRows
)
{
...
...
@@ -5812,19 +5822,13 @@ static void startMultiThreadInsertData(int threads, char* db_name,
&&
((
superTblInfo
->
childTblOffset
+
superTblInfo
->
childTblLimit
)
>
superTblInfo
->
childTblCount
))
{
printf
(
"WARNING: specified offset + limit > child table count!
\n
"
);
if
(
!
g_args
.
answer_yes
)
{
printf
(
" Press enter key to continue or Ctrl-C to stop
\n\n
"
);
(
void
)
getchar
();
}
prompt
();
}
if
((
superTblInfo
->
childTblExists
!=
TBL_NO_EXISTS
)
&&
(
0
==
superTblInfo
->
childTblLimit
))
{
printf
(
"WARNING: specified limit = 0, which cannot find table name to insert or query!
\n
"
);
if
(
!
g_args
.
answer_yes
)
{
printf
(
" Press enter key to continue or Ctrl-C to stop
\n\n
"
);
(
void
)
getchar
();
}
prompt
();
}
superTblInfo
->
childTblName
=
(
char
*
)
calloc
(
1
,
...
...
@@ -6172,6 +6176,13 @@ static void *readMetric(void *sarg) {
return
NULL
;
}
static
void
prompt
()
{
if
(
!
g_args
.
answer_yes
)
{
printf
(
" Press enter key to continue or Ctrl-C to stop
\n\n
"
);
(
void
)
getchar
();
}
}
static
int
insertTestProcess
()
{
...
...
@@ -7397,6 +7408,9 @@ int main(int argc, char *argv[]) {
}
else
{
testCmdLine
();
}
if
(
g_dupstr
)
free
(
g_dupstr
);
}
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录