Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ec18dee1
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看板
提交
ec18dee1
编写于
12月 28, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] fix bug.
上级
76154f58
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
29 addition
and
16 deletion
+29
-16
include/libs/parser/parsenodes.h
include/libs/parser/parsenodes.h
+6
-5
include/libs/parser/parser.h
include/libs/parser/parser.h
+0
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+18
-3
source/libs/parser/src/dCDAstProcess.c
source/libs/parser/src/dCDAstProcess.c
+1
-3
source/libs/parser/src/insertParser.c
source/libs/parser/src/insertParser.c
+2
-2
source/libs/parser/test/parserTests.cpp
source/libs/parser/test/parserTests.cpp
+2
-2
未找到文件。
include/libs/parser/parsenodes.h
浏览文件 @
ec18dee1
...
...
@@ -44,11 +44,12 @@ typedef struct SField {
}
SField
;
typedef
struct
SParseBasicCtx
{
const
char
*
db
;
int32_t
acctId
;
uint64_t
requestId
;
void
*
pTransporter
;
SEpSet
mgmtEpSet
;
uint64_t
requestId
;
int32_t
acctId
;
const
char
*
db
;
void
*
pTransporter
;
SEpSet
mgmtEpSet
;
struct
SCatalog
*
pCatalog
;
}
SParseBasicCtx
;
typedef
struct
SFieldInfo
{
...
...
include/libs/parser/parser.h
浏览文件 @
ec18dee1
...
...
@@ -24,7 +24,6 @@ extern "C" {
typedef
struct
SParseContext
{
SParseBasicCtx
ctx
;
struct
SCatalog
*
pCatalog
;
int8_t
schemaAttached
;
// denote if submit block is built with table schema or not
const
char
*
pSql
;
// sql string
size_t
sqlLen
;
// length of the sql string
...
...
source/client/src/clientImpl.c
浏览文件 @
ec18dee1
...
...
@@ -145,17 +145,32 @@ int32_t buildRequest(STscObj *pTscObj, const char *sql, int sqlLen, SRequestObj*
}
int32_t
parseSql
(
SRequestObj
*
pRequest
,
SQueryNode
**
pQuery
)
{
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SParseContext
cxt
=
{
.
ctx
=
{.
requestId
=
pRequest
->
requestId
,
.
acctId
=
p
Request
->
pTscObj
->
acctId
,
.
db
=
getConnectionDB
(
pRequest
->
pTscObj
),
.
pTransporter
=
pRequest
->
pTscObj
->
pTransporter
},
.
ctx
=
{.
requestId
=
pRequest
->
requestId
,
.
acctId
=
p
TscObj
->
acctId
,
.
db
=
getConnectionDB
(
pTscObj
),
.
pTransporter
=
pTscObj
->
pTransporter
},
.
pSql
=
pRequest
->
sqlstr
,
.
sqlLen
=
pRequest
->
sqlLen
,
.
pMsg
=
pRequest
->
msgBuf
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
};
cxt
.
ctx
.
mgmtEpSet
=
getEpSet_s
(
&
pRequest
->
pTscObj
->
pAppInfo
->
mgmtEp
);
cxt
.
ctx
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
// todo OPT performance
char
buf
[
12
]
=
{
0
};
sprintf
(
buf
,
"%"
PRId64
,
pTscObj
->
pAppInfo
->
clusterId
);
struct
SCatalog
*
pCatalog
=
NULL
;
int32_t
code
=
catalogGetHandle
(
buf
,
&
pCatalog
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
cxt
.
ctx
.
db
);
return
code
;
}
cxt
.
ctx
.
pCatalog
=
pCatalog
;
code
=
qParseQuerySql
(
&
cxt
,
pQuery
);
int32_t
code
=
qParseQuerySql
(
&
cxt
,
pQuery
);
tfree
(
cxt
.
ctx
.
db
);
return
code
;
}
...
...
source/libs/parser/src/dCDAstProcess.c
浏览文件 @
ec18dee1
...
...
@@ -323,12 +323,10 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx *pCtx, SMsgBuf* p
size_t
valSize
=
taosArrayGetSize
(
pValList
);
STableMeta
*
pSuperTableMeta
=
NULL
;
struct
SCatalog
*
pCatalog
=
NULL
;
char
dbName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
name
,
dbName
);
catalogGetTableMeta
(
pCatalog
,
pCtx
->
pTransporter
,
&
pCtx
->
mgmtEpSet
,
dbName
,
pCreateTableInfo
->
tagdata
.
name
,
&
pSuperTableMeta
);
catalogGetTableMeta
(
pC
tx
->
pC
atalog
,
pCtx
->
pTransporter
,
&
pCtx
->
mgmtEpSet
,
dbName
,
pCreateTableInfo
->
tagdata
.
name
,
&
pSuperTableMeta
);
// too long tag values will return invalid sql, not be truncated automatically
SSchema
*
pTagSchema
=
getTableTagSchema
(
pSuperTableMeta
);
...
...
source/libs/parser/src/insertParser.c
浏览文件 @
ec18dee1
...
...
@@ -173,9 +173,9 @@ static int32_t getTableMeta(SInsertParseContext* pCxt, SToken* pTname) {
char
fullDbName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
char
tableName
[
TSDB_TABLE_NAME_LEN
]
=
{
0
};
CHECK_CODE
(
buildName
(
pCxt
,
pTname
,
fullDbName
,
tableName
));
CHECK_CODE
(
catalogGetTableMeta
(
pCxt
->
pComCxt
->
pCatalog
,
pCxt
->
pComCxt
->
ctx
.
pTransporter
,
&
pCxt
->
pComCxt
->
ctx
.
mgmtEpSet
,
fullDbName
,
tableName
,
&
pCxt
->
pTableMeta
));
CHECK_CODE
(
catalogGetTableMeta
(
pCxt
->
pComCxt
->
ctx
.
pCatalog
,
pCxt
->
pComCxt
->
ctx
.
pTransporter
,
&
pCxt
->
pComCxt
->
ctx
.
mgmtEpSet
,
fullDbName
,
tableName
,
&
pCxt
->
pTableMeta
));
SVgroupInfo
vg
;
CHECK_CODE
(
catalogGetTableHashVgroup
(
pCxt
->
pComCxt
->
pCatalog
,
pCxt
->
pComCxt
->
ctx
.
pTransporter
,
&
pCxt
->
pComCxt
->
ctx
.
mgmtEpSet
,
fullDbName
,
tableName
,
&
vg
));
CHECK_CODE
(
catalogGetTableHashVgroup
(
pCxt
->
pComCxt
->
ctx
.
pCatalog
,
pCxt
->
pComCxt
->
ctx
.
pTransporter
,
&
pCxt
->
pComCxt
->
ctx
.
mgmtEpSet
,
fullDbName
,
tableName
,
&
vg
));
CHECK_CODE
(
taosHashPut
(
pCxt
->
pVgroupsHashObj
,
(
const
char
*
)
&
vg
.
vgId
,
sizeof
(
vg
.
vgId
),
(
char
*
)
&
vg
,
sizeof
(
vg
)));
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/parser/test/parserTests.cpp
浏览文件 @
ec18dee1
...
...
@@ -715,7 +715,7 @@ TEST(testCase, show_user_Test) {
ASSERT_EQ
(
info1
.
valid
,
true
);
SDclStmtInfo
output
;
SParseBasicCtx
ct
=
{.
db
=
"abc"
,
.
acctId
=
1
,
.
requestId
=
1
};
SParseBasicCtx
ct
=
{.
requestId
=
1
,
.
acctId
=
1
,
.
db
=
"abc"
,
.
pTransporter
=
NULL
};
int32_t
code
=
qParserValidateDclSqlNode
(
&
info1
,
&
ct
,
&
output
,
msg
,
buf
.
len
);
ASSERT_EQ
(
code
,
0
);
...
...
@@ -736,7 +736,7 @@ TEST(testCase, create_user_Test) {
ASSERT_EQ
(
isDclSqlStatement
(
&
info1
),
true
);
SDclStmtInfo
output
;
SParseBasicCtx
ct
=
{.
db
=
"abc"
,
.
acctId
=
1
,
.
requestId
=
1
};
SParseBasicCtx
ct
=
{.
requestId
=
1
,
.
acctId
=
1
,
.
db
=
"abc"
};
int32_t
code
=
qParserValidateDclSqlNode
(
&
info1
,
&
ct
,
&
output
,
msg
,
buf
.
len
);
ASSERT_EQ
(
code
,
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录