Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e6846049
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
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看板
未验证
提交
e6846049
编写于
12月 27, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
12月 27, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9419 from taosdata/feature/3.0_liaohj
Feature/3.0 liaohj
上级
7eea452b
4ebabfcf
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
142 addition
and
32 deletion
+142
-32
include/util/tdef.h
include/util/tdef.h
+1
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+10
-1
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+7
-4
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+54
-18
source/libs/parser/inc/astToMsg.h
source/libs/parser/inc/astToMsg.h
+3
-1
source/libs/parser/src/astToMsg.c
source/libs/parser/src/astToMsg.c
+43
-3
source/libs/parser/src/dCDAstProcess.c
source/libs/parser/src/dCDAstProcess.c
+22
-3
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+2
-1
未找到文件。
include/util/tdef.h
浏览文件 @
e6846049
...
@@ -204,7 +204,7 @@ do { \
...
@@ -204,7 +204,7 @@ do { \
#define TSDB_CLUSTER_ID_LEN 40
#define TSDB_CLUSTER_ID_LEN 40
#define TSDB_FQDN_LEN 128
#define TSDB_FQDN_LEN 128
#define TSDB_EP_LEN (TSDB_FQDN_LEN
+
6)
#define TSDB_EP_LEN (TSDB_FQDN_LEN
+
6)
#define TSDB_IPv4ADDR_LEN 16
#define TSDB_IPv4ADDR_LEN 16
#define TSDB_FILENAME_LEN 128
#define TSDB_FILENAME_LEN 128
#define TSDB_SHOW_SQL_LEN 512
#define TSDB_SHOW_SQL_LEN 512
...
...
source/client/src/clientImpl.c
浏览文件 @
e6846049
...
@@ -152,6 +152,7 @@ int32_t parseSql(SRequestObj* pRequest, SQueryNode** pQuery) {
...
@@ -152,6 +152,7 @@ int32_t parseSql(SRequestObj* pRequest, SQueryNode** pQuery) {
.
pMsg
=
pRequest
->
msgBuf
,
.
pMsg
=
pRequest
->
msgBuf
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
};
};
int32_t
code
=
qParseQuerySql
(
&
cxt
,
pQuery
);
int32_t
code
=
qParseQuerySql
(
&
cxt
,
pQuery
);
tfree
(
cxt
.
ctx
.
db
);
tfree
(
cxt
.
ctx
.
db
);
return
code
;
return
code
;
...
@@ -420,7 +421,15 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
...
@@ -420,7 +421,15 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
taosReleaseRef
(
clientReqRefPool
,
pSendInfo
->
requestObjRefId
);
taosReleaseRef
(
clientReqRefPool
,
pSendInfo
->
requestObjRefId
);
}
}
SDataBuf
buf
=
{.
pData
=
pMsg
->
pCont
,
.
len
=
pMsg
->
contLen
};
SDataBuf
buf
=
{.
len
=
pMsg
->
contLen
};
buf
.
pData
=
calloc
(
1
,
pMsg
->
contLen
);
if
(
buf
.
pData
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
pMsg
->
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
else
{
memcpy
(
buf
.
pData
,
pMsg
->
pCont
,
pMsg
->
contLen
);
}
pSendInfo
->
fp
(
pSendInfo
->
param
,
&
buf
,
pMsg
->
code
);
pSendInfo
->
fp
(
pSendInfo
->
param
,
&
buf
,
pMsg
->
code
);
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
}
}
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
e6846049
...
@@ -99,10 +99,10 @@ SMsgSendInfo* buildSendMsgInfoImpl(SRequestObj *pRequest) {
...
@@ -99,10 +99,10 @@ SMsgSendInfo* buildSendMsgInfoImpl(SRequestObj *pRequest) {
}
else
{
}
else
{
assert
(
pRequest
!=
NULL
);
assert
(
pRequest
!=
NULL
);
pMsgSendInfo
->
requestObjRefId
=
pRequest
->
self
;
pMsgSendInfo
->
requestObjRefId
=
pRequest
->
self
;
pMsgSendInfo
->
msgInfo
=
pRequest
->
body
.
requestMsg
;
pMsgSendInfo
->
msgInfo
=
pRequest
->
body
.
requestMsg
;
pMsgSendInfo
->
msgType
=
pRequest
->
type
;
pMsgSendInfo
->
msgType
=
pRequest
->
type
;
pMsgSendInfo
->
requestId
=
pRequest
->
requestId
;
pMsgSendInfo
->
requestId
=
pRequest
->
requestId
;
pMsgSendInfo
->
param
=
pRequest
;
pMsgSendInfo
->
param
=
pRequest
;
pMsgSendInfo
->
fp
=
(
handleRequestRspFp
[
pRequest
->
type
]
==
NULL
)
?
genericRspCallback
:
handleRequestRspFp
[
pRequest
->
type
];
pMsgSendInfo
->
fp
=
(
handleRequestRspFp
[
pRequest
->
type
]
==
NULL
)
?
genericRspCallback
:
handleRequestRspFp
[
pRequest
->
type
];
}
}
...
@@ -165,8 +165,11 @@ int32_t processRetrieveMnodeRsp(void* param, const SDataBuf* pMsg, int32_t code)
...
@@ -165,8 +165,11 @@ int32_t processRetrieveMnodeRsp(void* param, const SDataBuf* pMsg, int32_t code)
pRetrieve
->
precision
=
htons
(
pRetrieve
->
precision
);
pRetrieve
->
precision
=
htons
(
pRetrieve
->
precision
);
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
tfree
(
pResInfo
->
pRspMsg
);
pResInfo
->
pRspMsg
=
pMsg
->
pData
;
pResInfo
->
numOfRows
=
pRetrieve
->
numOfRows
;
pResInfo
->
numOfRows
=
pRetrieve
->
numOfRows
;
pResInfo
->
pData
=
pRetrieve
->
data
;
// todo fix this in async model
pResInfo
->
pData
=
pRetrieve
->
data
;
// todo fix this in async model
pResInfo
->
current
=
0
;
pResInfo
->
current
=
0
;
setResultDataPtr
(
pResInfo
,
pResInfo
->
fields
,
pResInfo
->
numOfCols
,
pResInfo
->
numOfRows
);
setResultDataPtr
(
pResInfo
,
pResInfo
->
fields
,
pResInfo
->
numOfCols
,
pResInfo
->
numOfRows
);
...
...
source/client/test/clientTests.cpp
浏览文件 @
e6846049
...
@@ -50,13 +50,13 @@ int main(int argc, char** argv) {
...
@@ -50,13 +50,13 @@ int main(int argc, char** argv) {
TEST
(
testCase
,
driverInit_Test
)
{
taos_init
();
}
TEST
(
testCase
,
driverInit_Test
)
{
taos_init
();
}
TEST
(
testCase
,
connect_Test
)
{
TEST
(
testCase
,
connect_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
taos_close
(
pConn
);
taos_close
(
pConn
);
}
}
TEST
(
testCase
,
create_user_Test
)
{
TEST
(
testCase
,
create_user_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create user abc pass 'abc'"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create user abc pass 'abc'"
);
...
@@ -69,7 +69,7 @@ TEST(testCase, create_user_Test) {
...
@@ -69,7 +69,7 @@ TEST(testCase, create_user_Test) {
}
}
TEST
(
testCase
,
create_account_Test
)
{
TEST
(
testCase
,
create_account_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create account aabc pass 'abc'"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create account aabc pass 'abc'"
);
...
@@ -82,7 +82,7 @@ TEST(testCase, create_account_Test) {
...
@@ -82,7 +82,7 @@ TEST(testCase, create_account_Test) {
}
}
TEST
(
testCase
,
drop_account_Test
)
{
TEST
(
testCase
,
drop_account_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"drop account aabc"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"drop account aabc"
);
...
@@ -95,7 +95,7 @@ TEST(testCase, drop_account_Test) {
...
@@ -95,7 +95,7 @@ TEST(testCase, drop_account_Test) {
}
}
TEST
(
testCase
,
show_user_Test
)
{
TEST
(
testCase
,
show_user_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"show users"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"show users"
);
...
@@ -114,7 +114,7 @@ TEST(testCase, show_user_Test) {
...
@@ -114,7 +114,7 @@ TEST(testCase, show_user_Test) {
}
}
TEST
(
testCase
,
drop_user_Test
)
{
TEST
(
testCase
,
drop_user_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"drop user abc"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"drop user abc"
);
...
@@ -127,7 +127,7 @@ TEST(testCase, drop_user_Test) {
...
@@ -127,7 +127,7 @@ TEST(testCase, drop_user_Test) {
}
}
TEST
(
testCase
,
show_db_Test
)
{
TEST
(
testCase
,
show_db_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
// assert(pConn != NULL);
// assert(pConn != NULL);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"show databases"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"show databases"
);
...
@@ -146,7 +146,7 @@ TEST(testCase, show_db_Test) {
...
@@ -146,7 +146,7 @@ TEST(testCase, show_db_Test) {
}
}
TEST
(
testCase
,
create_db_Test
)
{
TEST
(
testCase
,
create_db_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database abc1"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database abc1"
);
...
@@ -169,8 +169,46 @@ TEST(testCase, create_db_Test) {
...
@@ -169,8 +169,46 @@ TEST(testCase, create_db_Test) {
taos_close
(
pConn
);
taos_close
(
pConn
);
}
}
TEST
(
testCase
,
create_dnode_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create dnode abc1"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"error in create dnode, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pRes
);
ASSERT_TRUE
(
pFields
==
NULL
);
int32_t
numOfFields
=
taos_num_fields
(
pRes
);
ASSERT_EQ
(
numOfFields
,
0
);
taos_free_result
(
pRes
);
taos_close
(
pConn
);
}
TEST
(
testCase
,
drop_dnode_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"drop dnode 2"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"error in drop dnode, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pRes
);
ASSERT_TRUE
(
pFields
==
NULL
);
int32_t
numOfFields
=
taos_num_fields
(
pRes
);
ASSERT_EQ
(
numOfFields
,
0
);
taos_free_result
(
pRes
);
taos_close
(
pConn
);
}
TEST
(
testCase
,
use_db_test
)
{
TEST
(
testCase
,
use_db_test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use abc1"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use abc1"
);
...
@@ -188,7 +226,7 @@ TEST(testCase, use_db_test) {
...
@@ -188,7 +226,7 @@ TEST(testCase, use_db_test) {
}
}
TEST
(
testCase
,
drop_db_test
)
{
TEST
(
testCase
,
drop_db_test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
showDB
(
pConn
);
showDB
(
pConn
);
...
@@ -210,7 +248,7 @@ TEST(testCase, drop_db_test) {
...
@@ -210,7 +248,7 @@ TEST(testCase, drop_db_test) {
}
}
TEST
(
testCase
,
create_stable_Test
)
{
TEST
(
testCase
,
create_stable_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database abc1"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database abc1"
);
...
@@ -241,7 +279,7 @@ TEST(testCase, drop_db_test) {
...
@@ -241,7 +279,7 @@ TEST(testCase, drop_db_test) {
}
}
TEST
(
testCase
,
create_table_Test
)
{
TEST
(
testCase
,
create_table_Test
)
{
// TAOS* pConn = taos_connect("
ubuntu
", "root", "taosdata", NULL, 0);
// TAOS* pConn = taos_connect("
localhost
", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
// assert(pConn != NULL);
//
//
// TAOS_RES* pRes = taos_query(pConn, "use abc1");
// TAOS_RES* pRes = taos_query(pConn, "use abc1");
...
@@ -256,7 +294,7 @@ TEST(testCase, create_table_Test) {
...
@@ -256,7 +294,7 @@ TEST(testCase, create_table_Test) {
TEST
(
testCase
,
create_ctable_Test
)
{}
TEST
(
testCase
,
create_ctable_Test
)
{}
TEST
(
testCase
,
show_stable_Test
)
{
TEST
(
testCase
,
show_stable_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use abc1"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use abc1"
);
...
@@ -273,7 +311,6 @@ TEST(testCase, show_stable_Test) {
...
@@ -273,7 +311,6 @@ TEST(testCase, show_stable_Test) {
}
}
TAOS_ROW
pRow
=
NULL
;
TAOS_ROW
pRow
=
NULL
;
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pRes
);
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pRes
);
int32_t
numOfFields
=
taos_num_fields
(
pRes
);
int32_t
numOfFields
=
taos_num_fields
(
pRes
);
...
@@ -284,12 +321,11 @@ TEST(testCase, show_stable_Test) {
...
@@ -284,12 +321,11 @@ TEST(testCase, show_stable_Test) {
}
}
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
taos_close
(
pConn
);
taos_close
(
pConn
);
}
}
TEST
(
testCase
,
show_vgroup_Test
)
{
TEST
(
testCase
,
show_vgroup_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use abc1"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use abc1"
);
...
@@ -322,7 +358,7 @@ TEST(testCase, show_vgroup_Test) {
...
@@ -322,7 +358,7 @@ TEST(testCase, show_vgroup_Test) {
}
}
TEST
(
testCase
,
drop_stable_Test
)
{
TEST
(
testCase
,
drop_stable_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"
ubuntu
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"
localhost
"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
assert
(
pConn
!=
NULL
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database abc1"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database abc1"
);
...
@@ -347,7 +383,7 @@ TEST(testCase, drop_stable_Test) {
...
@@ -347,7 +383,7 @@ TEST(testCase, drop_stable_Test) {
}
}
//TEST(testCase, show_table_Test) {
//TEST(testCase, show_table_Test) {
// TAOS* pConn = taos_connect("
ubuntu
", "root", "taosdata", NULL, 0);
// TAOS* pConn = taos_connect("
localhost
", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
// assert(pConn != NULL);
//
//
// TAOS_RES* pRes = taos_query(pConn, "use abc1");
// TAOS_RES* pRes = taos_query(pConn, "use abc1");
...
...
source/libs/parser/inc/astToMsg.h
浏览文件 @
e6846049
...
@@ -12,6 +12,8 @@ SDropUserMsg* buildDropUserMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id,
...
@@ -12,6 +12,8 @@ SDropUserMsg* buildDropUserMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id,
SShowMsg
*
buildShowMsg
(
SShowInfo
*
pShowInfo
,
SParseBasicCtx
*
pParseCtx
,
char
*
msgBuf
,
int32_t
msgLen
);
SShowMsg
*
buildShowMsg
(
SShowInfo
*
pShowInfo
,
SParseBasicCtx
*
pParseCtx
,
char
*
msgBuf
,
int32_t
msgLen
);
SCreateDbMsg
*
buildCreateDbMsg
(
SCreateDbInfo
*
pCreateDbInfo
,
SParseBasicCtx
*
pCtx
,
SMsgBuf
*
pMsgBuf
);
SCreateDbMsg
*
buildCreateDbMsg
(
SCreateDbInfo
*
pCreateDbInfo
,
SParseBasicCtx
*
pCtx
,
SMsgBuf
*
pMsgBuf
);
SCreateStbMsg
*
buildCreateTableMsg
(
SCreateTableSql
*
pCreateTableSql
,
int32_t
*
len
,
SParseBasicCtx
*
pParseCtx
,
SMsgBuf
*
pMsgBuf
);
SCreateStbMsg
*
buildCreateTableMsg
(
SCreateTableSql
*
pCreateTableSql
,
int32_t
*
len
,
SParseBasicCtx
*
pParseCtx
,
SMsgBuf
*
pMsgBuf
);
SDropTableMsg
*
buildDropTableMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
len
,
SParseBasicCtx
*
pParseCtx
,
SMsgBuf
*
pMsgBuf
);
SDropStbMsg
*
buildDropStableMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
len
,
SParseBasicCtx
*
pParseCtx
,
SMsgBuf
*
pMsgBuf
);
SCreateDnodeMsg
*
buildCreateDnodeMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
len
,
SMsgBuf
*
pMsgBuf
);
SDropDnodeMsg
*
buildDropDnodeMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
len
,
SMsgBuf
*
pMsgBuf
);
#endif // TDENGINE_ASTTOMSG_H
#endif // TDENGINE_ASTTOMSG_H
source/libs/parser/src/astToMsg.c
浏览文件 @
e6846049
...
@@ -356,7 +356,7 @@ SCreateStbMsg* buildCreateTableMsg(SCreateTableSql* pCreateTableSql, int32_t* le
...
@@ -356,7 +356,7 @@ SCreateStbMsg* buildCreateTableMsg(SCreateTableSql* pCreateTableSql, int32_t* le
return
pCreateTableMsg
;
return
pCreateTableMsg
;
}
}
SDrop
TableMsg
*
buildDropT
ableMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
len
,
SParseBasicCtx
*
pParseCtx
,
SMsgBuf
*
pMsgBuf
)
{
SDrop
StbMsg
*
buildDropSt
ableMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
len
,
SParseBasicCtx
*
pParseCtx
,
SMsgBuf
*
pMsgBuf
)
{
SToken
*
tableName
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
SToken
*
tableName
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
SName
name
=
{
0
};
SName
name
=
{
0
};
...
@@ -366,13 +366,53 @@ SDropTableMsg* buildDropTableMsg(SSqlInfo* pInfo, int32_t* len, SParseBasicCtx*
...
@@ -366,13 +366,53 @@ SDropTableMsg* buildDropTableMsg(SSqlInfo* pInfo, int32_t* len, SParseBasicCtx*
return
NULL
;
return
NULL
;
}
}
SDrop
TableMsg
*
pDropTableMsg
=
(
SDropTableMsg
*
)
calloc
(
1
,
sizeof
(
SDropTable
Msg
));
SDrop
StbMsg
*
pDropTableMsg
=
(
SDropStbMsg
*
)
calloc
(
1
,
sizeof
(
SDropStb
Msg
));
code
=
tNameExtractFullName
(
&
name
,
pDropTableMsg
->
name
);
code
=
tNameExtractFullName
(
&
name
,
pDropTableMsg
->
name
);
assert
(
code
==
TSDB_CODE_SUCCESS
&&
name
.
type
==
TSDB_TABLE_NAME_T
);
assert
(
code
==
TSDB_CODE_SUCCESS
&&
name
.
type
==
TSDB_TABLE_NAME_T
);
pDropTableMsg
->
ig
nore
NotExists
=
pInfo
->
pMiscInfo
->
existsCheck
?
1
:
0
;
pDropTableMsg
->
igNotExists
=
pInfo
->
pMiscInfo
->
existsCheck
?
1
:
0
;
*
len
=
sizeof
(
SDropTableMsg
);
*
len
=
sizeof
(
SDropTableMsg
);
return
pDropTableMsg
;
return
pDropTableMsg
;
}
}
SCreateDnodeMsg
*
buildCreateDnodeMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
len
,
SMsgBuf
*
pMsgBuf
)
{
const
char
*
msg1
=
"invalid host name (name too long, maximum length 128)"
;
const
char
*
msg2
=
"dnode name can not be string"
;
if
(
taosArrayGetSize
(
pInfo
->
pMiscInfo
->
a
)
>
1
)
{
buildInvalidOperationMsg
(
pMsgBuf
,
msg1
);
return
NULL
;
}
SToken
*
id
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
if
(
id
->
type
!=
TK_ID
)
{
buildInvalidOperationMsg
(
pMsgBuf
,
msg2
);
return
NULL
;
}
SCreateDnodeMsg
*
pCreate
=
(
SCreateDnodeMsg
*
)
calloc
(
1
,
sizeof
(
SCreateDnodeMsg
));
strncpy
(
pCreate
->
ep
,
id
->
z
,
id
->
n
);
*
len
=
sizeof
(
SCreateDnodeMsg
);
return
pCreate
;
}
SDropDnodeMsg
*
buildDropDnodeMsg
(
SSqlInfo
*
pInfo
,
int32_t
*
len
,
SMsgBuf
*
pMsgBuf
)
{
SToken
*
pzName
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
char
*
end
=
NULL
;
SDropDnodeMsg
*
pDrop
=
(
SDropDnodeMsg
*
)
calloc
(
1
,
sizeof
(
SDropDnodeMsg
));
pDrop
->
dnodeId
=
strtoll
(
pzName
->
z
,
&
end
,
10
);
*
len
=
sizeof
(
SDropDnodeMsg
);
if
(
end
-
pzName
->
z
!=
pzName
->
n
)
{
buildInvalidOperationMsg
(
pMsgBuf
,
"invalid dnode id"
);
tfree
(
pDrop
);
return
NULL
;
}
return
pDrop
;
}
source/libs/parser/src/dCDAstProcess.c
浏览文件 @
e6846049
...
@@ -710,13 +710,32 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
...
@@ -710,13 +710,32 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
}
}
case
TSDB_SQL_DROP_TABLE
:
{
case
TSDB_SQL_DROP_TABLE
:
{
pDcl
->
pMsg
=
(
char
*
)
buildDrop
T
ableMsg
(
pInfo
,
&
pDcl
->
msgLen
,
pCtx
,
pMsgBuf
);
pDcl
->
pMsg
=
(
char
*
)
buildDrop
St
ableMsg
(
pInfo
,
&
pDcl
->
msgLen
,
pCtx
,
pMsgBuf
);
if
(
pDcl
->
pMsg
==
NULL
)
{
if
(
pDcl
->
pMsg
==
NULL
)
{
return
terrno
;
code
=
terrno
;
}
}
pDcl
->
msgType
=
TDMT_MND_DROP_STB
;
pDcl
->
msgType
=
TDMT_MND_DROP_STB
;
return
TSDB_CODE_SUCCESS
;
break
;
}
case
TSDB_SQL_CREATE_DNODE
:
{
pDcl
->
pMsg
=
(
char
*
)
buildCreateDnodeMsg
(
pInfo
,
&
pDcl
->
msgLen
,
pMsgBuf
);
if
(
pDcl
->
pMsg
==
NULL
)
{
code
=
terrno
;
}
pDcl
->
msgType
=
TDMT_MND_CREATE_DNODE
;
break
;
}
case
TSDB_SQL_DROP_DNODE
:
{
pDcl
->
pMsg
=
(
char
*
)
buildDropDnodeMsg
(
pInfo
,
&
pDcl
->
msgLen
,
pMsgBuf
);
if
(
pDcl
->
pMsg
==
NULL
)
{
code
=
terrno
;
}
pDcl
->
msgType
=
TDMT_MND_DROP_DNODE
;
break
;
break
;
}
}
...
...
source/libs/parser/src/parser.c
浏览文件 @
e6846049
...
@@ -44,11 +44,12 @@ int32_t parseQuerySql(SParseContext* pCxt, SQueryNode** pQuery) {
...
@@ -44,11 +44,12 @@ int32_t parseQuerySql(SParseContext* pCxt, SQueryNode** pQuery) {
}
}
if
(
!
isDqlSqlStatement
(
&
info
))
{
if
(
!
isDqlSqlStatement
(
&
info
))
{
SDclStmtInfo
*
pDcl
=
calloc
(
1
,
sizeof
(
S
Query
StmtInfo
));
SDclStmtInfo
*
pDcl
=
calloc
(
1
,
sizeof
(
S
Dcl
StmtInfo
));
if
(
NULL
==
pDcl
)
{
if
(
NULL
==
pDcl
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
// set correct error code.
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
// set correct error code.
return
terrno
;
return
terrno
;
}
}
pDcl
->
nodeType
=
info
.
type
;
pDcl
->
nodeType
=
info
.
type
;
int32_t
code
=
qParserValidateDclSqlNode
(
&
info
,
&
pCxt
->
ctx
,
pDcl
,
pCxt
->
pMsg
,
pCxt
->
msgLen
);
int32_t
code
=
qParserValidateDclSqlNode
(
&
info
,
&
pCxt
->
ctx
,
pDcl
,
pCxt
->
pMsg
,
pCxt
->
msgLen
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录