Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
a66106ea
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a66106ea
编写于
5月 10, 2021
作者:
H
haojun Liao
提交者:
GitHub
5月 10, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6069 from taosdata/hotfix/TD-4119
Hotfix/td 4119
上级
598a72e9
1729bc75
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
19 addition
and
30 deletion
+19
-30
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+17
-28
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+1
-1
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+1
-1
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
a66106ea
...
...
@@ -64,7 +64,7 @@ static char* getAccountId(SSqlObj* pSql);
static
bool
has
(
SArray
*
pFieldList
,
int32_t
startIdx
,
const
char
*
name
);
static
char
*
cloneCurrentDBName
(
SSqlObj
*
pSql
);
static
bool
hasSpecifyDB
(
SStrToken
*
pTableName
);
static
int32_t
getDelimiterIndex
(
SStrToken
*
pTableName
);
static
bool
validateTableColumnInfo
(
SArray
*
pFieldList
,
SSqlCmd
*
pCmd
);
static
bool
validateTagParams
(
SArray
*
pTagsList
,
SArray
*
pFieldList
,
SSqlCmd
*
pCmd
);
...
...
@@ -426,17 +426,11 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
case
TSDB_SQL_DESCRIBE_TABLE
:
{
const
char
*
msg1
=
"invalid table name"
;
const
char
*
msg2
=
"table name too long"
;
SStrToken
*
pToken
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
if
(
tscValidateName
(
pToken
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
!
tscValidateTableNameLength
(
pToken
->
n
))
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
// additional msg has been attached already
code
=
tscSetTableFullName
(
pTableMetaInfo
,
pToken
,
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -447,17 +441,12 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
case
TSDB_SQL_SHOW_CREATE_TABLE
:
{
const
char
*
msg1
=
"invalid table name"
;
const
char
*
msg2
=
"table name is too long"
;
SStrToken
*
pToken
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
if
(
tscValidateName
(
pToken
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
!
tscValidateTableNameLength
(
pToken
->
n
))
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
code
=
tscSetTableFullName
(
pTableMetaInfo
,
pToken
,
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
...
...
@@ -987,11 +976,13 @@ int32_t tscSetTableFullName(STableMetaInfo* pTableMetaInfo, SStrToken* pTableNam
const
char
*
msg1
=
"name too long"
;
const
char
*
msg2
=
"acctId too long"
;
const
char
*
msg3
=
"no acctId"
;
const
char
*
msg4
=
"db name too long"
;
const
char
*
msg5
=
"table name too long"
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
hasSpecifyDB
(
pTableName
)
)
{
// db has been specified in sql string so we ignore current db path
int32_t
idx
=
getDelimiterIndex
(
pTableName
);
if
(
idx
!=
-
1
)
{
// db has been specified in sql string so we ignore current db path
char
*
acctId
=
getAccountId
(
pSql
);
if
(
acctId
==
NULL
||
strlen
(
acctId
)
<=
0
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
...
...
@@ -1001,6 +992,13 @@ int32_t tscSetTableFullName(STableMetaInfo* pTableMetaInfo, SStrToken* pTableNam
if
(
code
!=
0
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
if
(
idx
>=
TSDB_DB_NAME_LEN
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
if
(
pTableName
->
n
-
1
-
idx
>=
TSDB_TABLE_NAME_LEN
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg5
);
}
char
name
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
strncpy
(
name
,
pTableName
->
z
,
pTableName
->
n
);
...
...
@@ -1345,14 +1343,13 @@ static char* cloneCurrentDBName(SSqlObj* pSql) {
}
/* length limitation, strstr cannot be applied */
static
bool
hasSpecifyDB
(
SStrToken
*
pTableName
)
{
static
int32_t
getDelimiterIndex
(
SStrToken
*
pTableName
)
{
for
(
uint32_t
i
=
0
;
i
<
pTableName
->
n
;
++
i
)
{
if
(
pTableName
->
z
[
i
]
==
TS_PATH_DELIMITER
[
0
])
{
return
true
;
return
i
;
}
}
return
false
;
return
-
1
;
}
int32_t
setObjFullName
(
char
*
fullName
,
const
char
*
account
,
SStrToken
*
pDB
,
SStrToken
*
tableName
,
int32_t
*
xlen
)
{
...
...
@@ -7483,11 +7480,3 @@ bool hasNormalColumnFilter(SQueryInfo* pQueryInfo) {
return
false
;
}
src/mnode/inc/mnodeDef.h
浏览文件 @
a66106ea
...
...
@@ -249,7 +249,7 @@ typedef struct SAcctObj {
}
SAcctObj
;
typedef
struct
{
char
db
[
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_
ACCT_ID_LEN
+
TSDB_
DB_NAME_LEN
];
int8_t
type
;
int16_t
numOfColumns
;
int32_t
index
;
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
a66106ea
...
...
@@ -129,7 +129,7 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
SShowObj
*
pShow
=
calloc
(
1
,
showObjSize
);
pShow
->
type
=
pShowMsg
->
type
;
pShow
->
payloadLen
=
htons
(
pShowMsg
->
payloadLen
);
tstrncpy
(
pShow
->
db
,
pShowMsg
->
db
,
TSDB_DB_NAME_LEN
);
tstrncpy
(
pShow
->
db
,
pShowMsg
->
db
,
TSDB_
ACCT_ID_LEN
+
TSDB_
DB_NAME_LEN
);
memcpy
(
pShow
->
payload
,
pShowMsg
->
payload
,
pShow
->
payloadLen
);
pShow
=
mnodePutShowObj
(
pShow
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录