Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
608e6782
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
608e6782
编写于
5月 20, 2021
作者:
sangshuduo
提交者:
GitHub
5月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-4272]<fix>: taosdemo specify columns. (#6173)
Co-authored-by:
N
Shuduo Sang
<
sdsang@taosdata.com
>
上级
f0b77fa3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
35 deletion
+35
-35
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+35
-35
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
608e6782
...
...
@@ -189,6 +189,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
;
...
...
@@ -526,7 +528,6 @@ static int taosRandom()
#endif // ifdef Windows
static
void
prompt
();
static
void
prompt2
();
static
int
createDatabasesAndStables
();
static
void
createChildTables
();
static
int
queryDbExec
(
TAOS
*
taos
,
char
*
command
,
QUERY_TYPE
type
,
bool
quiet
);
...
...
@@ -679,8 +680,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
,
...
...
@@ -724,7 +726,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
)
{
...
...
@@ -851,20 +852,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
])))
{
printHelp
();
errorPrint
(
"%s"
,
"
\n\t
-l need a number following!
\n
"
);
exit
(
EXIT_FAILURE
);
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
...
...
@@ -881,12 +893,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"
)
...
...
@@ -899,16 +911,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
)
||
...
...
@@ -3449,7 +3460,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
);
prompt
2
();
prompt
();
g_args
.
interlace_rows
=
g_args
.
num_of_RPR
;
}
}
else
if
(
!
interlaceRows
)
{
...
...
@@ -5759,19 +5770,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
,
...
...
@@ -6093,19 +6098,11 @@ static void *readMetric(void *sarg) {
static
void
prompt
()
{
if
(
!
g_args
.
answer_yes
)
{
printf
(
"
Press enter key to continue
\n\n
"
);
printf
(
"
Press enter key to continue or Ctrl-C to stop
\n\n
"
);
(
void
)
getchar
();
}
}
static
void
prompt2
()
{
if
(
!
g_args
.
answer_yes
)
{
printf
(
" press Enter key to continue or Ctrl-C to stop."
);
(
void
)
getchar
();
}
}
static
int
insertTestProcess
()
{
setupForAnsiEscape
();
...
...
@@ -7325,6 +7322,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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录