Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
485cd103
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
485cd103
编写于
1月 22, 2022
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change test cases
上级
9115cfaa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
185 addition
and
6 deletion
+185
-6
tests/examples/c/parameter-binding.c
tests/examples/c/parameter-binding.c
+185
-6
未找到文件。
tests/examples/c/parameter-binding.c
浏览文件 @
485cd103
...
@@ -9,9 +9,14 @@ bool isPrint = true;
...
@@ -9,9 +9,14 @@ bool isPrint = true;
void
one_batch_one_table_1
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
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_2
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
void
one_batch_one_table_3
(
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_4
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
void
one_batch_one_table_5
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
void
one_batch_one_table_5
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
void
one_batch_one_table_6
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
void
one_batch_one_table_7
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
);
void
one_batch_multi_table_1
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
,
int
tables
);
void
one_batch_multi_table_2
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
,
int
tables
);
void
one_batch_multi_table_3
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
,
int
tables
);
void
execute
(
TAOS
*
conn
,
char
*
sql
);
void
execute
(
TAOS
*
conn
,
char
*
sql
);
void
prepare_normal_table
(
TAOS
*
conn
);
void
prepare_normal_table
(
TAOS
*
conn
);
...
@@ -46,8 +51,9 @@ int main() {
...
@@ -46,8 +51,9 @@ int main() {
execute
(
conn
,
"create database if not exists test"
);
execute
(
conn
,
"create database if not exists test"
);
execute
(
conn
,
"use test"
);
execute
(
conn
,
"use test"
);
long
totalRows
=
10
;
long
totalRows
=
1000000
;
long
batchRows
=
3
;
long
batchRows
=
32767
;
int
tables
=
10
;
prepare_super_table
(
conn
,
1
);
prepare_super_table
(
conn
,
1
);
// A -> B -> D -> [F -> I]... -> J -> L
// A -> B -> D -> [F -> I]... -> J -> L
...
@@ -55,11 +61,22 @@ int main() {
...
@@ -55,11 +61,22 @@ int main() {
// A -> B -> [D -> [F -> I]... -> J]... -> L
// A -> B -> [D -> [F -> I]... -> J]... -> L
// one_batch_one_table_2(conn, totalRows, batchRows);
// one_batch_one_table_2(conn, totalRows, batchRows);
// A -> B -> D -> [F... -> I -> J]... -> L
// A -> B -> D -> [F... -> I -> J]... -> L
one_batch_one_table_3
(
conn
,
totalRows
,
batchRows
);
//
one_batch_one_table_3(conn, totalRows, batchRows);
// A -> B -> D -> [H -> I -> J]... -> L
// A -> B -> D -> [H -> I -> J]... -> L
// one_batch_one_table_4(conn, totalRows, batchRows);
// one_batch_one_table_4(conn, totalRows, batchRows);
// A -> B -> [D -> H -> I -> J]... -> L
// one_batch_one_table_5(conn, totalRows, batchRows);
// A -> B -> [D -> H -> I -> J]... -> L
// one_batch_one_table_6(conn, totalRows, batchRows);
// A -> B -> [D -> H -> I -> J]... -> L
// one_batch_one_table_7(conn, totalRows, batchRows);
// A -> B -> [D -> [F -> I]... -> J]... -> L
// one_batch_multi_table_1(conn, totalRows, batchRows, tables);
// A -> B -> [D -> H -> I -> J]... -> L
// A -> B -> [D -> H -> I -> J]... -> L
// one_batch_one_table_5(conn, totalRows, batchRows);
// one_batch_multi_table_2(conn, totalRows, batchRows, tables);
// A -> B -> [D -> G1 -> G2 -> I -> J]... -> L
one_batch_multi_table_3
(
conn
,
totalRows
,
batchRows
,
tables
);
// close
// close
taos_close
(
conn
);
taos_close
(
conn
);
...
@@ -193,6 +210,168 @@ void one_batch_one_table_5(TAOS *conn, long totalRows, long batchRows) {
...
@@ -193,6 +210,168 @@ void one_batch_one_table_5(TAOS *conn, long totalRows, long batchRows) {
printf
(
"totalRows: %ld, batchRows: %ld, time cost: %lld ms
\n
"
,
totalRows
,
batchRows
,
(
end
-
start
));
printf
(
"totalRows: %ld, batchRows: %ld, time cost: %lld ms
\n
"
,
totalRows
,
batchRows
,
(
end
-
start
));
}
}
void
one_batch_one_table_6
(
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
;
G1
(
stmt
,
(
current
+
i
)
*
1000
,
rows
);
G2
(
stmt
,
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_7
(
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
)
{
if
(
i
%
batchRows
==
1
)
{
D
(
stmt
,
"t1"
,
1
);
}
int
rows
=
(
i
+
batchRows
)
>
totalRows
?
(
totalRows
+
1
-
i
)
:
batchRows
;
G1
(
stmt
,
(
current
+
i
)
*
1000
,
rows
);
G2
(
stmt
,
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_multi_table_1
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
,
int
tables
)
{
// given
time_t
current
;
time
(
&
current
);
long
eachTable
=
(
totalRows
-
1
)
/
tables
+
1
;
current
-=
eachTable
;
int64_t
start
=
getCurrentTimeMill
();
// when
TAOS_STMT
*
stmt
=
A
(
conn
);
B
(
stmt
,
"insert into ? using weather tags(?) values(?, ?)"
);
for
(
int
tbIndex
=
0
;
tbIndex
<
tables
;
++
tbIndex
)
{
char
tbname
[
10
];
sprintf
(
tbname
,
"t%d"
,
tbIndex
);
eachTable
=
((
tbIndex
+
1
)
*
eachTable
>
totalRows
)
?
(
totalRows
-
tbIndex
*
eachTable
)
:
eachTable
;
for
(
int
rowIndex
=
1
;
rowIndex
<=
eachTable
;
++
rowIndex
)
{
if
(
rowIndex
%
batchRows
==
1
)
{
D
(
stmt
,
tbname
,
tbIndex
);
if
(
isPrint
)
printf
(
"
\n
tbIndex: %d, table_rows: %ld, rowIndex: %d, batch_rows: %ld
\n
"
,
tbIndex
,
eachTable
,
rowIndex
,
batchRows
);
}
F
(
stmt
,
(
current
+
rowIndex
-
1
)
*
1000
);
I
(
stmt
);
if
(
rowIndex
%
batchRows
==
0
||
rowIndex
==
eachTable
)
{
J
(
stmt
);
}
}
}
L
(
stmt
);
int64_t
end
=
getCurrentTimeMill
();
printf
(
"totalRows: %ld, batchRows: %ld, table: %d, eachTableRows: %ld, time cost: %lld ms
\n
"
,
totalRows
,
batchRows
,
tables
,
eachTable
,
(
end
-
start
));
}
void
one_batch_multi_table_2
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
,
int
tables
)
{
// given
time_t
current
;
time
(
&
current
);
long
eachTable
=
(
totalRows
-
1
)
/
tables
+
1
;
current
-=
eachTable
;
int64_t
start
=
getCurrentTimeMill
();
// when
TAOS_STMT
*
stmt
=
A
(
conn
);
B
(
stmt
,
"insert into ? using weather tags(?) values(?,?)"
);
for
(
int
tbIndex
=
0
;
tbIndex
<
tables
;
++
tbIndex
)
{
char
tbname
[
10
];
sprintf
(
tbname
,
"t%d"
,
tbIndex
);
eachTable
=
((
tbIndex
+
1
)
*
eachTable
>
totalRows
)
?
(
totalRows
-
tbIndex
*
eachTable
)
:
eachTable
;
for
(
int
rowIndex
=
1
;
rowIndex
<=
eachTable
;
rowIndex
+=
batchRows
)
{
int
rows
=
(
rowIndex
+
batchRows
)
>
eachTable
?
(
eachTable
+
1
-
rowIndex
)
:
batchRows
;
if
(
rowIndex
%
batchRows
==
1
)
{
D
(
stmt
,
tbname
,
tbIndex
);
if
(
isPrint
)
printf
(
"
\n
tbIndex: %d, table_rows: %ld, rowIndex: %d, batch_rows: %d
\n
"
,
tbIndex
,
eachTable
,
rowIndex
,
rows
);
}
H
(
stmt
,
(
current
+
rowIndex
)
*
1000
,
rows
);
I
(
stmt
);
J
(
stmt
);
}
}
L
(
stmt
);
int64_t
end
=
getCurrentTimeMill
();
printf
(
"totalRows: %ld, batchRows: %ld, table: %d, eachTableRows: %ld, time cost: %lld ms
\n
"
,
totalRows
,
batchRows
,
tables
,
eachTable
,
(
end
-
start
));
}
void
one_batch_multi_table_3
(
TAOS
*
conn
,
long
totalRows
,
long
batchRows
,
int
tables
)
{
// given
time_t
current
;
time
(
&
current
);
long
eachTable
=
(
totalRows
-
1
)
/
tables
+
1
;
current
-=
eachTable
;
int64_t
start
=
getCurrentTimeMill
();
// when
TAOS_STMT
*
stmt
=
A
(
conn
);
B
(
stmt
,
"insert into ? using weather tags(?) values(?, ?)"
);
for
(
int
tbIndex
=
0
;
tbIndex
<
tables
;
++
tbIndex
)
{
char
tbname
[
10
];
sprintf
(
tbname
,
"t%d"
,
tbIndex
);
eachTable
=
((
tbIndex
+
1
)
*
eachTable
>
totalRows
)
?
(
totalRows
-
tbIndex
*
eachTable
)
:
eachTable
;
for
(
int
rowIndex
=
1
;
rowIndex
<=
eachTable
;
rowIndex
+=
batchRows
)
{
int
rows
=
(
rowIndex
+
batchRows
)
>
eachTable
?
(
eachTable
+
1
-
rowIndex
)
:
batchRows
;
if
(
rowIndex
%
batchRows
==
1
)
{
D
(
stmt
,
tbname
,
tbIndex
);
if
(
isPrint
)
printf
(
"
\n
tbIndex: %d, table_rows: %ld, rowIndex: %d, batch_rows: %d
\n
"
,
tbIndex
,
eachTable
,
rowIndex
,
rows
);
}
G1
(
stmt
,
(
current
+
rowIndex
)
*
1000
,
rows
);
G2
(
stmt
,
rows
);
I
(
stmt
);
J
(
stmt
);
}
}
L
(
stmt
);
int64_t
end
=
getCurrentTimeMill
();
printf
(
"totalRows: %ld, batchRows: %ld, table: %d, eachTableRows: %ld, time cost: %lld ms
\n
"
,
totalRows
,
batchRows
,
tables
,
eachTable
,
(
end
-
start
));
}
void
execute
(
TAOS
*
conn
,
char
*
sql
)
{
void
execute
(
TAOS
*
conn
,
char
*
sql
)
{
TAOS_RES
*
psql
=
taos_query
(
conn
,
sql
);
TAOS_RES
*
psql
=
taos_query
(
conn
,
sql
);
if
(
psql
==
NULL
)
{
if
(
psql
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录