Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9c178b01
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看板
提交
9c178b01
编写于
4月 20, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stmt
上级
1c5e8604
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
130 addition
and
12 deletion
+130
-12
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+130
-12
未找到文件。
tests/script/api/batchprepare.c
浏览文件 @
9c178b01
...
...
@@ -38,6 +38,8 @@ int insertMBSETest1(TAOS_STMT *stmt);
int
insertMBSETest2
(
TAOS_STMT
*
stmt
);
int
insertMBMETest1
(
TAOS_STMT
*
stmt
);
int
insertMBMETest2
(
TAOS_STMT
*
stmt
);
int
insertMBMETest3
(
TAOS_STMT
*
stmt
);
int
insertMBMETest4
(
TAOS_STMT
*
stmt
);
int32_t
shortColList
[]
=
{
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_DATA_TYPE_INT
};
int32_t
longColList
[]
=
{
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_DATA_TYPE_BOOL
,
TSDB_DATA_TYPE_TINYINT
,
TSDB_DATA_TYPE_UTINYINT
,
TSDB_DATA_TYPE_SMALLINT
,
TSDB_DATA_TYPE_USMALLINT
,
TSDB_DATA_TYPE_INT
,
TSDB_DATA_TYPE_UINT
,
TSDB_DATA_TYPE_BIGINT
,
TSDB_DATA_TYPE_UBIGINT
,
TSDB_DATA_TYPE_FLOAT
,
TSDB_DATA_TYPE_DOUBLE
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DATA_TYPE_NCHAR
};
...
...
@@ -61,16 +63,26 @@ typedef struct {
}
CaseCfg
;
CaseCfg
gCase
[]
=
{
#if 0
{"insert:MBSE1", tListLen(shortColList), shortColList, false, true, insertMBSETest1, 1, 10, 10, 0, 0, 10},
{"insert:MBSE1", tListLen(shortColList), shortColList, false, true, insertMBSETest1, 10, 100, 10, 0, 0, 10},
{"insert:MBSE1", tListLen(longColList), longColList, false, true, insertMBSETest1, 10, 10, 2, 0, 0, 1},
{"insert:MBSE1", tListLen(longColList), longColList, false, false, insertMBSETest1, 10, 10, 2, 6, 0, 1},
#endif
// {"insert:MBSE2", tListLen(longColList), longColList, false, true, insertMBSETest2, 10, 10, 2, 0, 0, 1},
// {"insert:MBSE2", tListLen(longColList), longColList, false, false, insertMBSETest2, 10, 10, 2, 6, 0, 1},
// {"insert:MBME1", tListLen(longColList), longColList, false, false, insertMBMETest1, 10, 10, 2, 6, 0, 1},
{
"insert:MBME2"
,
tListLen
(
longColList
),
longColList
,
false
,
false
,
insertMBMETest2
,
10
,
10
,
2
,
6
,
0
,
1
},
// {"insert:MBSE1-FULL", tListLen(shortColList), shortColList, false, true, insertMBSETest1, 1, 10, 10, 0, 0, 10},
// {"insert:MBSE1-FULL", tListLen(shortColList), shortColList, false, true, insertMBSETest1, 10, 100, 10, 0, 0, 10},
// {"insert:MBSE1-FULL", tListLen(longColList), longColList, false, true, insertMBSETest1, 10, 10, 2, 0, 0, 1},
// {"insert:MBSE1-C012", tListLen(longColList), longColList, false, false, insertMBSETest1, 10, 10, 2, 12, 0, 1},
// {"insert:MBSE1-C002", tListLen(longColList), longColList, false, false, insertMBSETest1, 10, 10, 2, 2, 0, 1},
// {"insert:MBSE2-FULL", tListLen(longColList), longColList, false, true, insertMBSETest2, 10, 10, 2, 0, 0, 1},
// {"insert:MBSE2-C012", tListLen(longColList), longColList, false, false, insertMBSETest2, 10, 10, 2, 12, 0, 1},
// {"insert:MBSE2-C002", tListLen(longColList), longColList, false, false, insertMBSETest2, 10, 10, 2, 2, 0, 1},
// {"insert:MBME1-FULL", tListLen(longColList), longColList, false, true, insertMBMETest1, 10, 10, 2, 0, 0, 1},
// {"insert:MBME1-C012", tListLen(longColList), longColList, false, false, insertMBMETest1, 10, 10, 2, 12, 0, 1},
// {"insert:MBME1-C002", tListLen(longColList), longColList, false, false, insertMBMETest1, 10, 10, 2, 2, 0, 1},
// {"insert:MBME2-FULL", tListLen(longColList), longColList, false, true, insertMBMETest2, 10, 10, 2, 0, 0, 1},
// {"insert:MBME2-C012", tListLen(longColList), longColList, false, false, insertMBMETest2, 10, 10, 2, 12, 0, 1},
// {"insert:MBME2-C002", tListLen(longColList), longColList, false, false, insertMBMETest2, 10, 10, 2, 2, 0, 1},
// {"insert:MBME3-FULL", tListLen(longColList), longColList, false, true, insertMBMETest3, 10, 10, 2, 0, 0, 1},
// {"insert:MBME3-C012", tListLen(longColList), longColList, false, false, insertMBMETest3, 10, 10, 2, 12, 0, 1},
// {"insert:MBME3-C002", tListLen(longColList), longColList, false, false, insertMBMETest3, 10, 10, 2, 2, 0, 1},
// {"insert:MBME4-FULL", tListLen(longColList), longColList, false, true, insertMBMETest4, 10, 10, 2, 0, 0, 1},
// {"insert:MBME4-C012", tListLen(longColList), longColList, false, false, insertMBMETest4, 10, 10, 2, 12, 0, 1},
{
"insert:MBME4-C002"
,
tListLen
(
longColList
),
longColList
,
false
,
false
,
insertMBMETest4
,
10
,
10
,
2
,
2
,
0
,
1
},
};
...
...
@@ -587,6 +599,111 @@ int insertMBMETest2(TAOS_STMT *stmt) {
return
0
;
}
/* prepare [settbname [settbname bind add exec]] */
int
insertMBMETest3
(
TAOS_STMT
*
stmt
)
{
BindData
data
=
{
0
};
prepareData
(
&
data
);
printf
(
"SQL: %s
\n
"
,
data
.
sql
);
int
code
=
taos_stmt_prepare
(
stmt
,
data
.
sql
,
0
);
if
(
code
!=
0
){
printf
(
"failed to execute taos_stmt_prepare. error:%s
\n
"
,
taos_stmt_errstr
(
stmt
));
exit
(
1
);
}
int32_t
bindTimes
=
gCurCase
->
rowNum
/
gCurCase
->
bindRowNum
;
for
(
int32_t
t
=
0
;
t
<
gCurCase
->
tblNum
;
++
t
)
{
if
(
gCurCase
->
tblNum
>
1
)
{
char
buf
[
32
];
sprintf
(
buf
,
"t%d"
,
t
);
code
=
taos_stmt_set_tbname
(
stmt
,
buf
);
if
(
code
!=
0
){
printf
(
"taos_stmt_set_tbname error:%s
\n
"
,
taos_stmt_errstr
(
stmt
));
exit
(
1
);
}
}
for
(
int32_t
b
=
0
;
b
<
bindTimes
;
++
b
)
{
if
(
gCurCase
->
tblNum
>
1
)
{
char
buf
[
32
];
sprintf
(
buf
,
"t%d"
,
t
);
code
=
taos_stmt_set_tbname
(
stmt
,
buf
);
if
(
code
!=
0
){
printf
(
"taos_stmt_set_tbname error:%s
\n
"
,
taos_stmt_errstr
(
stmt
));
exit
(
1
);
}
}
if
(
taos_stmt_bind_param_batch
(
stmt
,
data
.
pBind
+
t
*
bindTimes
*
gCurCase
->
bindColNum
+
b
*
gCurCase
->
bindColNum
))
{
printf
(
"taos_stmt_bind_param error:%s
\n
"
,
taos_stmt_errstr
(
stmt
));
exit
(
1
);
}
if
(
taos_stmt_add_batch
(
stmt
))
{
printf
(
"taos_stmt_add_batch error:%s
\n
"
,
taos_stmt_errstr
(
stmt
));
exit
(
1
);
}
if
(
taos_stmt_execute
(
stmt
)
!=
0
)
{
printf
(
"taos_stmt_execute error:%s
\n
"
,
taos_stmt_errstr
(
stmt
));
exit
(
1
);
}
}
}
return
0
;
}
/* prepare [settbname bind add exec] */
int
insertMBMETest4
(
TAOS_STMT
*
stmt
)
{
BindData
data
=
{
0
};
prepareData
(
&
data
);
printf
(
"SQL: %s
\n
"
,
data
.
sql
);
int
code
=
taos_stmt_prepare
(
stmt
,
data
.
sql
,
0
);
if
(
code
!=
0
){
printf
(
"failed to execute taos_stmt_prepare. error:%s
\n
"
,
taos_stmt_errstr
(
stmt
));
exit
(
1
);
}
int32_t
bindTimes
=
gCurCase
->
rowNum
/
gCurCase
->
bindRowNum
;
for
(
int32_t
b
=
0
;
b
<
bindTimes
;
++
b
)
{
for
(
int32_t
t
=
0
;
t
<
gCurCase
->
tblNum
;
++
t
)
{
if
(
gCurCase
->
tblNum
>
1
)
{
char
buf
[
32
];
sprintf
(
buf
,
"t%d"
,
t
);
code
=
taos_stmt_set_tbname
(
stmt
,
buf
);
if
(
code
!=
0
){
printf
(
"taos_stmt_set_tbname error:%s
\n
"
,
taos_stmt_errstr
(
stmt
));
exit
(
1
);
}
}
if
(
taos_stmt_bind_param_batch
(
stmt
,
data
.
pBind
+
t
*
bindTimes
*
gCurCase
->
bindColNum
+
b
*
gCurCase
->
bindColNum
))
{
printf
(
"taos_stmt_bind_param error:%s
\n
"
,
taos_stmt_errstr
(
stmt
));
exit
(
1
);
}
if
(
taos_stmt_add_batch
(
stmt
))
{
printf
(
"taos_stmt_add_batch error:%s
\n
"
,
taos_stmt_errstr
(
stmt
));
exit
(
1
);
}
if
(
taos_stmt_execute
(
stmt
)
!=
0
)
{
printf
(
"taos_stmt_execute error:%s
\n
"
,
taos_stmt_errstr
(
stmt
));
exit
(
1
);
}
}
}
return
0
;
}
int
stmt_scol_func1
(
TAOS_STMT
*
stmt
)
{
struct
{
...
...
@@ -5201,7 +5318,7 @@ void* runcase(TAOS *taos) {
for
(
int32_t
i
=
0
;
i
<
sizeof
(
gCase
)
/
sizeof
(
gCase
[
0
]);
++
i
)
{
gCurCase
=
&
gCase
[
i
];
printf
(
"
Case %d - %s Begin
\n
"
,
i
,
gCurCase
->
caseDesc
);
printf
(
"
* Case %d - %s Begin *
\n
"
,
i
,
gCurCase
->
caseDesc
);
if
(
gCurCase
->
fullCol
)
{
gCurCase
->
bindColNum
=
gCurCase
->
colNum
;
...
...
@@ -5220,7 +5337,8 @@ void* runcase(TAOS *taos) {
prepareCheckResult
(
taos
);
}
printf
(
"Case %d End
\n
"
,
i
);
printf
(
"* Case %d - %s End *
\n
"
,
i
,
gCurCase
->
caseDesc
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录