Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
4425db18
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看板
提交
4425db18
编写于
8月 06, 2020
作者:
L
Liu Tao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-1063] support more cols
上级
8e7fa7d8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
9 deletion
+13
-9
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+13
-9
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
4425db18
...
...
@@ -42,8 +42,8 @@ extern char configDir[];
#define BUFFER_SIZE 65536
#define MAX_DB_NAME_SIZE 64
#define MAX_TB_NAME_SIZE 64
#define MAX_DATA_SIZE 1
024
#define MAX_NUM_DATATYPE
3
0
#define MAX_DATA_SIZE 1
6000
#define MAX_NUM_DATATYPE
1
0
#define OPT_ABORT 1
/* –abort */
#define STRING_LEN 512
#define MAX_PREPARED_RAND 1000000
...
...
@@ -155,7 +155,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
strcasecmp
(
arg
,
"TINYINT"
)
!=
0
&&
strcasecmp
(
arg
,
"BOOL"
)
!=
0
&&
strcasecmp
(
arg
,
"SMALLINT"
)
!=
0
&&
strcasecmp
(
arg
,
"BIGINT"
)
!=
0
&&
strcasecmp
(
arg
,
"DOUBLE"
)
!=
0
&&
strcasecmp
(
arg
,
"BINARY"
))
{
strcasecmp
(
arg
,
"BINARY"
)
&&
strcasecmp
(
arg
,
"NCHAR"
)
)
{
argp_error
(
state
,
"Invalid data_type!"
);
}
sptr
[
0
]
=
arg
;
...
...
@@ -171,7 +171,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
strcasecmp
(
token
,
"BOOL"
)
!=
0
&&
strcasecmp
(
token
,
"SMALLINT"
)
!=
0
&&
strcasecmp
(
token
,
"BIGINT"
)
!=
0
&&
strcasecmp
(
token
,
"DOUBLE"
)
!=
0
&&
strcasecmp
(
token
,
"BINARY"
))
{
strcasecmp
(
token
,
"DOUBLE"
)
!=
0
&&
strcasecmp
(
token
,
"BINARY"
)
&&
strcasecmp
(
arg
,
"NCHAR"
)
)
{
argp_error
(
state
,
"Invalid data_type!"
);
}
sptr
[
index
++
]
=
token
;
...
...
@@ -412,7 +412,7 @@ int main(int argc, char *argv[]) {
memset
(
dataString
,
0
,
STRING_LEN
);
int
len
=
0
;
if
(
strcasecmp
(
data_type
[
0
],
"BINARY"
)
==
0
||
strcasecmp
(
data_type
[
0
],
"BOOL"
)
==
0
)
{
if
(
strcasecmp
(
data_type
[
0
],
"BINARY"
)
==
0
||
strcasecmp
(
data_type
[
0
],
"BOOL"
)
==
0
||
strcasecmp
(
data_type
[
0
],
"NCHAR"
)
==
0
)
{
do_aggreFunc
=
false
;
}
for
(;
count_data_type
<=
MAX_NUM_DATATYPE
;
count_data_type
++
)
{
...
...
@@ -438,7 +438,7 @@ int main(int argc, char *argv[]) {
printf
(
"# Use metric: %s
\n
"
,
use_metric
?
"true"
:
"false"
);
printf
(
"# Datatype of Columns: %s
\n
"
,
dataString
);
printf
(
"# Binary Length(If applicable): %d
\n
"
,
(
strcasestr
(
dataString
,
"BINARY"
)
!=
NULL
)
?
len_of_binary
:
-
1
);
(
strcasestr
(
dataString
,
"BINARY"
)
!=
NULL
||
strcasestr
(
dataString
,
"NCHAR"
)
!=
NULL
)
?
len_of_binary
:
-
1
);
printf
(
"# Number of Columns per record: %d
\n
"
,
ncols_per_record
);
printf
(
"# Number of Threads: %d
\n
"
,
threads
);
printf
(
"# Number of Tables: %d
\n
"
,
ntables
);
...
...
@@ -466,7 +466,7 @@ int main(int argc, char *argv[]) {
fprintf
(
fp
,
"# Use metric: %s
\n
"
,
use_metric
?
"true"
:
"false"
);
fprintf
(
fp
,
"# Datatype of Columns: %s
\n
"
,
dataString
);
fprintf
(
fp
,
"# Binary Length(If applicable): %d
\n
"
,
(
strcasestr
(
dataString
,
"BINARY"
)
!=
NULL
)
?
len_of_binary
:
-
1
);
(
strcasestr
(
dataString
,
"BINARY"
)
!=
NULL
||
strcasestr
(
dataString
,
"NCHAR"
)
!=
NULL
)
?
len_of_binary
:
-
1
);
fprintf
(
fp
,
"# Number of Columns per record: %d
\n
"
,
ncols_per_record
);
fprintf
(
fp
,
"# Number of Threads: %d
\n
"
,
threads
);
fprintf
(
fp
,
"# Number of Tables: %d
\n
"
,
ntables
);
...
...
@@ -506,7 +506,7 @@ int main(int argc, char *argv[]) {
len
=
0
;
for
(;
colIndex
<
ncols_per_record
-
1
;
colIndex
++
)
{
if
(
strcasecmp
(
data_type
[
colIndex
%
count_data_type
],
"BINARY"
)
!=
0
)
{
if
(
strcasecmp
(
data_type
[
colIndex
%
count_data_type
],
"BINARY"
)
!=
0
&&
strcasecmp
(
data_type
[
colIndex
%
count_data_type
],
"NCHAR"
)
!=
0
)
{
len
+=
snprintf
(
cols
+
len
,
STRING_LEN
-
len
,
",f%d %s"
,
colIndex
+
1
,
data_type
[
colIndex
%
count_data_type
]);
}
else
{
len
+=
snprintf
(
cols
+
len
,
STRING_LEN
-
len
,
",f%d %s(%d)"
,
colIndex
+
1
,
data_type
[
colIndex
%
count_data_type
],
len_of_binary
);
...
...
@@ -522,7 +522,7 @@ int main(int argc, char *argv[]) {
if
(
use_metric
)
{
/* Create metric table */
printf
(
"Creating meters super table...
\n
"
);
snprintf
(
command
,
BUFFER_SIZE
,
"create table if not exists %s.meters (ts timestamp%s
tags (areaid int, loc binary(10)
)"
,
db_name
,
cols
);
snprintf
(
command
,
BUFFER_SIZE
,
"create table if not exists %s.meters (ts timestamp%s
) tags (areaid int, loc binary(10
)"
,
db_name
,
cols
);
queryDB
(
taos
,
command
);
printf
(
"meters created!
\n
"
);
}
...
...
@@ -1272,6 +1272,10 @@ int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t times
char
s
[
len_of_binary
];
rand_string
(
s
,
len_of_binary
);
pstr
+=
sprintf
(
pstr
,
",
\"
%s
\"
"
,
s
);
}
else
if
(
strcasecmp
(
data_type
[
i
%
c
],
"nchar"
)
==
0
)
{
char
s
[
len_of_binary
];
rand_string
(
s
,
len_of_binary
);
pstr
+=
sprintf
(
pstr
,
",
\"
%s
\"
"
,
s
);
}
if
(
pstr
-
res
>
MAX_DATA_SIZE
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录