Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
77100ef1
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
77100ef1
编写于
12月 29, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make create table work
上级
dd4dd52e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
69 addition
and
64 deletion
+69
-64
source/libs/parser/src/dCDAstProcess.c
source/libs/parser/src/dCDAstProcess.c
+69
-64
未找到文件。
source/libs/parser/src/dCDAstProcess.c
浏览文件 @
77100ef1
...
...
@@ -17,7 +17,8 @@ static bool has(SArray* pFieldList, int32_t startIndex, const char* name) {
return
false
;
}
static
int32_t
setShowInfo
(
SShowInfo
*
pShowInfo
,
SParseBasicCtx
*
pCtx
,
void
**
output
,
int32_t
*
outputLen
,
SMsgBuf
*
pMsgBuf
)
{
static
int32_t
setShowInfo
(
SShowInfo
*
pShowInfo
,
SParseBasicCtx
*
pCtx
,
void
**
output
,
int32_t
*
outputLen
,
SMsgBuf
*
pMsgBuf
)
{
const
char
*
msg1
=
"invalid name"
;
const
char
*
msg2
=
"wildcard string should be less than %d characters"
;
const
char
*
msg3
=
"database name too long"
;
...
...
@@ -29,7 +30,7 @@ static int32_t setShowInfo(SShowInfo* pShowInfo, SParseBasicCtx *pCtx, void** ou
* database prefix in pInfo->pMiscInfo->a[0]
* wildcard in like clause in pInfo->pMiscInfo->a[1]
*/
int16_t
showType
=
pShowInfo
->
showType
;
int16_t
showType
=
pShowInfo
->
showType
;
if
(
showType
==
TSDB_MGMT_TABLE_STB
||
showType
==
TSDB_MGMT_TABLE_VGROUP
)
{
SToken
*
pDbPrefixToken
=
&
pShowInfo
->
prefix
;
if
(
pDbPrefixToken
->
type
!=
0
)
{
...
...
@@ -80,7 +81,7 @@ static int32_t setShowInfo(SShowInfo* pShowInfo, SParseBasicCtx *pCtx, void** ou
}
*
output
=
buildShowMsg
(
pShowInfo
,
pCtx
,
pMsgBuf
->
buf
,
pMsgBuf
->
len
);
*
outputLen
=
sizeof
(
SShowMsg
)
/* + htons(pShowMsg->payloadLen)*/
;
*
outputLen
=
sizeof
(
SShowMsg
)
/* + htons(pShowMsg->payloadLen)*/
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -116,8 +117,8 @@ static int32_t doCheckDbOptions(SCreateDbMsg* pCreate, SMsgBuf* pMsgBuf) {
int32_t
val
=
htonl
(
pCreate
->
daysPerFile
);
if
(
val
!=
-
1
&&
(
val
<
TSDB_MIN_DAYS_PER_FILE
||
val
>
TSDB_MAX_DAYS_PER_FILE
))
{
snprintf
(
msg
,
tListLen
(
msg
),
"invalid db option daysPerFile: %d valid range: [%d, %d]"
,
val
,
TSDB_M
IN_DAYS_PER_FILE
,
TSDB_M
AX_DAYS_PER_FILE
);
snprintf
(
msg
,
tListLen
(
msg
),
"invalid db option daysPerFile: %d valid range: [%d, %d]"
,
val
,
TSDB_MIN_DAYS_PER_FILE
,
TSDB_MAX_DAYS_PER_FILE
);
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg
);
}
...
...
@@ -137,15 +138,15 @@ static int32_t doCheckDbOptions(SCreateDbMsg* pCreate, SMsgBuf* pMsgBuf) {
val
=
htonl
(
pCreate
->
commitTime
);
if
(
val
!=
-
1
&&
(
val
<
TSDB_MIN_COMMIT_TIME
||
val
>
TSDB_MAX_COMMIT_TIME
))
{
snprintf
(
msg
,
tListLen
(
msg
),
"invalid db option commitTime: %d valid range: [%d, %d]"
,
val
,
TSDB_M
IN_COMMIT_TIME
,
TSDB_M
AX_COMMIT_TIME
);
snprintf
(
msg
,
tListLen
(
msg
),
"invalid db option commitTime: %d valid range: [%d, %d]"
,
val
,
TSDB_MIN_COMMIT_TIME
,
TSDB_MAX_COMMIT_TIME
);
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg
);
}
val
=
htonl
(
pCreate
->
fsyncPeriod
);
if
(
val
!=
-
1
&&
(
val
<
TSDB_MIN_FSYNC_PERIOD
||
val
>
TSDB_MAX_FSYNC_PERIOD
))
{
snprintf
(
msg
,
tListLen
(
msg
),
"invalid db option fsyncPeriod: %d valid range: [%d, %d]"
,
val
,
TSDB_M
IN_FSYNC_PERIOD
,
TSDB_M
AX_FSYNC_PERIOD
);
snprintf
(
msg
,
tListLen
(
msg
),
"invalid db option fsyncPeriod: %d valid range: [%d, %d]"
,
val
,
TSDB_MIN_FSYNC_PERIOD
,
TSDB_MAX_FSYNC_PERIOD
);
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg
);
}
...
...
@@ -284,7 +285,8 @@ int32_t doCheckForCreateTable(SSqlInfo* pInfo, SMsgBuf* pMsgBuf) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
doCheckForCreateCTable
(
SSqlInfo
*
pInfo
,
SParseBasicCtx
*
pCtx
,
SMsgBuf
*
pMsgBuf
,
char
**
pOutput
,
int32_t
*
len
,
SEpSet
*
pEpSet
)
{
int32_t
doCheckForCreateCTable
(
SSqlInfo
*
pInfo
,
SParseBasicCtx
*
pCtx
,
SMsgBuf
*
pMsgBuf
,
char
**
pOutput
,
int32_t
*
len
,
SEpSet
*
pEpSet
)
{
const
char
*
msg1
=
"invalid table name"
;
const
char
*
msg2
=
"tags number not matched"
;
const
char
*
msg3
=
"tag value too long"
;
...
...
@@ -293,13 +295,13 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
SCreateTableSql
*
pCreateTable
=
pInfo
->
pCreateTableInfo
;
// super table name, create table by using dst
int32_t
numOfTables
=
(
int32_t
)
taosArrayGetSize
(
pCreateTable
->
childTableInfo
);
for
(
int32_t
j
=
0
;
j
<
numOfTables
;
++
j
)
{
int32_t
numOfTables
=
(
int32_t
)
taosArrayGetSize
(
pCreateTable
->
childTableInfo
);
for
(
int32_t
j
=
0
;
j
<
numOfTables
;
++
j
)
{
SCreatedTableInfo
*
pCreateTableInfo
=
taosArrayGet
(
pCreateTable
->
childTableInfo
,
j
);
SToken
*
pSTableNameToken
=
&
pCreateTableInfo
->
stbName
;
char
buf
[
TSDB_TABLE_FNAME_LEN
];
char
buf
[
TSDB_TABLE_FNAME_LEN
];
SToken
sTblToken
;
sTblToken
.
z
=
buf
;
...
...
@@ -315,7 +317,7 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
}
const
char
*
pStableName
=
tNameGetTableName
(
&
name
);
SArray
*
pValList
=
pCreateTableInfo
->
pTagVals
;
SArray
*
pValList
=
pCreateTableInfo
->
pTagVals
;
size_t
numOfInputTag
=
taosArrayGetSize
(
pValList
);
STableMeta
*
pSuperTableMeta
=
NULL
;
...
...
@@ -327,9 +329,9 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
assert
(
pSuperTableMeta
!=
NULL
);
// too long tag values will return invalid sql, not be truncated automatically
SSchema
*
pTagSchema
=
getTableTagSchema
(
pSuperTableMeta
);
SSchema
*
pTagSchema
=
getTableTagSchema
(
pSuperTableMeta
);
STableComInfo
tinfo
=
getTableInfo
(
pSuperTableMeta
);
STagData
*
pTag
=
&
pCreateTableInfo
->
tagdata
;
STagData
*
pTag
=
&
pCreateTableInfo
->
tagdata
;
SKVRowBuilder
kvRowBuilder
=
{
0
};
if
(
tdInitKVRowBuilder
(
&
kvRowBuilder
)
<
0
)
{
...
...
@@ -353,17 +355,17 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
for
(
int32_t
i
=
0
;
i
<
nameSize
;
++
i
)
{
SToken
*
sToken
=
taosArrayGet
(
pNameList
,
i
);
char
tmpTokenBuf
[
TSDB_MAX_BYTES_PER_ROW
]
=
{
0
};
// create tmp buf to avoid alter orginal sqlstr
char
tmpTokenBuf
[
TSDB_MAX_BYTES_PER_ROW
]
=
{
0
};
// create tmp buf to avoid alter orginal sqlstr
strncpy
(
tmpTokenBuf
,
sToken
->
z
,
sToken
->
n
);
sToken
->
z
=
tmpTokenBuf
;
// if (TK_STRING == sToken->type) {
// tscDequoteAndTrimToken(sToken);
// }
// if (TK_STRING == sToken->type) {
// tscDequoteAndTrimToken(sToken);
// }
// if (TK_ID == sToken->type) {
// tscRmEscapeAndTrimToken(sToken);
// }
// if (TK_ID == sToken->type) {
// tscRmEscapeAndTrimToken(sToken);
// }
SListItem
*
pItem
=
taosArrayGet
(
pValList
,
i
);
...
...
@@ -372,7 +374,7 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
// todo speedup by using hash list
for
(
int32_t
t
=
0
;
t
<
schemaSize
;
++
t
)
{
if
(
strncmp
(
sToken
->
z
,
pTagSchema
[
t
].
name
,
sToken
->
n
)
==
0
&&
strlen
(
pTagSchema
[
t
].
name
)
==
sToken
->
n
)
{
SSchema
*
pSchema
=
&
pTagSchema
[
t
];
SSchema
*
pSchema
=
&
pTagSchema
[
t
];
char
tagVal
[
TSDB_MAX_TAGS_LEN
]
=
{
0
};
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
...
...
@@ -382,10 +384,10 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
}
}
else
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
if
(
pItem
->
pVar
.
nType
==
TSDB_DATA_TYPE_BINARY
)
{
// code = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision);
// if (code != TSDB_CODE_SUCCESS) {
// return buildInvalidOperationMsg(pMsgBuf, msg4);
// }
// code = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision);
// if (code != TSDB_CODE_SUCCESS) {
// return buildInvalidOperationMsg(pMsgBuf, msg4);
// }
}
else
if
(
pItem
->
pVar
.
nType
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
pItem
->
pVar
.
i
=
convertTimePrecision
(
pItem
->
pVar
.
i
,
TSDB_TIME_PRECISION_NANO
,
tinfo
.
precision
);
}
...
...
@@ -416,7 +418,7 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
if
(
!
findColumnIndex
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
// return buildInvalidOperationMsg(pMsgBuf, "invalid tag name", sToken->z);
// return buildInvalidOperationMsg(pMsgBuf, "invalid tag name", sToken->z);
}
}
}
else
{
...
...
@@ -426,8 +428,8 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
}
for
(
int32_t
i
=
0
;
i
<
numOfInputTag
;
++
i
)
{
SSchema
*
pSchema
=
&
pTagSchema
[
i
];
SToken
*
pItem
=
taosArrayGet
(
pValList
,
i
);
SSchema
*
pSchema
=
&
pTagSchema
[
i
];
SToken
*
pItem
=
taosArrayGet
(
pValList
,
i
);
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pItem
->
n
>
pSchema
->
bytes
)
{
...
...
@@ -435,17 +437,17 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg3
);
}
}
else
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
// if (pItem->pVar.nType == TSDB_DATA_TYPE_BINARY) {
//// code = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision);
// if (code != TSDB_CODE_SUCCESS) {
// return buildInvalidOperationMsg(pMsgBuf, msg4);
// }
// } else if (pItem->pVar.nType == TSDB_DATA_TYPE_TIMESTAMP) {
// pItem->pVar.i = convertTimePrecision(pItem->pVar.i, TSDB_TIME_PRECISION_NANO, tinfo.precision);
// }
// if (pItem->pVar.nType == TSDB_DATA_TYPE_BINARY) {
//// code = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision);
// if (code != TSDB_CODE_SUCCESS) {
// return buildInvalidOperationMsg(pMsgBuf, msg4);
// }
// } else if (pItem->pVar.nType == TSDB_DATA_TYPE_TIMESTAMP) {
// pItem->pVar.i = convertTimePrecision(pItem->pVar.i, TSDB_TIME_PRECISION_NANO, tinfo.precision);
// }
}
char
tmpTokenBuf
[
TSDB_MAX_TAGS_LEN
]
=
{
0
};
char
tmpTokenBuf
[
TSDB_MAX_TAGS_LEN
]
=
{
0
};
SKvParam
param
=
{.
builder
=
&
kvRowBuilder
,
.
schema
=
pSchema
};
char
*
endPtr
=
NULL
;
...
...
@@ -478,32 +480,35 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
req
.
ctbCfg
.
suid
=
pSuperTableMeta
->
suid
;
req
.
ctbCfg
.
pTag
=
row
;
int32_t
serLen
=
tSerializeSVCreateTbReq
(
NULL
,
&
req
);
char
*
buf1
=
calloc
(
1
,
serLen
);
char
*
p
=
buf1
;
tSerializeSVCreateTbReq
((
void
*
)
&
buf1
,
&
req
);
*
pOutput
=
p
;
int32_t
serLen
=
sizeof
(
SMsgHead
)
+
tSerializeSVCreateTbReq
(
NULL
,
&
req
);
char
*
buf1
=
calloc
(
1
,
serLen
);
*
pOutput
=
buf1
;
buf1
+=
sizeof
(
SMsgHead
);
tSerializeSVCreateTbReq
((
void
*
)
&
buf1
,
&
req
)
;
*
len
=
serLen
;
SVgroupInfo
info
=
{
0
};
catalogGetTableHashVgroup
(
pCtx
->
pCatalog
,
pCtx
->
pTransporter
,
&
pCtx
->
mgmtEpSet
,
dbName
,
req
.
name
,
&
info
);
pEpSet
->
inUse
=
info
.
inUse
;
pEpSet
->
inUse
=
info
.
inUse
;
pEpSet
->
numOfEps
=
info
.
numOfEps
;
for
(
int32_t
i
=
0
;
i
<
pEpSet
->
numOfEps
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pEpSet
->
numOfEps
;
++
i
)
{
pEpSet
->
port
[
i
]
=
info
.
epAddr
[
i
].
port
;
tstrncpy
(
pEpSet
->
fqdn
[
i
],
info
.
epAddr
[
i
].
fqdn
,
tListLen
(
pEpSet
->
fqdn
[
i
]));
}
((
SMsgHead
*
)(
*
pOutput
))
->
vgId
=
htonl
(
info
.
vgId
);
((
SMsgHead
*
)(
*
pOutput
))
->
contLen
=
htonl
(
serLen
);
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
qParserValidateDclSqlNode
(
SSqlInfo
*
pInfo
,
SParseBasicCtx
*
pCtx
,
SDclStmtInfo
*
pDcl
,
char
*
msgBuf
,
int32_t
msgBufLen
)
{
int32_t
qParserValidateDclSqlNode
(
SSqlInfo
*
pInfo
,
SParseBasicCtx
*
pCtx
,
SDclStmtInfo
*
pDcl
,
char
*
msgBuf
,
int32_t
msgBufLen
)
{
int32_t
code
=
0
;
SMsgBuf
m
=
{.
buf
=
msgBuf
,
.
len
=
msgBufLen
};
SMsgBuf
*
pMsgBuf
=
&
m
;
SMsgBuf
m
=
{.
buf
=
msgBuf
,
.
len
=
msgBufLen
};
SMsgBuf
*
pMsgBuf
=
&
m
;
switch
(
pInfo
->
type
)
{
case
TSDB_SQL_CREATE_USER
:
...
...
@@ -551,7 +556,7 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
}
pDcl
->
pMsg
=
(
char
*
)
buildUserManipulationMsg
(
pInfo
,
&
pDcl
->
msgLen
,
pCtx
->
requestId
,
msgBuf
,
msgBufLen
);
pDcl
->
msgType
=
(
pInfo
->
type
==
TSDB_SQL_CREATE_USER
)
?
TDMT_MND_CREATE_USER
:
TDMT_MND_ALTER_USER
;
pDcl
->
msgType
=
(
pInfo
->
type
==
TSDB_SQL_CREATE_USER
)
?
TDMT_MND_CREATE_USER
:
TDMT_MND_ALTER_USER
;
break
;
}
...
...
@@ -588,14 +593,14 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
}
pDcl
->
pMsg
=
(
char
*
)
buildAcctManipulationMsg
(
pInfo
,
&
pDcl
->
msgLen
,
pCtx
->
requestId
,
msgBuf
,
msgBufLen
);
pDcl
->
msgType
=
(
pInfo
->
type
==
TSDB_SQL_CREATE_ACCT
)
?
TDMT_MND_CREATE_ACCT
:
TDMT_MND_ALTER_ACCT
;
pDcl
->
msgType
=
(
pInfo
->
type
==
TSDB_SQL_CREATE_ACCT
)
?
TDMT_MND_CREATE_ACCT
:
TDMT_MND_ALTER_ACCT
;
break
;
}
case
TSDB_SQL_DROP_ACCT
:
case
TSDB_SQL_DROP_USER
:
{
pDcl
->
pMsg
=
(
char
*
)
buildDropUserMsg
(
pInfo
,
&
pDcl
->
msgLen
,
pCtx
->
requestId
,
msgBuf
,
msgBufLen
);
pDcl
->
msgType
=
(
pInfo
->
type
==
TSDB_SQL_DROP_ACCT
)
?
TDMT_MND_DROP_ACCT
:
TDMT_MND_DROP_USER
;
pDcl
->
msgType
=
(
pInfo
->
type
==
TSDB_SQL_DROP_ACCT
)
?
TDMT_MND_DROP_ACCT
:
TDMT_MND_DROP_USER
;
break
;
}
...
...
@@ -613,13 +618,13 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg
);
}
SName
n
=
{
0
};
SName
n
=
{
0
};
int32_t
ret
=
tNameSetDbName
(
&
n
,
pCtx
->
acctId
,
pToken
->
z
,
pToken
->
n
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg
);
}
SUseDbMsg
*
pUseDbMsg
=
(
SUseDbMsg
*
)
calloc
(
1
,
sizeof
(
SUseDbMsg
));
SUseDbMsg
*
pUseDbMsg
=
(
SUseDbMsg
*
)
calloc
(
1
,
sizeof
(
SUseDbMsg
));
tNameExtractFullName
(
&
n
,
pUseDbMsg
->
db
);
pDcl
->
pMsg
=
(
char
*
)
pUseDbMsg
;
...
...
@@ -638,7 +643,7 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg2
);
}
char
buf
[
TSDB_DB_NAME_LEN
]
=
{
0
};
char
buf
[
TSDB_DB_NAME_LEN
]
=
{
0
};
SToken
token
=
taosTokenDup
(
&
pCreateDB
->
dbname
,
buf
,
tListLen
(
buf
));
if
(
parserValidateNameToken
(
&
token
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -652,7 +657,7 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
pDcl
->
pMsg
=
(
char
*
)
pCreateMsg
;
pDcl
->
msgLen
=
sizeof
(
SCreateDbMsg
);
pDcl
->
msgType
=
(
pInfo
->
type
==
TSDB_SQL_CREATE_DB
)
?
TDMT_MND_CREATE_DB
:
TDMT_MND_ALTER_DB
;
pDcl
->
msgType
=
(
pInfo
->
type
==
TSDB_SQL_CREATE_DB
)
?
TDMT_MND_CREATE_DB
:
TDMT_MND_ALTER_DB
;
break
;
}
...
...
@@ -668,7 +673,7 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg1
);
}
SDropDbMsg
*
pDropDbMsg
=
(
SDropDbMsg
*
)
calloc
(
1
,
sizeof
(
SDropDbMsg
));
SDropDbMsg
*
pDropDbMsg
=
(
SDropDbMsg
*
)
calloc
(
1
,
sizeof
(
SDropDbMsg
));
code
=
tNameExtractFullName
(
&
name
,
pDropDbMsg
->
db
);
pDropDbMsg
->
ignoreNotExists
=
pInfo
->
pMiscInfo
->
existsCheck
?
1
:
0
;
...
...
@@ -688,9 +693,10 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
return
code
;
}
pDcl
->
pMsg
=
(
char
*
)
buildCreateTableMsg
(
pCreateTable
,
&
pDcl
->
msgLen
,
pCtx
,
pMsgBuf
);
pDcl
->
msgType
=
(
pCreateTable
->
type
==
TSQL_CREATE_TABLE
)
?
TDMT_VND_CREATE_TABLE
:
TDMT_MND_CREATE_STB
;
}
else
if
(
pCreateTable
->
type
==
TSQL_CREATE_CTABLE
)
{
if
((
code
=
doCheckForCreateCTable
(
pInfo
,
pCtx
,
pMsgBuf
,
&
pDcl
->
pMsg
,
&
pDcl
->
msgLen
,
&
pDcl
->
epSet
))
!=
TSDB_CODE_SUCCESS
)
{
pDcl
->
msgType
=
(
pCreateTable
->
type
==
TSQL_CREATE_TABLE
)
?
TDMT_VND_CREATE_TABLE
:
TDMT_MND_CREATE_STB
;
}
else
if
(
pCreateTable
->
type
==
TSQL_CREATE_CTABLE
)
{
if
((
code
=
doCheckForCreateCTable
(
pInfo
,
pCtx
,
pMsgBuf
,
&
pDcl
->
pMsg
,
&
pDcl
->
msgLen
,
&
pDcl
->
epSet
))
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -714,7 +720,7 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
}
case
TSDB_SQL_CREATE_DNODE
:
{
pDcl
->
pMsg
=
(
char
*
)
buildCreateDnodeMsg
(
pInfo
,
&
pDcl
->
msgLen
,
pMsgBuf
);
pDcl
->
pMsg
=
(
char
*
)
buildCreateDnodeMsg
(
pInfo
,
&
pDcl
->
msgLen
,
pMsgBuf
);
if
(
pDcl
->
pMsg
==
NULL
)
{
code
=
terrno
;
}
...
...
@@ -724,7 +730,7 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
}
case
TSDB_SQL_DROP_DNODE
:
{
pDcl
->
pMsg
=
(
char
*
)
buildDropDnodeMsg
(
pInfo
,
&
pDcl
->
msgLen
,
pMsgBuf
);
pDcl
->
pMsg
=
(
char
*
)
buildDropDnodeMsg
(
pInfo
,
&
pDcl
->
msgLen
,
pMsgBuf
);
if
(
pDcl
->
pMsg
==
NULL
)
{
code
=
terrno
;
}
...
...
@@ -739,4 +745,3 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
return
code
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录