Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9115cfaa
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
9115cfaa
编写于
1月 21, 2022
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change test cases
上级
f7c7503a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
119 addition
and
7 deletion
+119
-7
tests/examples/c/parameter-binding.c
tests/examples/c/parameter-binding.c
+119
-7
未找到文件。
tests/examples/c/parameter-binding.c
浏览文件 @
9115cfaa
...
...
@@ -4,9 +4,14 @@
#include <taos.h>
#include <time.h>
bool
isPrint
=
fals
e
;
bool
isPrint
=
tru
e
;
void
one_batch_one_table_1
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
void
one_batch_one_table_2
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
void
one_batch_one_table_3
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
void
one_batch_one_table_4
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
void
one_batch_one_table_5
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
void
execute
(
TAOS
*
conn
,
char
*
sql
);
void
prepare_normal_table
(
TAOS
*
conn
);
...
...
@@ -41,12 +46,20 @@ int main() {
execute
(
conn
,
"create database if not exists test"
);
execute
(
conn
,
"use test"
);
long
totalRows
=
10
000000
;
long
batchRows
=
3
2767
;
long
totalRows
=
10
;
long
batchRows
=
3
;
prepare_super_table
(
conn
,
1
);
// A -> B -> D -> [F -> I]... -> J -> L
one_batch_one_table_1
(
conn
,
totalRows
,
batchRows
);
// one_batch_one_table_1(conn, totalRows, batchRows);
// A -> B -> [D -> [F -> I]... -> J]... -> L
// one_batch_one_table_2(conn, totalRows, batchRows);
// A -> B -> D -> [F... -> I -> J]... -> L
one_batch_one_table_3
(
conn
,
totalRows
,
batchRows
);
// A -> B -> D -> [H -> I -> J]... -> L
// one_batch_one_table_4(conn, totalRows, batchRows);
// A -> B -> [D -> H -> I -> J]... -> L
// one_batch_one_table_5(conn, totalRows, batchRows);
// close
taos_close
(
conn
);
...
...
@@ -67,11 +80,64 @@ void one_batch_one_table_1(TAOS *conn, long totalRows, long batchRows) {
TAOS_STMT
*
stmt
=
A
(
conn
);
B
(
stmt
,
"insert into ? using weather tags(?) (ts, f1) values(?, ?)"
);
D
(
stmt
,
"t1"
,
1
);
for
(
int
i
=
1
;
i
<=
totalRows
;
++
i
)
{
F
(
stmt
,
(
current
+
i
-
1
)
*
1000
);
I
(
stmt
);
if
(
i
%
batchRows
==
0
||
i
==
totalRows
)
{
J
(
stmt
);
}
}
L
(
stmt
);
int64_t
end
=
getCurrentTimeMill
();
printf
(
"totalRows: %ld, batchRows: %ld, time cost: %lld ms
\n
"
,
totalRows
,
batchRows
,
(
end
-
start
));
}
// A -> B -> D -> [F -> I]... -> J -> L
void
one_batch_one_table_2
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
)
{
// given
time_t
current
;
time
(
&
current
);
current
-=
totalRows
;
int64_t
start
=
getCurrentTimeMill
();
// when
TAOS_STMT
*
stmt
=
A
(
conn
);
B
(
stmt
,
"insert into ? using weather tags(?) (ts, f1) values(?, ?)"
);
for
(
int
i
=
1
;
i
<=
totalRows
;
++
i
)
{
if
(
i
%
batchRows
==
1
)
{
D
(
stmt
,
"t1"
,
1
);
}
for
(
int
i
=
0
;
i
<
totalRows
;
++
i
)
{
F
(
stmt
,
(
current
+
i
)
*
1000
);
F
(
stmt
,
(
current
+
i
-
1
)
*
1000
);
I
(
stmt
);
if
(
i
%
batchRows
==
totalRows
-
1
||
i
==
totalRows
-
1
)
{
if
(
i
%
batchRows
==
0
||
i
==
totalRows
)
{
J
(
stmt
);
}
}
L
(
stmt
);
int64_t
end
=
getCurrentTimeMill
();
printf
(
"totalRows: %ld, batchRows: %ld, time cost: %lld ms
\n
"
,
totalRows
,
batchRows
,
(
end
-
start
));
}
void
one_batch_one_table_3
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
)
{
// given
time_t
current
;
time
(
&
current
);
current
-=
totalRows
;
int64_t
start
=
getCurrentTimeMill
();
// when
TAOS_STMT
*
stmt
=
A
(
conn
);
B
(
stmt
,
"insert into ? using weather tags(?) (ts, f1) values(?, ?)"
);
D
(
stmt
,
"t1"
,
1
);
for
(
int
i
=
1
;
i
<=
totalRows
;
++
i
)
{
F
(
stmt
,
(
current
+
i
-
1
)
*
1000
);
if
(
i
%
batchRows
==
0
||
i
==
totalRows
)
{
I
(
stmt
);
J
(
stmt
);
}
}
...
...
@@ -81,6 +147,52 @@ void one_batch_one_table_1(TAOS *conn, long totalRows, long batchRows) {
printf
(
"totalRows: %ld, batchRows: %ld, time cost: %lld ms
\n
"
,
totalRows
,
batchRows
,
(
end
-
start
));
}
void
one_batch_one_table_4
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
)
{
// given
time_t
current
;
time
(
&
current
);
current
-=
totalRows
;
int64_t
start
=
getCurrentTimeMill
();
// when
TAOS_STMT
*
stmt
=
A
(
conn
);
B
(
stmt
,
"insert into ? using weather tags(?) values(?,?)"
);
D
(
stmt
,
"t1"
,
1
);
for
(
int
i
=
1
;
i
<=
totalRows
;
i
+=
batchRows
)
{
int
rows
=
(
i
+
batchRows
)
>
totalRows
?
(
totalRows
+
1
-
i
)
:
batchRows
;
H
(
stmt
,
(
current
+
i
)
*
1000
,
rows
);
I
(
stmt
);
J
(
stmt
);
}
L
(
stmt
);
int64_t
end
=
getCurrentTimeMill
();
printf
(
"totalRows: %ld, batchRows: %ld, time cost: %lld ms
\n
"
,
totalRows
,
batchRows
,
(
end
-
start
));
}
void
one_batch_one_table_5
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
)
{
// given
time_t
current
;
time
(
&
current
);
current
-=
totalRows
;
int64_t
start
=
getCurrentTimeMill
();
// when
TAOS_STMT
*
stmt
=
A
(
conn
);
B
(
stmt
,
"insert into ? using weather tags(?) values(?,?)"
);
for
(
int
i
=
1
;
i
<=
totalRows
;
i
+=
batchRows
)
{
D
(
stmt
,
"t1"
,
1
);
int
rows
=
(
i
+
batchRows
)
>
totalRows
?
(
totalRows
+
1
-
i
)
:
batchRows
;
H
(
stmt
,
(
current
+
i
)
*
1000
,
rows
);
I
(
stmt
);
J
(
stmt
);
}
L
(
stmt
);
int64_t
end
=
getCurrentTimeMill
();
printf
(
"totalRows: %ld, batchRows: %ld, time cost: %lld ms
\n
"
,
totalRows
,
batchRows
,
(
end
-
start
));
}
void
execute
(
TAOS
*
conn
,
char
*
sql
)
{
TAOS_RES
*
psql
=
taos_query
(
conn
,
sql
);
if
(
psql
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录