Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9cb7efee
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9cb7efee
编写于
9月 25, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1603]
上级
b2dd094f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
30 deletion
+36
-30
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+36
-30
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
9cb7efee
...
...
@@ -233,8 +233,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
else
if
(
pInfo
->
type
==
TSDB_SQL_DROP_TABLE
)
{
assert
(
pInfo
->
pDCLInfo
->
nTokens
==
1
);
code
=
tscSetTableFullName
(
pTableMetaInfo
,
pzName
,
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
((
code
=
tscSetTableFullName
(
pTableMetaInfo
,
pzName
,
pSql
))
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
}
else
if
(
pInfo
->
type
==
TSDB_SQL_DROP_DNODE
)
{
...
...
@@ -362,8 +361,9 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
// additional msg has been attached already
if
(
tscSetTableFullName
(
pTableMetaInfo
,
pToken
,
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
code
=
tscSetTableFullName
(
pTableMetaInfo
,
pToken
,
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
return
tscGetTableMeta
(
pSql
,
pTableMetaInfo
);
...
...
@@ -381,14 +381,15 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
if
(
tscSetTableFullName
(
pTableMetaInfo
,
pToken
,
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
code
=
tscSetTableFullName
(
pTableMetaInfo
,
pToken
,
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
return
tscGetTableMeta
(
pSql
,
pTableMetaInfo
);
}
case
TSDB_SQL_SHOW_CREATE_DATABASE
:
{
const
char
*
msg1
=
"invalid database name"
;
const
char
*
msg2
=
"table name is too long"
;
SStrToken
*
pToken
=
&
pInfo
->
pDCLInfo
->
a
[
0
];
if
(
tscValidateName
(
pToken
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -397,11 +398,9 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
if
(
pToken
->
n
>
TSDB_DB_NAME_LEN
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
tscSetTableFullName
(
pTableMetaInfo
,
pToken
,
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
return
TSDB_CODE_SUCCESS
;
}
return
tscSetTableFullName
(
pTableMetaInfo
,
pToken
,
pSql
);
}
case
TSDB_SQL_CFG_DNODE
:
{
const
char
*
msg2
=
"invalid configure options or values, such as resetlog / debugFlag 135 / balance 'vnode:2-dnode:2' / monitor 1 "
;
const
char
*
msg3
=
"invalid dnode ep"
;
...
...
@@ -4555,6 +4554,8 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const
char
*
msg18
=
"primary timestamp column cannot be dropped"
;
const
char
*
msg19
=
"invalid new tag name"
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SAlterTableSQL
*
pAlterSQL
=
pInfo
->
pAlterInfo
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
...
...
@@ -4565,13 +4566,14 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
tscSetTableFullName
(
pTableMetaInfo
,
&
(
pAlterSQL
->
name
),
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
code
=
tscSetTableFullName
(
pTableMetaInfo
,
&
(
pAlterSQL
->
name
),
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
int32_t
ret
=
tscGetTableMeta
(
pSql
,
pTableMetaInfo
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
code
=
tscGetTableMeta
(
pSql
,
pTableMetaInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
...
...
@@ -5869,8 +5871,9 @@ int32_t doCheckForCreateTable(SSqlObj* pSql, int32_t subClauseIndex, SSqlInfo* p
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
tscSetTableFullName
(
pTableMetaInfo
,
pzTableName
,
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
int32_t
code
=
tscSetTableFullName
(
pTableMetaInfo
,
pzTableName
,
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
if
(
!
validateTableColumnInfo
(
pFieldList
,
pCmd
)
||
...
...
@@ -5924,15 +5927,16 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
tscSetTableFullName
(
pStableMeterMetaInfo
,
pToken
,
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
int32_t
code
=
tscSetTableFullName
(
pStableMeterMetaInfo
,
pToken
,
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
// get meter meta from mnode
tstrncpy
(
pCreateTable
->
usingInfo
.
tagdata
.
name
,
pStableMeterMetaInfo
->
name
,
sizeof
(
pCreateTable
->
usingInfo
.
tagdata
.
name
));
tVariantList
*
pList
=
pInfo
->
pCreateTableInfo
->
usingInfo
.
pTagVals
;
int32_t
code
=
tscGetTableMeta
(
pSql
,
pStableMeterMetaInfo
);
code
=
tscGetTableMeta
(
pSql
,
pStableMeterMetaInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -6009,7 +6013,6 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
int32_t
doCheckForStream
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
const
char
*
msg1
=
"invalid table name"
;
const
char
*
msg2
=
"table name too long"
;
const
char
*
msg3
=
"fill only available for interval query"
;
const
char
*
msg4
=
"fill option not supported in stream computing"
;
const
char
*
msg5
=
"sql too long"
;
// todo ADD support
...
...
@@ -6041,11 +6044,12 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) {
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
tscSetTableFullName
(
pTableMetaInfo
,
&
srcToken
,
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
int32_t
code
=
tscSetTableFullName
(
pTableMetaInfo
,
&
srcToken
,
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
int32_t
code
=
tscGetTableMeta
(
pSql
,
pTableMetaInfo
);
code
=
tscGetTableMeta
(
pSql
,
pTableMetaInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -6072,8 +6076,9 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) {
}
// set the created table[stream] name
if
(
tscSetTableFullName
(
pTableMetaInfo
,
pzTableName
,
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
code
=
tscSetTableFullName
(
pTableMetaInfo
,
pzTableName
,
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
if
(
pQuerySql
->
selectToken
.
n
>
TSDB_MAX_SAVED_SQL_LEN
)
{
...
...
@@ -6189,8 +6194,9 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) {
STableMetaInfo
*
pTableMetaInfo1
=
tscGetMetaInfo
(
pQueryInfo
,
i
/
2
);
SStrToken
t
=
{.
type
=
TSDB_DATA_TYPE_BINARY
,
.
n
=
pTableItem
->
nLen
,
.
z
=
pTableItem
->
pz
};
if
(
tscSetTableFullName
(
pTableMetaInfo1
,
&
t
,
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
code
=
tscSetTableFullName
(
pTableMetaInfo1
,
&
t
,
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
tVariant
*
pTableItem1
=
&
pQuerySql
->
from
->
a
[
i
+
1
].
pVar
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录