Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c7a2dd63
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看板
提交
c7a2dd63
编写于
12月 23, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into feature/dnode3
上级
c6f22f4b
e15c5a91
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
108 addition
and
102 deletion
+108
-102
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+13
-5
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+3
-3
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+92
-92
source/libs/parser/src/astValidate.c
source/libs/parser/src/astValidate.c
+0
-2
未找到文件。
source/client/src/clientImpl.c
浏览文件 @
c7a2dd63
...
...
@@ -113,6 +113,13 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
return
taosConnectImpl
(
ip
,
user
,
&
secretEncrypt
[
0
],
db
,
port
,
NULL
,
NULL
,
*
pInst
);
}
static
bool
supportedQueryType
(
int32_t
type
)
{
return
(
type
==
TSDB_MSG_TYPE_CREATE_USER
||
type
==
TSDB_MSG_TYPE_SHOW
||
type
==
TSDB_MSG_TYPE_DROP_USER
||
type
==
TSDB_MSG_TYPE_DROP_ACCT
||
type
==
TSDB_MSG_TYPE_CREATE_DB
||
type
==
TSDB_MSG_TYPE_CREATE_ACCT
||
type
==
TSDB_MSG_TYPE_CREATE_TABLE
||
type
==
TSDB_MSG_TYPE_CREATE_STB
||
type
==
TSDB_MSG_TYPE_USE_DB
||
type
==
TSDB_MSG_TYPE_DROP_DB
||
type
==
TSDB_MSG_TYPE_DROP_STB
);
}
TAOS_RES
*
taos_query_l
(
TAOS
*
taos
,
const
char
*
sql
,
int
sqlLen
)
{
STscObj
*
pTscObj
=
(
STscObj
*
)
taos
;
if
(
sqlLen
>
(
size_t
)
tsMaxSQLStringLen
)
{
...
...
@@ -145,16 +152,17 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
tscDebugL
(
"0x%"
PRIx64
" SQL: %s"
,
pRequest
->
requestId
,
pRequest
->
sqlstr
);
SParseContext
cxt
=
{
.
ctx
=
{.
requestId
=
pRequest
->
requestId
,
.
acctId
=
pTscObj
->
acctId
,
.
db
=
getConnectionDB
(
pTscObj
)},
.
pSql
=
pRequest
->
sqlstr
,
.
ctx
=
{.
requestId
=
pRequest
->
requestId
,
.
acctId
=
pTscObj
->
acctId
,
.
db
=
getConnectionDB
(
pTscObj
)},
.
pSql
=
pRequest
->
sqlstr
,
.
sqlLen
=
sqlLen
,
.
pMsg
=
pRequest
->
msgBuf
,
.
pMsg
=
pRequest
->
msgBuf
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
};
SQueryNode
*
pQuery
=
NULL
;
int32_t
code
=
qParseQuerySql
(
&
cxt
,
&
pQuery
);
if
(
qIsDclQuery
(
pQuery
))
{
SDclStmtInfo
*
pDcl
=
(
SDclStmtInfo
*
)
pQuery
;
SDclStmtInfo
*
pDcl
=
(
SDclStmtInfo
*
)
pQuery
;
pRequest
->
type
=
pDcl
->
msgType
;
pRequest
->
body
.
requestMsg
=
(
SReqMsgInfo
){.
pMsg
=
pDcl
->
pMsg
,
.
len
=
pDcl
->
msgLen
};
...
...
@@ -215,7 +223,7 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
int
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
)
{
pEpSet
->
version
=
0
;
// init m
gmt
ip set
// init m
node
ip set
SEpSet
*
mgmtEpSet
=
&
(
pEpSet
->
epSet
);
mgmtEpSet
->
numOfEps
=
0
;
mgmtEpSet
->
inUse
=
0
;
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
c7a2dd63
...
...
@@ -110,9 +110,9 @@ SRequestMsgBody buildRequestMsgImpl(SRequestObj *pRequest) {
assert
(
pRequest
!=
NULL
);
SRequestMsgBody
body
=
{
.
requestObjRefId
=
pRequest
->
self
,
.
msgInfo
=
pRequest
->
body
.
requestMsg
,
.
msgType
=
pRequest
->
type
,
.
requestId
=
pRequest
->
requestId
,
.
msgInfo
=
pRequest
->
body
.
requestMsg
,
.
msgType
=
pRequest
->
type
,
.
requestId
=
pRequest
->
requestId
,
};
return
body
;
}
...
...
source/client/test/clientTests.cpp
浏览文件 @
c7a2dd63
...
...
@@ -49,101 +49,101 @@ int main(int argc, char** argv) {
TEST
(
testCase
,
driverInit_Test
)
{
taos_init
();
}
// TEST(testCase, connect_Test) {
// TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0);
//// assert(pConn != NULL);
// taos_close(pConn);
//}
//
// TEST(testCase, create_user_Test) {
// TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
//
// 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));
// }
//
// taos_free_result(pRes);
// taos_close(pConn);
//}
//
// TEST(testCase, create_account_Test) {
// TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0);
TEST
(
testCase
,
connect_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
// assert(pConn != NULL);
//
// TAOS_RES* pRes = taos_query(pConn, "create account aabc pass '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, drop_account_Test) {
// TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0);
taos_close
(
pConn
);
}
TEST
(
testCase
,
create_user_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
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
));
}
taos_free_result
(
pRes
);
taos_close
(
pConn
);
}
TEST
(
testCase
,
create_account_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create account aabc pass '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
,
drop_account_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"drop account aabc"
);
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);
//
// TAOS_RES* pRes = taos_query(pConn, "drop account aabc
");
// 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);
//
// TAOS_RES* pRes = taos_query(pConn, "show users");
// TAOS_ROW pRow = NULL;
//
// TAOS_FIELD* pFields = taos_fetch_fields(pRes
);
// int32_t numOfFields = taos_num_fields(pRes
);
//
// char str[512] = {0}
;
// while((pRow = taos_fetch_row(pRes)) != NULL
) {
// int32_t code = taos_print_row(str, pRow, pFields, numOfFields
);
// printf("%s\n", str);
// }
//
//
taos_close(pConn);
//
}
//
// TEST(testCase, drop_user
_Test) {
//
TAOS* pConn = taos_connect("ubuntu", "root", "taosdata", NULL, 0);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"show users
"
);
TAOS_ROW
pRow
=
NULL
;
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pRes
);
int32_t
numOfFields
=
taos_num_fields
(
pRes
);
char
str
[
512
]
=
{
0
}
;
while
((
pRow
=
taos_fetch_row
(
pRes
))
!=
NULL
)
{
int32_t
code
=
taos_print_row
(
str
,
pRow
,
pFields
,
numOfFields
);
printf
(
"%s
\n
"
,
str
);
}
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);
//
// 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);
//
// TAOS_RES* pRes = taos_query(pConn, "show databases");
// TAOS_ROW pRow = NULL;
//
// TAOS_FIELD* pFields = taos_fetch_fields(pRes);
// int32_t numOfFields = taos_num_fields(pRes);
//
// char str[512] = {0};
// while((pRow = taos_fetch_row(pRes)) != NULL) {
// int32_t code = taos_print_row(str, pRow, pFields, numOfFields);
// printf("%s\n", str);
// }
//
// taos_close(pConn);
//}
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"show databases"
);
TAOS_ROW
pRow
=
NULL
;
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pRes
);
int32_t
numOfFields
=
taos_num_fields
(
pRes
);
char
str
[
512
]
=
{
0
};
while
((
pRow
=
taos_fetch_row
(
pRes
))
!=
NULL
)
{
int32_t
code
=
taos_print_row
(
str
,
pRow
,
pFields
,
numOfFields
);
printf
(
"%s
\n
"
,
str
);
}
taos_close
(
pConn
);
}
TEST
(
testCase
,
create_db_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"ubuntu"
,
"root"
,
"taosdata"
,
NULL
,
0
);
...
...
source/libs/parser/src/astValidate.c
浏览文件 @
c7a2dd63
...
...
@@ -4457,8 +4457,6 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
strncpy
(
pCreateMsg
->
db
,
token
.
z
,
token
.
n
);
pDcl
->
pMsg
=
(
char
*
)
pCreateMsg
;
pDcl
->
msgLen
=
sizeof
(
SCreateDbMsg
);
pDcl
->
msgType
=
(
pInfo
->
type
==
TSDB_SQL_CREATE_DB
)
?
TSDB_MSG_TYPE_CREATE_DB
:
TSDB_MSG_TYPE_ALTER_DB
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录