Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e78e1263
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看板
提交
e78e1263
编写于
10月 18, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more test case for taos_stmt_affected_rows
上级
98a04b89
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
3 deletion
+33
-3
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+5
-1
tests/script/api/stmt.c
tests/script/api/stmt.c
+22
-1
tests/script/api/stmtTest.c
tests/script/api/stmtTest.c
+6
-1
未找到文件。
tests/script/api/batchprepare.c
浏览文件 @
e78e1263
...
...
@@ -119,7 +119,11 @@ int stmt_scol_func1(TAOS_STMT *stmt) {
printf
(
"failed to execute insert statement.
\n
"
);
exit
(
1
);
}
int
affectedRows
=
taos_stmt_affected_rows
(
stmt
);
if
(
affectedRows
!=
100
)
{
printf
(
"failed to insert 100 rows"
);
}
return
0
;
}
...
...
tests/script/api/stmt.c
浏览文件 @
e78e1263
...
...
@@ -46,6 +46,7 @@ void taos_stmt_init_test() {
}
stmt
=
taos_stmt_init
(
taos
);
assert
(
stmt
!=
NULL
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
printf
(
"finish taos_stmt_init test
\n
"
);
}
...
...
@@ -127,6 +128,7 @@ void taos_stmt_set_tbname_test() {
assert
(
taos_stmt_set_tbname
(
stmt
,
name
)
==
0
);
free
(
name
);
free
(
stmt_sql
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
taos_stmt_close
(
stmt
);
printf
(
"finish taos_stmt_set_tbname test
\n
"
);
}
...
...
@@ -166,6 +168,7 @@ void taos_stmt_set_tbname_tags_test() {
free
(
stmt_sql
);
free
(
name
);
free
(
tags
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
taos_stmt_close
(
stmt
);
printf
(
"finish taos_stmt_set_tbname_tags test
\n
"
);
}
...
...
@@ -194,8 +197,10 @@ void taos_stmt_set_sub_tbname_test() {
assert
(
taos_stmt_set_sub_tbname
(
stmt
,
name
)
!=
0
);
sprintf
(
name
,
"tb"
);
assert
(
taos_stmt_set_sub_tbname
(
stmt
,
name
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_load_table_info
(
taos
,
"super, tb"
)
==
0
);
assert
(
taos_stmt_set_sub_tbname
(
stmt
,
name
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
free
(
name
);
free
(
stmt_sql
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
...
...
@@ -238,6 +243,7 @@ void taos_stmt_bind_param_test() {
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
!=
0
);
assert
(
taos_stmt_set_tbname
(
stmt
,
"super"
)
==
0
);
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
free
(
params
);
free
(
stmt_sql
);
taos_stmt_close
(
stmt
);
...
...
@@ -249,6 +255,7 @@ void taos_stmt_bind_single_param_batch_test() {
TAOS_STMT
*
stmt
=
NULL
;
TAOS_MULTI_BIND
*
bind
=
NULL
;
assert
(
taos_stmt_bind_single_param_batch
(
stmt
,
bind
,
0
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
printf
(
"finish taos_stmt_bind_single_param_batch test
\n
"
);
}
...
...
@@ -257,6 +264,7 @@ void taos_stmt_bind_param_batch_test() {
TAOS_STMT
*
stmt
=
NULL
;
TAOS_MULTI_BIND
*
bind
=
NULL
;
assert
(
taos_stmt_bind_param_batch
(
stmt
,
bind
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
printf
(
"finish taos_stmt_bind_param_batch test
\n
"
);
}
...
...
@@ -293,10 +301,14 @@ void taos_stmt_add_batch_test() {
params
[
1
].
length
=
&
params
[
1
].
buffer_length
;
params
[
1
].
is_null
=
NULL
;
assert
(
taos_stmt_set_tbname
(
stmt
,
"super"
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_add_batch
(
stmt
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
free
(
params
);
free
(
stmt_sql
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
printf
(
"finish taos_stmt_add_batch test
\n
"
);
}
...
...
@@ -317,10 +329,13 @@ void taos_stmt_execute_test() {
stmt
=
taos_stmt_init
(
taos
);
assert
(
stmt
!=
NULL
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
char
*
stmt_sql
=
calloc
(
1
,
1000
);
sprintf
(
stmt_sql
,
"insert into ? values (?,?)"
);
assert
(
taos_stmt_prepare
(
stmt
,
stmt_sql
,
0
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
TAOS_BIND
*
params
=
calloc
(
2
,
sizeof
(
TAOS_BIND
));
int64_t
ts
=
(
int64_t
)
1591060628000
;
params
[
0
].
buffer_type
=
TSDB_DATA_TYPE_TIMESTAMP
;
...
...
@@ -335,11 +350,17 @@ void taos_stmt_execute_test() {
params
[
1
].
length
=
&
params
[
1
].
buffer_length
;
params
[
1
].
is_null
=
NULL
;
assert
(
taos_stmt_set_tbname
(
stmt
,
"super"
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_bind_param
(
stmt
,
params
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_execute
(
stmt
)
!=
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_add_batch
(
stmt
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
0
);
assert
(
taos_stmt_execute
(
stmt
)
==
0
);
assert
(
taos_stmt_affected_rows
(
stmt
)
==
1
);
free
(
params
);
free
(
stmt_sql
);
assert
(
taos_stmt_close
(
stmt
)
==
0
);
...
...
@@ -542,4 +563,4 @@ int main(int argc, char *argv[]) {
test_api_reliability
();
test_query
();
return
0
;
}
\ No newline at end of file
}
tests/script/api/stmtTest.c
浏览文件 @
e78e1263
...
...
@@ -230,7 +230,12 @@ int main(int argc, char *argv[]) {
printf
(
"Successfully execute insert statement.
\n
"
);
int
affectedRows
=
taos_stmt_affected_rows
(
stmt
);
printf
(
"Successfully inserted %d rows"
,
affectedRows
);
printf
(
"Successfully inserted %d rows
\n
"
,
affectedRows
);
if
(
affectedRows
!=
10
)
{
PRINT_ERROR
printf
(
"failed to insert 10 rows
\n
"
);
exit
(
EXIT_FAILURE
);
}
taos_stmt_close
(
stmt
);
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录