Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5acc7739
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看板
提交
5acc7739
编写于
4月 20, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stmt
上级
da437985
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
114 addition
and
10 deletion
+114
-10
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+114
-10
未找到文件。
tests/script/api/batchprepare.c
浏览文件 @
5acc7739
...
...
@@ -34,8 +34,10 @@ typedef struct {
int32_t
gVarCharSize
=
10
;
int32_t
gVarCharLen
=
5
;
int
insertMBSETest
(
TAOS_STMT
*
stmt
);
int
insertMBMETest
(
TAOS_STMT
*
stmt
);
int
insertMBSETest1
(
TAOS_STMT
*
stmt
);
int
insertMBSETest2
(
TAOS_STMT
*
stmt
);
int
insertMBMETest1
(
TAOS_STMT
*
stmt
);
int
insertMBMETest2
(
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
};
...
...
@@ -59,11 +61,17 @@ typedef struct {
}
CaseCfg
;
CaseCfg
gCase
[]
=
{
// {"insert:MBSE", tListLen(shortColList), shortColList, false, true, insertMBSETest, 1, 10, 10, 0, 0, 10},
// {"insert:MBSE", tListLen(shortColList), shortColList, false, true, insertMBSETest, 10, 100, 10, 0, 0, 10},
// {"insert:MBSE", tListLen(longColList), longColList, false, true, insertMBSETest, 10, 10, 2, 0, 0, 1},
// {"insert:MBSE", tListLen(longColList), longColList, false, false, insertMBSETest, 10, 10, 2, 6, 0, 1},
{
"insert:MBME"
,
tListLen
(
longColList
),
longColList
,
false
,
false
,
insertMBMETest
,
10
,
10
,
2
,
6
,
0
,
1
},
#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
},
};
CaseCfg
*
gCurCase
=
NULL
;
...
...
@@ -113,7 +121,7 @@ bool colExists(TAOS_BIND_v2* pBind, int32_t dataType) {
}
void
generateInsertSQL
(
BindData
*
data
)
{
int32_t
len
=
sprintf
(
data
->
sql
,
"insert into %s "
,
(
gCurCase
->
tblNum
>
1
?
"? "
:
"
m
0 "
));
int32_t
len
=
sprintf
(
data
->
sql
,
"insert into %s "
,
(
gCurCase
->
tblNum
>
1
?
"? "
:
"
t
0 "
));
if
(
!
gCurCase
->
fullCol
)
{
len
+=
sprintf
(
data
->
sql
+
len
,
"("
);
for
(
int
c
=
0
;
c
<
gCurCase
->
bindColNum
;
++
c
)
{
...
...
@@ -391,7 +399,8 @@ void destroyData(BindData *data) {
}
int
insertMBSETest
(
TAOS_STMT
*
stmt
)
{
/* prepare [settbname [bind add]] exec */
int
insertMBSETest1
(
TAOS_STMT
*
stmt
)
{
BindData
data
=
{
0
};
prepareData
(
&
data
);
...
...
@@ -437,7 +446,55 @@ int insertMBSETest(TAOS_STMT *stmt) {
}
int
insertMBMETest
(
TAOS_STMT
*
stmt
)
{
/* prepare [settbname bind add] exec */
int
insertMBSETest2
(
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
;
}
/* prepare [settbname [bind add] exec] */
int
insertMBMETest1
(
TAOS_STMT
*
stmt
)
{
BindData
data
=
{
0
};
prepareData
(
&
data
);
...
...
@@ -483,6 +540,53 @@ int insertMBMETest(TAOS_STMT *stmt) {
return
0
;
}
/* prepare [settbname [bind add exec]] */
int
insertMBMETest2
(
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
(
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
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录