Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9556b5a7
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看板
提交
9556b5a7
编写于
6月 22, 2022
作者:
B
Benguang Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: support case sensitive names of dbs, stables, tables, columns and tags
上级
fe45e56c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
28 addition
and
32 deletion
+28
-32
.gitignore
.gitignore
+1
-0
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+2
-2
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+11
-22
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+6
-0
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+1
-1
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+2
-2
src/plugins/monitor/src/monMain.c
src/plugins/monitor/src/monMain.c
+5
-5
未找到文件。
.gitignore
浏览文件 @
9556b5a7
...
...
@@ -5,6 +5,7 @@ build/
cmake-build-debug/
cmake-build-release/
cscope.out
cscope.files
.DS_Store
debug/
release/
...
...
src/client/src/tscLocal.c
浏览文件 @
9556b5a7
...
...
@@ -533,8 +533,8 @@ static int32_t tscGetDBInfo(SCreateBuilder *builder, char *result) {
memset
(
buf
,
0
,
sizeof
(
buf
));
int32_t
*
lengths
=
taos_fetch_lengths
(
pSql
);
int32_t
ret
=
tscGetNthFieldResult
(
row
,
fields
,
lengths
,
0
,
buf
);
if
(
0
==
ret
&&
STR_NOCASE_EQUAL
(
buf
,
strlen
(
buf
),
builder
->
buf
,
strlen
(
builder
->
buf
)
))
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"CREATE DATABASE
%s
"
,
buf
);
if
(
0
==
ret
&&
0
==
strcmp
(
buf
,
builder
->
buf
))
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"CREATE DATABASE
`%s`
"
,
buf
);
for
(
int
i
=
1
;
i
<
num_fields
;
i
++
)
{
for
(
int
j
=
0
;
showColumns
[
j
][
0
]
!=
NULL
;
j
++
)
{
if
(
STR_NOCASE_EQUAL
(
fields
[
i
].
name
,
strlen
(
fields
[
i
].
name
),
showColumns
[
j
][
0
],
strlen
(
showColumns
[
j
][
0
])))
{
...
...
src/client/src/tscSQLParser.c
浏览文件 @
9556b5a7
...
...
@@ -606,8 +606,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
case
TSDB_SQL_DROP_TABLE
:
case
TSDB_SQL_DROP_USER
:
case
TSDB_SQL_DROP_ACCT
:
case
TSDB_SQL_DROP_DNODE
:
case
TSDB_SQL_DROP_DB
:
{
case
TSDB_SQL_DROP_DNODE
:
{
const
char
*
msg2
=
"invalid name"
;
const
char
*
msg3
=
"param name too long"
;
...
...
@@ -626,14 +625,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
}
if
(
pInfo
->
type
==
TSDB_SQL_DROP_DB
)
{
assert
(
taosArrayGetSize
(
pInfo
->
pMiscInfo
->
a
)
==
1
);
code
=
tNameSetDbName
(
&
pTableMetaInfo
->
name
,
getAccountId
(
pSql
),
pzName
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
else
if
(
pInfo
->
type
==
TSDB_SQL_DROP_TABLE
)
{
if
(
pInfo
->
type
==
TSDB_SQL_DROP_TABLE
)
{
assert
(
taosArrayGetSize
(
pInfo
->
pMiscInfo
->
a
)
==
1
);
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
&
sTblToken
,
pSql
,
dbIncluded
);
...
...
@@ -656,11 +648,12 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
break
;
}
case
TSDB_SQL_DROP_DB
:
case
TSDB_SQL_USE_DB
:
{
const
char
*
msg
=
"invalid db name"
;
SStrToken
*
pToken
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
if
(
tscValidateName
(
pToken
,
fals
e
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
pToken
,
tru
e
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
);
}
...
...
@@ -707,7 +700,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char
buf
[
TSDB_DB_NAME_LEN
]
=
{
0
};
SStrToken
token
=
taosTokenDup
(
&
pCreateDB
->
dbname
,
buf
,
tListLen
(
buf
));
if
(
tscValidateName
(
&
token
,
fals
e
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
&
token
,
tru
e
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
...
...
@@ -820,7 +813,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SStrToken
*
pToken
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
if
(
tscValidateName
(
pToken
,
fals
e
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
pToken
,
tru
e
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
...
...
@@ -1747,7 +1740,7 @@ int32_t validateOneTag(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMeta
);
for
(
int32_t
i
=
0
;
i
<
numOfTags
+
numOfCols
;
++
i
)
{
if
(
strnc
asec
mp
(
pTagField
->
name
,
pSchema
[
i
].
name
,
sizeof
(
pTagField
->
name
)
-
1
)
==
0
)
{
if
(
strncmp
(
pTagField
->
name
,
pSchema
[
i
].
name
,
sizeof
(
pTagField
->
name
)
-
1
)
==
0
)
{
//return tscErrorMsgWithCode(TSDB_CODE_TSC_DUP_COL_NAMES, tscGetErrorMsgPayload(pCmd), pTagField->name, NULL);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
"duplicated column names"
);
}
...
...
@@ -2214,10 +2207,6 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
hasDistinct
=
(
pItem
->
distinct
==
true
);
distIdx
=
hasDistinct
?
i
:
-
1
;
}
if
(
pItem
->
aliasName
!=
NULL
&&
validateColumnName
(
pItem
->
aliasName
)
!=
TSDB_CODE_SUCCESS
){
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg11
);
}
if
(
pItem
->
aliasName
!=
NULL
&&
strcasecmp
(
pItem
->
aliasName
,
DEFAULT_PRIMARY_TIMESTAMP_COL_NAME
)
==
0
){
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg11
);
}
...
...
@@ -3600,7 +3589,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
if
(
pDbPrefixToken
->
n
<=
0
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg5
);
}
if
(
tscValidateName
(
pDbPrefixToken
,
fals
e
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
pDbPrefixToken
,
tru
e
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
...
...
@@ -6043,13 +6032,13 @@ static int32_t getQueryTimeRange(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr
if
(
*
pExpr
==
NULL
)
{
return
ret
;
}
//multiple tables's query time range mixed together
tExprNode
*
p
=
NULL
;
void
*
filter
=
NULL
;
SArray
*
colList
=
taosArrayInit
(
10
,
sizeof
(
SColIndex
));
SArray
*
colList
=
taosArrayInit
(
10
,
sizeof
(
SColIndex
));
ret
=
exprTreeFromSqlExpr
(
pCmd
,
&
p
,
*
pExpr
,
pQueryInfo
,
colList
,
NULL
);
taosArrayDestroy
(
&
colList
);
...
...
src/client/src/tscUtil.c
浏览文件 @
9556b5a7
...
...
@@ -3035,6 +3035,12 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
}
}
if
(
escapeEnabled
&&
pToken
->
type
==
TK_ID
)
{
if
(
pToken
->
z
[
0
]
==
TS_BACKQUOTE_CHAR
)
{
pToken
->
n
=
stringProcess
(
pToken
->
z
,
pToken
->
n
);
firstPartQuote
=
true
;
}
}
int32_t
firstPartLen
=
pToken
->
n
;
pToken
->
z
=
sep
+
1
;
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
9556b5a7
...
...
@@ -301,7 +301,7 @@ void shellRunCommandOnServer(TAOS *con, char command[]) {
int64_t
oresult
=
atomic_load_64
(
&
result
);
if
(
regex_match
(
command
,
"^
\\
s*use
\\
s+
[a-zA-Z0-9_]+
\\
s*;
\\
s*$"
,
REG_EXTENDED
|
REG_ICASE
))
{
if
(
regex_match
(
command
,
"^
\\
s*use
\\
s+
([a-zA-Z0-9_]+|`.+`)
\\
s*;
\\
s*$"
,
REG_EXTENDED
|
REG_ICASE
))
{
fprintf
(
stdout
,
"Database changed.
\n\n
"
);
fflush
(
stdout
);
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
9556b5a7
...
...
@@ -1225,7 +1225,7 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
static
int32_t
mnodeFindSuperTableTagIndex
(
SSTableObj
*
pStable
,
const
char
*
tagName
)
{
SSchema
*
schema
=
(
SSchema
*
)
pStable
->
schema
;
for
(
int32_t
tag
=
0
;
tag
<
pStable
->
numOfTags
;
tag
++
)
{
if
(
strc
asec
mp
(
schema
[
pStable
->
numOfColumns
+
tag
].
name
,
tagName
)
==
0
)
{
if
(
strcmp
(
schema
[
pStable
->
numOfColumns
+
tag
].
name
,
tagName
)
==
0
)
{
return
tag
;
}
}
...
...
@@ -1378,7 +1378,7 @@ static int32_t mnodeModifySuperTableTagName(SMnodeMsg *pMsg, char *oldTagName, c
static
int32_t
mnodeFindSuperTableColumnIndex
(
SSTableObj
*
pStable
,
char
*
colName
)
{
SSchema
*
schema
=
(
SSchema
*
)
pStable
->
schema
;
for
(
int32_t
col
=
0
;
col
<
pStable
->
numOfColumns
;
col
++
)
{
if
(
strc
asec
mp
(
schema
[
col
].
name
,
colName
)
==
0
)
{
if
(
strcmp
(
schema
[
col
].
name
,
colName
)
==
0
)
{
return
col
;
}
}
...
...
src/plugins/monitor/src/monMain.c
浏览文件 @
9556b5a7
...
...
@@ -719,13 +719,13 @@ static int32_t monBuildMnodesTotalSql(char *sql) {
static
int32_t
monGetVgroupsTotalStats
(
char
*
dbName
,
int32_t
*
totalVgroups
,
int32_t
*
totalVgroupsAlive
)
{
char
subsql
[
TSDB_DB_NAME_LEN
+
1
4
];
char
subsql
[
TSDB_DB_NAME_LEN
+
1
6
];
memset
(
subsql
,
0
,
sizeof
(
subsql
));
snprintf
(
subsql
,
TSDB_DB_NAME_LEN
+
13
,
"show %s
.vgroups"
,
dbName
);
snprintf
(
subsql
,
sizeof
(
subsql
)
-
1
,
"show `%s`
.vgroups"
,
dbName
);
TAOS_RES
*
result
=
taos_query
(
tsMonitor
.
conn
,
subsql
);
int32_t
code
=
taos_errno
(
result
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
monError
(
"failed to execute cmd: show
%s
.vgroups, reason:%s"
,
dbName
,
tstrerror
(
code
));
monError
(
"failed to execute cmd: show
`%s`
.vgroups, reason:%s"
,
dbName
,
tstrerror
(
code
));
}
TAOS_ROW
row
;
...
...
@@ -1110,11 +1110,11 @@ static uint32_t monBuildVgroupsInfoSql(char *sql, char *dbName) {
int64_t
ts
=
taosGetTimestampUs
();
memset
(
sql
,
0
,
SQL_LENGTH
+
1
);
snprintf
(
sql
,
SQL_LENGTH
,
"show
%s
.vgroups"
,
dbName
);
snprintf
(
sql
,
SQL_LENGTH
,
"show
`%s`
.vgroups"
,
dbName
);
TAOS_RES
*
result
=
taos_query
(
tsMonitor
.
conn
,
sql
);
int32_t
code
=
taos_errno
(
result
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
monError
(
"failed to execute cmd: show
%s
.vgroups, reason:%s"
,
dbName
,
tstrerror
(
code
));
monError
(
"failed to execute cmd: show
`%s`
.vgroups, reason:%s"
,
dbName
,
tstrerror
(
code
));
}
TAOS_ROW
row
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录