Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3ae97698
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
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看板
提交
3ae97698
编写于
4月 21, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stmt
上级
dff638c3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
28 deletion
+34
-28
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+2
-1
source/client/src/clientStmt.c
source/client/src/clientStmt.c
+4
-0
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+28
-27
未找到文件。
source/client/src/clientImpl.c
浏览文件 @
3ae97698
...
...
@@ -725,7 +725,8 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
pStart
),
varDataLen
(
pStart
),
varDataVal
(
p
));
ASSERT
(
len
<=
bytes
);
ASSERT
((
p
+
len
)
<
(
pResultInfo
->
convertBuf
[
i
]
+
colLength
[
i
]));
varDataSetLen
(
p
,
len
);
pCol
->
offset
[
j
]
=
(
p
-
pResultInfo
->
convertBuf
[
i
]);
p
+=
(
len
+
VARSTR_HEADER_SIZE
);
...
...
source/client/src/clientStmt.c
浏览文件 @
3ae97698
...
...
@@ -108,6 +108,10 @@ int32_t stmtParseSql(STscStmt* pStmt) {
.
setExecInfoFn
=
stmtSetExecInfo
,
.
getExecInfoFn
=
stmtGetExecInfo
,
};
if
(
NULL
==
pStmt
->
exec
.
pRequest
)
{
STMT_ERR_RET
(
buildRequest
(
pStmt
->
taos
,
pStmt
->
sql
.
sqlStr
,
pStmt
->
sql
.
sqlLen
,
&
pStmt
->
exec
.
pRequest
));
}
STMT_ERR_RET
(
parseSql
(
pStmt
->
exec
.
pRequest
,
false
,
&
pStmt
->
sql
.
pQuery
,
&
stmtCb
));
...
...
tests/script/api/batchprepare.c
浏览文件 @
3ae97698
...
...
@@ -11,7 +11,7 @@
int32_t
shortColList
[]
=
{
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_DATA_TYPE_INT
};
int32_t
fullColList
[]
=
{
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
};
int32_t
bindColTypeList
[]
=
{
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_DATA_TYPE_
FLOAT
};
int32_t
bindColTypeList
[]
=
{
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_DATA_TYPE_
NCHAR
};
#define tListLen(x) (sizeof(x) / sizeof((x)[0]))
...
...
@@ -70,7 +70,6 @@ typedef struct {
}
CaseCfg
;
CaseCfg
gCase
[]
=
{
#if 0
{
"insert:MBSE1-FULL"
,
tListLen
(
shortColList
),
shortColList
,
false
,
true
,
insertMBSETest1
,
1
,
10
,
10
,
0
,
0
,
1
},
{
"insert:MBSE1-FULL"
,
tListLen
(
shortColList
),
shortColList
,
false
,
true
,
insertMBSETest1
,
10
,
100
,
10
,
0
,
0
,
1
},
...
...
@@ -97,10 +96,10 @@ CaseCfg gCase[] = {
{
"insert:MBME4-FULL"
,
tListLen
(
fullColList
),
fullColList
,
false
,
true
,
insertMBMETest4
,
10
,
10
,
2
,
0
,
0
,
1
},
{
"insert:MBME4-C012"
,
tListLen
(
fullColList
),
fullColList
,
false
,
false
,
insertMBMETest4
,
10
,
10
,
2
,
12
,
0
,
1
},
{
"insert:MBME4-C002"
,
tListLen
(
fullColList
),
fullColList
,
false
,
false
,
insertMBMETest4
,
10
,
10
,
2
,
2
,
0
,
1
},
#endif
{
"insert:MPME1-FULL"
,
tListLen
(
fullColList
),
fullColList
,
false
,
true
,
insertMPMETest1
,
10
,
10
,
2
,
0
,
0
,
1
},
//
{"insert:MPME1-C012", tListLen(fullColList), fullColList, false, false, insertMPMETest1, 10, 10, 2, 12, 0, 1},
{
"insert:MPME1-C012"
,
tListLen
(
fullColList
),
fullColList
,
false
,
false
,
insertMPMETest1
,
10
,
10
,
2
,
12
,
0
,
1
},
};
...
...
@@ -111,6 +110,8 @@ typedef struct {
bool
autoCreate
;
bool
checkParamNum
;
bool
printRes
;
bool
printCreateTblSql
;
bool
printInsertSql
;
int32_t
rowNum
;
//row num for one table
int32_t
bindColNum
;
int32_t
bindRowNum
;
//row num for once bind
...
...
@@ -122,6 +123,8 @@ typedef struct {
CaseCtrl
gCaseCtrl
=
{
.
bindNullNum
=
0
,
.
autoCreate
=
false
,
.
printCreateTblSql
=
false
,
.
printInsertSql
=
true
,
.
rowNum
=
0
,
.
bindColNum
=
0
,
.
bindRowNum
=
0
,
...
...
@@ -243,7 +246,10 @@ void generateInsertSQL(BindData *data) {
len
+=
sprintf
(
data
->
sql
+
len
,
"?"
);
}
len
+=
sprintf
(
data
->
sql
+
len
,
")"
);
if
(
gCaseCtrl
.
printInsertSql
)
{
printf
(
"SQL: %s
\n
"
,
data
->
sql
);
}
}
void
generateDataType
(
BindData
*
data
,
int32_t
bindIdx
,
int32_t
colIdx
,
int32_t
*
dataType
)
{
...
...
@@ -525,8 +531,6 @@ int insertMBSETest1(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
));
...
...
@@ -582,8 +586,6 @@ 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
));
...
...
@@ -638,8 +640,6 @@ int insertMBSETest2(TAOS_STMT *stmt) {
int
insertMBMETest1
(
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
){
...
...
@@ -695,8 +695,6 @@ 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
));
...
...
@@ -751,8 +749,6 @@ 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
));
...
...
@@ -818,8 +814,6 @@ 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
));
...
...
@@ -878,8 +872,6 @@ int insertMPMETest1(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
));
...
...
@@ -3866,6 +3858,8 @@ void prepareCheckResult(TAOS *taos) {
prepareCheckResultImpl
(
taos
,
buf
,
gCaseCtrl
.
printRes
,
gCurCase
->
rowNum
*
gExecLoopTimes
);
}
gExecLoopTimes
=
1
;
}
...
...
@@ -4133,7 +4127,9 @@ void generateCreateTableSQL(char *buf, int32_t tblIdx, int32_t colNum, int32_t *
blen
+=
sprintf
(
buf
+
blen
,
")"
);
printf
(
"Create SQL:%s
\n
"
,
buf
);
if
(
gCaseCtrl
.
printCreateTblSql
)
{
printf
(
"Create Table SQL:%s
\n
"
,
buf
);
}
}
void
prepare
(
TAOS
*
taos
,
int32_t
colNum
,
int32_t
*
colList
,
int
autoCreate
)
{
...
...
@@ -4253,40 +4249,45 @@ void* runcase(TAOS *taos) {
}
void
runAll
(
TAOS
*
taos
)
{
#if 0
printf
(
"Normal Test
\n
"
);
runcase
(
taos
);
printf
(
"Null Test
\n
"
);
gCaseCtrl
.
bindNullNum
=
1
;
runcase
(
taos
);
gCaseCtrl
.
bindNullNum
=
0
;
printf
(
"Bind Row Test
\n
"
);
gCaseCtrl
.
bindRowNum
=
1
;
runcase
(
taos
);
gCaseCtrl
.
bindRowNum
=
0
;
#endif
gCaseCtrl
.
rowNum
=
10000
;
printf
(
"Row Num Test
\n
"
);
gCaseCtrl
.
rowNum
=
1000
;
gCaseCtrl
.
printRes
=
false
;
runcase
(
taos
);
gCaseCtrl
.
rowNum
=
0
;
gCaseCtrl
.
printRes
=
true
;
#if 0
gCaseCtrl.runTimes = 10;
printf
(
"Runtimes Test
\n
"
);
gCaseCtrl
.
runTimes
=
2
;
runcase
(
taos
);
gCaseCtrl
.
runTimes
=
0
;
printf
(
"Check Param Test
\n
"
);
gCaseCtrl
.
checkParamNum
=
true
;
runcase
(
taos
);
gCaseCtrl
.
checkParamNum
=
false
;
printf
(
"Bind Col Num Test
\n
"
);
gCaseCtrl
.
bindColNum
=
6
;
runcase
(
taos
);
gCaseCtrl
.
bindColNum
=
0
;
printf
(
"Bind Col Type Test
\n
"
);
gCaseCtrl
.
bindColTypeNum
=
tListLen
(
bindColTypeList
);
gCaseCtrl.bindColType
Num = bindColType
List = bindColTypeList;
gCaseCtrl
.
bindColTypeList
=
bindColTypeList
;
runcase
(
taos
);
#endif
}
int
main
(
int
argc
,
char
*
argv
[])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录