Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b710e581
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看板
提交
b710e581
编写于
12月 20, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] fix bug.
上级
79d93ee7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
32 deletion
+28
-32
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+16
-23
source/libs/parser/inc/astToMsg.h
source/libs/parser/inc/astToMsg.h
+2
-2
source/libs/parser/src/astToMsg.c
source/libs/parser/src/astToMsg.c
+8
-5
source/libs/parser/src/astValidate.c
source/libs/parser/src/astValidate.c
+2
-2
未找到文件。
source/client/test/clientTests.cpp
浏览文件 @
b710e581
...
...
@@ -48,14 +48,7 @@ TEST(testCase, create_user_Test) {
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
// assert(pConn != NULL);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"drop user abc"
);
if
(
taos_errno
(
pRes
)
!=
TSDB_CODE_SUCCESS
)
{
printf
(
"failed to create user, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"create user abc pass 'abc'"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create user abc pass 'abc'"
);
if
(
taos_errno
(
pRes
)
!=
TSDB_CODE_SUCCESS
)
{
printf
(
"failed to create user, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
...
...
@@ -66,7 +59,7 @@ TEST(testCase, create_user_Test) {
TEST
(
testCase
,
create_account_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
//
assert(pConn != NULL);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create account aabc pass 'abc'"
);
if
(
taos_errno
(
pRes
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -90,19 +83,6 @@ TEST(testCase, drop_account_Test) {
taos_close
(
pConn
);
}
TEST
(
testCase
,
drop_user_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"drop user abc"
);
if
(
taos_errno
(
pRes
)
!=
TSDB_CODE_SUCCESS
)
{
printf
(
"failed to create user, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
taos_free_result
(
pRes
);
taos_close
(
pConn
);
}
TEST
(
testCase
,
show_user_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
// assert(pConn != NULL);
...
...
@@ -122,6 +102,19 @@ TEST(testCase, show_user_Test) {
taos_close
(
pConn
);
}
TEST
(
testCase
,
drop_user_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"drop user abc"
);
if
(
taos_errno
(
pRes
)
!=
TSDB_CODE_SUCCESS
)
{
printf
(
"failed to create user, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
taos_free_result
(
pRes
);
taos_close
(
pConn
);
}
TEST
(
testCase
,
show_db_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
// assert(pConn != NULL);
...
...
@@ -143,7 +136,7 @@ TEST(testCase, show_db_Test) {
TEST
(
testCase
,
create_db_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
//
assert(pConn != NULL);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database abc1"
);
...
...
source/libs/parser/inc/astToMsg.h
浏览文件 @
b710e581
...
...
@@ -4,8 +4,8 @@
#include "parserInt.h"
#include "taosmsg.h"
SCreateUserMsg
*
buildUserManipulationMsg
(
SSqlInfo
*
pInfo
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
);
SDropUserMsg
*
buildDropUserMsg
(
SSqlInfo
*
pInfo
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
);
SCreateUserMsg
*
buildUserManipulationMsg
(
SSqlInfo
*
pInfo
,
int
32_t
*
outputLen
,
int
64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
);
SDropUserMsg
*
buildDropUserMsg
(
SSqlInfo
*
pInfo
,
int
32_t
*
outputLen
,
int
64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
);
SShowMsg
*
buildShowMsg
(
SShowInfo
*
pShowInfo
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
);
SCreateDbMsg
*
buildCreateDbMsg
(
SCreateDbInfo
*
pCreateDbInfo
,
char
*
msgBuf
,
int32_t
msgLen
);
...
...
source/libs/parser/src/astToMsg.c
浏览文件 @
b710e581
#include "parserInt.h"
#include "parserUtil.h"
SCreateUserMsg
*
buildUserManipulationMsg
(
SSqlInfo
*
pInfo
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
)
{
SCreateUserMsg
*
buildUserManipulationMsg
(
SSqlInfo
*
pInfo
,
int
32_t
*
outputLen
,
int
64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
)
{
SCreateUserMsg
*
pMsg
=
(
SCreateUserMsg
*
)
calloc
(
1
,
sizeof
(
SCreateUserMsg
));
if
(
pMsg
==
NULL
)
{
// tscError("0x%" PRIx64 " failed to malloc for query msg", id);
...
...
@@ -20,22 +20,25 @@ SCreateUserMsg* buildUserManipulationMsg(SSqlInfo* pInfo, int64_t id, char* msgB
strncpy
(
pMsg
->
pass
,
pUser
->
passwd
.
z
,
pUser
->
passwd
.
n
);
}
*
outputLen
=
sizeof
(
SUserInfo
);
return
pMsg
;
}
SDropUserMsg
*
buildDropUserMsg
(
SSqlInfo
*
pInfo
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
)
{
if
(
pInfo
->
pMiscInfo
->
user
.
user
.
n
>=
TSDB_USER_LEN
)
{
SDropUserMsg
*
buildDropUserMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
msgLen
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgBufLen
)
{
SToken
*
pName
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
if
(
pName
->
n
>=
TSDB_USER_LEN
)
{
return
NULL
;
}
SDropUserMsg
*
pMsg
=
calloc
(
1
,
sizeof
(
SDropUserMsg
));
if
(
pMsg
==
NULL
)
{
return
NULL
;
}
SToken
*
pName
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
strncpy
(
pMsg
->
user
,
pName
->
z
,
pName
->
n
);
return
TSDB_CODE_SUCCESS
;
*
msgLen
=
sizeof
(
SDropUserMsg
);
return
pMsg
;
}
SShowMsg
*
buildShowMsg
(
SShowInfo
*
pShowInfo
,
int64_t
id
,
char
*
msgBuf
,
int32_t
msgLen
)
{
...
...
source/libs/parser/src/astValidate.c
浏览文件 @
b710e581
...
...
@@ -4224,13 +4224,13 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, int64_t id, void** output, in
}
}
*
output
=
buildUserManipulationMsg
(
pInfo
,
id
,
msgBuf
,
msgBufLen
);
*
output
=
buildUserManipulationMsg
(
pInfo
,
outputLen
,
id
,
msgBuf
,
msgBufLen
);
break
;
}
case
TSDB_SQL_DROP_ACCT
:
case
TSDB_SQL_DROP_USER
:
{
*
output
=
buildDropUserMsg
(
pInfo
,
id
,
msgBuf
,
msgBufLen
);
*
output
=
buildDropUserMsg
(
pInfo
,
outputLen
,
id
,
msgBuf
,
msgBufLen
);
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录