Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c8946cdd
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看板
提交
c8946cdd
编写于
6月 15, 2022
作者:
B
Benguang Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: Support backquote escape for db names
上级
0797d353
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
138 addition
and
141 deletion
+138
-141
.gitignore
.gitignore
+1
-0
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+110
-119
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+18
-14
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+3
-3
src/plugins/monitor/src/monMain.c
src/plugins/monitor/src/monMain.c
+6
-5
未找到文件。
.gitignore
浏览文件 @
c8946cdd
...
@@ -5,6 +5,7 @@ build/
...
@@ -5,6 +5,7 @@ build/
cmake-build-debug/
cmake-build-debug/
cmake-build-release/
cmake-build-release/
cscope.out
cscope.out
cscope.files
.DS_Store
.DS_Store
debug/
debug/
release/
release/
...
...
src/client/src/tscSQLParser.c
浏览文件 @
c8946cdd
此差异已折叠。
点击以展开。
src/client/src/tscUtil.c
浏览文件 @
c8946cdd
...
@@ -1418,7 +1418,7 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue
...
@@ -1418,7 +1418,7 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue
};
};
SUdfInfo
*
pUdfInfo
=
NULL
;
SUdfInfo
*
pUdfInfo
=
NULL
;
size_t
size
=
tscNumOfExprs
(
px
);
size_t
size
=
tscNumOfExprs
(
px
);
for
(
int32_t
j
=
0
;
j
<
size
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
size
;
++
j
)
{
SExprInfo
*
pExprInfo
=
tscExprGet
(
px
,
j
);
SExprInfo
*
pExprInfo
=
tscExprGet
(
px
,
j
);
...
@@ -1429,7 +1429,7 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue
...
@@ -1429,7 +1429,7 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue
pSql
->
res
.
code
=
tscInvalidOperationMsg
(
pSql
->
cmd
.
payload
,
"only one udf allowed"
,
NULL
);
pSql
->
res
.
code
=
tscInvalidOperationMsg
(
pSql
->
cmd
.
payload
,
"only one udf allowed"
,
NULL
);
return
;
return
;
}
}
pUdfInfo
=
taosArrayGet
(
px
->
pUdfInfo
,
-
1
*
functionId
-
1
);
pUdfInfo
=
taosArrayGet
(
px
->
pUdfInfo
,
-
1
*
functionId
-
1
);
int32_t
code
=
initUdfInfo
(
pUdfInfo
);
int32_t
code
=
initUdfInfo
(
pUdfInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -1537,7 +1537,7 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue
...
@@ -1537,7 +1537,7 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue
px
->
pQInfo
->
runtimeEnv
.
udfIsCopy
=
true
;
px
->
pQInfo
->
runtimeEnv
.
udfIsCopy
=
true
;
px
->
pQInfo
->
runtimeEnv
.
pUdfInfo
=
pUdfInfo
;
px
->
pQInfo
->
runtimeEnv
.
pUdfInfo
=
pUdfInfo
;
tfree
(
schema
);
tfree
(
schema
);
// set the pRuntimeEnv for pSourceOperator
// set the pRuntimeEnv for pSourceOperator
...
@@ -2702,11 +2702,9 @@ int32_t tscExprTopBottomIndex(SQueryInfo* pQueryInfo){
...
@@ -2702,11 +2702,9 @@ int32_t tscExprTopBottomIndex(SQueryInfo* pQueryInfo){
SExprInfo
*
pExpr
=
tscExprGet
(
pQueryInfo
,
i
);
SExprInfo
*
pExpr
=
tscExprGet
(
pQueryInfo
,
i
);
if
(
pExpr
==
NULL
)
if
(
pExpr
==
NULL
)
continue
;
continue
;
if
(
pExpr
->
base
.
functionId
==
TSDB_FUNC_TOP
if
(
pExpr
->
base
.
functionId
==
TSDB_FUNC_TOP
||
pExpr
->
base
.
functionId
==
TSDB_FUNC_BOTTOM
||
||
pExpr
->
base
.
functionId
==
TSDB_FUNC_BOTTOM
pExpr
->
base
.
functionId
==
TSDB_FUNC_SAMPLE
||
pExpr
->
base
.
functionId
==
TSDB_FUNC_UNIQUE
||
||
pExpr
->
base
.
functionId
==
TSDB_FUNC_SAMPLE
pExpr
->
base
.
functionId
==
TSDB_FUNC_TAIL
)
{
||
pExpr
->
base
.
functionId
==
TSDB_FUNC_UNIQUE
||
pExpr
->
base
.
functionId
==
TSDB_FUNC_TAIL
)
{
return
i
;
return
i
;
}
}
}
}
...
@@ -3068,6 +3066,12 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
...
@@ -3068,6 +3066,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
;
int32_t
firstPartLen
=
pToken
->
n
;
pToken
->
z
=
sep
+
1
;
pToken
->
z
=
sep
+
1
;
...
@@ -4191,20 +4195,20 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) {
...
@@ -4191,20 +4195,20 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) {
}
}
int32_t
doInitSubState
(
SSqlObj
*
pSql
,
int32_t
numOfSubqueries
)
{
int32_t
doInitSubState
(
SSqlObj
*
pSql
,
int32_t
numOfSubqueries
)
{
//bug fix. Above doInitSubState level, the loop invocation with the same SSqlObj will be fail.
//
bug fix. Above doInitSubState level, the loop invocation with the same SSqlObj will be fail.
//
assert(pSql->subState.numOfSub == 0 && pSql->pSubs == NULL && pSql->subState.states == NULL);
//
assert(pSql->subState.numOfSub == 0 && pSql->pSubs == NULL && pSql->subState.states == NULL);
if
(
pSql
->
pSubs
)
{
if
(
pSql
->
pSubs
)
{
free
(
pSql
->
pSubs
);
free
(
pSql
->
pSubs
);
pSql
->
pSubs
=
NULL
;
pSql
->
pSubs
=
NULL
;
}
}
if
(
pSql
->
subState
.
states
)
{
if
(
pSql
->
subState
.
states
)
{
free
(
pSql
->
subState
.
states
);
free
(
pSql
->
subState
.
states
);
pSql
->
subState
.
states
=
NULL
;
pSql
->
subState
.
states
=
NULL
;
}
}
pSql
->
subState
.
numOfSub
=
numOfSubqueries
;
pSql
->
subState
.
numOfSub
=
numOfSubqueries
;
pSql
->
pSubs
=
calloc
(
pSql
->
subState
.
numOfSub
,
POINTER_BYTES
);
pSql
->
pSubs
=
calloc
(
pSql
->
subState
.
numOfSub
,
POINTER_BYTES
);
pSql
->
subState
.
states
=
calloc
(
pSql
->
subState
.
numOfSub
,
sizeof
(
int8_t
));
pSql
->
subState
.
states
=
calloc
(
pSql
->
subState
.
numOfSub
,
sizeof
(
int8_t
));
...
@@ -4230,7 +4234,7 @@ void executeQuery(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
...
@@ -4230,7 +4234,7 @@ void executeQuery(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
(
*
pSql
->
fp
)(
pSql
->
param
,
pSql
,
0
);
(
*
pSql
->
fp
)(
pSql
->
param
,
pSql
,
0
);
}
}
return
;
return
;
}
}
if
(
pSql
->
cmd
.
command
==
TSDB_SQL_SELECT
)
{
if
(
pSql
->
cmd
.
command
==
TSDB_SQL_SELECT
)
{
tscAddIntoSqlList
(
pSql
);
tscAddIntoSqlList
(
pSql
);
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
c8946cdd
...
@@ -148,7 +148,7 @@ void shellInit(SShellArguments *_args) {
...
@@ -148,7 +148,7 @@ void shellInit(SShellArguments *_args) {
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
#endif
#endif
return
;
return
;
}
}
...
@@ -335,7 +335,7 @@ void shellRunCommandOnServer(TAOS *con, char command[]) {
...
@@ -335,7 +335,7 @@ void shellRunCommandOnServer(TAOS *con, char command[]) {
int64_t
oresult
=
atomic_load_64
(
&
result
);
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
"
);
fprintf
(
stdout
,
"Database changed.
\n\n
"
);
fflush
(
stdout
);
fflush
(
stdout
);
...
@@ -1520,7 +1520,7 @@ int wsclient_print_data(int rows, TAOS_FIELD *fields, int cols, int64_t id, int
...
@@ -1520,7 +1520,7 @@ int wsclient_print_data(int rows, TAOS_FIELD *fields, int cols, int64_t id, int
if
(
*
pshowed_rows
==
DEFAULT_RES_SHOW_NUM
)
{
if
(
*
pshowed_rows
==
DEFAULT_RES_SHOW_NUM
)
{
free
(
recv_buffer
);
free
(
recv_buffer
);
return
0
;
return
0
;
}
}
for
(
int
c
=
0
;
c
<
cols
;
c
++
)
{
for
(
int
c
=
0
;
c
<
cols
;
c
++
)
{
pos
=
start
;
pos
=
start
;
pos
+=
i
*
fields
[
c
].
bytes
;
pos
+=
i
*
fields
[
c
].
bytes
;
...
...
src/plugins/monitor/src/monMain.c
浏览文件 @
c8946cdd
...
@@ -719,13 +719,14 @@ static int32_t monBuildMnodesTotalSql(char *sql) {
...
@@ -719,13 +719,14 @@ static int32_t monBuildMnodesTotalSql(char *sql) {
static
int32_t
monGetVgroupsTotalStats
(
char
*
dbName
,
int32_t
*
totalVgroups
,
static
int32_t
monGetVgroupsTotalStats
(
char
*
dbName
,
int32_t
*
totalVgroups
,
int32_t
*
totalVgroupsAlive
)
{
int32_t
*
totalVgroupsAlive
)
{
char
subsql
[
TSDB_DB_NAME_LEN
+
14
];
int
bufLen
=
TSDB_DB_NAME_LEN
+
16
;
char
subsql
[
bufLen
];
memset
(
subsql
,
0
,
sizeof
(
subsql
));
memset
(
subsql
,
0
,
sizeof
(
subsql
));
snprintf
(
subsql
,
TSDB_DB_NAME_LEN
+
13
,
"show %s
.vgroups"
,
dbName
);
snprintf
(
subsql
,
bufLen
-
1
,
"show `%s`
.vgroups"
,
dbName
);
TAOS_RES
*
result
=
taos_query
(
tsMonitor
.
conn
,
subsql
);
TAOS_RES
*
result
=
taos_query
(
tsMonitor
.
conn
,
subsql
);
int32_t
code
=
taos_errno
(
result
);
int32_t
code
=
taos_errno
(
result
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
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
;
TAOS_ROW
row
;
...
@@ -1110,11 +1111,11 @@ static uint32_t monBuildVgroupsInfoSql(char *sql, char *dbName) {
...
@@ -1110,11 +1111,11 @@ static uint32_t monBuildVgroupsInfoSql(char *sql, char *dbName) {
int64_t
ts
=
taosGetTimestampUs
();
int64_t
ts
=
taosGetTimestampUs
();
memset
(
sql
,
0
,
SQL_LENGTH
+
1
);
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
);
TAOS_RES
*
result
=
taos_query
(
tsMonitor
.
conn
,
sql
);
int32_t
code
=
taos_errno
(
result
);
int32_t
code
=
taos_errno
(
result
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
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
;
TAOS_ROW
row
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录