Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ebc1fd6c
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看板
提交
ebc1fd6c
编写于
9月 23, 2021
作者:
W
wpan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support escape string as table name
上级
694132ed
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
691 addition
and
559 deletion
+691
-559
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+2
-2
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+37
-16
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+4
-2
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+18
-8
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+63
-36
src/client/src/tscServer.c
src/client/src/tscServer.c
+3
-3
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+36
-17
src/common/inc/tname.h
src/common/inc/tname.h
+2
-0
src/common/src/tname.c
src/common/src/tname.c
+43
-5
src/inc/taosdef.h
src/inc/taosdef.h
+1
-0
src/inc/ttokendef.h
src/inc/ttokendef.h
+1
-0
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+1
-1
src/query/inc/sql.y
src/query/inc/sql.y
+2
-0
src/query/src/sql.c
src/query/src/sql.c
+476
-468
src/query/tests/unitTest.cpp
src/query/tests/unitTest.cpp
+1
-1
tests/script/fullGeneralSuite.sim
tests/script/fullGeneralSuite.sim
+1
-0
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
ebc1fd6c
...
...
@@ -169,7 +169,7 @@ bool tscQueryBlockInfo(SQueryInfo* pQueryInfo);
SExprInfo
*
tscAddFuncInSelectClause
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputColIndex
,
int16_t
functionId
,
SColumnIndex
*
pIndex
,
SSchema
*
pColSchema
,
int16_t
colType
,
int16_t
colId
);
int32_t
tscSetTableFullName
(
SName
*
pName
,
SStrToken
*
pzTableName
,
SSqlObj
*
pSql
);
int32_t
tscSetTableFullName
(
SName
*
pName
,
SStrToken
*
pzTableName
,
SSqlObj
*
pSql
,
bool
dbIncluded
);
void
tscClearInterpInfo
(
SQueryInfo
*
pQueryInfo
);
bool
tscIsInsertData
(
char
*
sqlstr
);
...
...
@@ -240,7 +240,7 @@ void tscColumnListCopyAll(SArray* dst, const SArray* src);
void
convertQueryResult
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
,
uint64_t
objId
,
bool
convertNchar
);
void
tscDequoteAndTrimToken
(
SStrToken
*
pToken
);
int32_t
tscValidateName
(
SStrToken
*
pToken
,
bool
escapeEnabled
);
int32_t
tscValidateName
(
SStrToken
*
pToken
,
bool
escapeEnabled
,
bool
*
dbIncluded
);
void
tscIncStreamExecutionCount
(
void
*
pStream
);
...
...
src/client/src/tscParseInsert.c
浏览文件 @
ebc1fd6c
...
...
@@ -898,6 +898,18 @@ static int32_t doParseInsertStatement(SInsertStatementParam *pInsertParam, char
return
TSDB_CODE_SUCCESS
;
}
int
validateTableName
(
char
*
tblName
,
int
len
,
SStrToken
*
psTblToken
,
bool
*
dbIncluded
)
{
tstrncpy
(
psTblToken
->
z
,
tblName
,
TSDB_TABLE_FNAME_LEN
);
psTblToken
->
n
=
len
;
psTblToken
->
type
=
TK_ID
;
tGetToken
(
psTblToken
->
z
,
&
psTblToken
->
type
);
return
tscValidateName
(
psTblToken
,
true
,
dbIncluded
);
}
static
int32_t
tscCheckIfCreateTable
(
char
**
sqlstr
,
SSqlObj
*
pSql
,
char
**
boundColumn
)
{
int32_t
index
=
0
;
SStrToken
sToken
=
{
0
};
...
...
@@ -960,13 +972,27 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
sToken
=
tStrGetToken
(
sql
,
&
index
,
false
);
sql
+=
index
;
if
(
sToken
.
type
==
TK_ILLEGAL
)
{
return
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
NULL
,
sql
);
}
//the source super table is moved to the secondary position of the pTableMetaInfo list
if
(
pQueryInfo
->
numOfTables
<
2
)
{
tscAddEmptyMetaInfo
(
pQueryInfo
);
}
bool
dbIncluded1
=
false
;
char
buf
[
TSDB_TABLE_FNAME_LEN
];
SStrToken
sTblToken
;
sTblToken
.
z
=
buf
;
code
=
validateTableName
(
sToken
.
z
,
sToken
.
n
,
&
sTblToken
,
&
dbIncluded1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
STableMetaInfo
*
pSTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
STABLE_INDEX
);
code
=
tscSetTableFullName
(
&
pSTableMetaInfo
->
name
,
&
sT
oken
,
pSql
);
code
=
tscSetTableFullName
(
&
pSTableMetaInfo
->
name
,
&
sT
blToken
,
pSql
,
dbIncluded1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -980,7 +1006,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
}
if
(
!
UTIL_TABLE_IS_SUPER_TABLE
(
pSTableMetaInfo
))
{
return
tscInvalidOperationMsg
(
pInsertParam
->
msg
,
"create table only from super table is allowed"
,
sToken
.
z
);
return
tscInvalidOperationMsg
(
pInsertParam
->
msg
,
"create table only from super table is allowed"
,
sT
blT
oken
.
z
);
}
SSchema
*
pTagSchema
=
tscGetTableTagSchema
(
pSTableMetaInfo
->
pTableMeta
);
...
...
@@ -1136,12 +1162,16 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
}
sql
=
sToken
.
z
;
bool
dbIncluded2
=
false
;
if
(
tscValidateName
(
&
tableToken
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
sTblToken
.
z
=
buf
;
code
=
validateTableName
(
tableToken
.
z
,
tableToken
.
n
,
&
sTblToken
,
&
dbIncluded2
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
tscInvalidOperationMsg
(
pInsertParam
->
msg
,
"invalid table name"
,
*
sqlstr
);
}
int32_t
ret
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
&
tableToken
,
pSql
);
int32_t
ret
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
&
sTblToken
,
pSql
,
dbIncluded2
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
...
...
@@ -1171,16 +1201,6 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
return
code
;
}
int
validateTableName
(
char
*
tblName
,
int
len
,
SStrToken
*
psTblToken
)
{
tstrncpy
(
psTblToken
->
z
,
tblName
,
TSDB_TABLE_FNAME_LEN
);
psTblToken
->
n
=
len
;
psTblToken
->
type
=
TK_ID
;
tGetToken
(
psTblToken
->
z
,
&
psTblToken
->
type
);
return
tscValidateName
(
psTblToken
,
true
);
}
static
int32_t
validateDataSource
(
SInsertStatementParam
*
pInsertParam
,
int32_t
type
,
const
char
*
sql
)
{
uint32_t
*
insertType
=
&
pInsertParam
->
insertType
;
if
(
*
insertType
==
TSDB_QUERY_TYPE_STMT_INSERT
&&
type
==
TSDB_QUERY_TYPE_INSERT
)
{
...
...
@@ -1401,13 +1421,14 @@ int tsParseInsertSql(SSqlObj *pSql) {
char
buf
[
TSDB_TABLE_FNAME_LEN
];
SStrToken
sTblToken
;
sTblToken
.
z
=
buf
;
bool
dbIncluded
=
false
;
// Check if the table name available or not
if
(
validateTableName
(
sToken
.
z
,
sToken
.
n
,
&
sTblToken
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
validateTableName
(
sToken
.
z
,
sToken
.
n
,
&
sTblToken
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
code
=
tscInvalidOperationMsg
(
pInsertParam
->
msg
,
"table name invalid"
,
sToken
.
z
);
goto
_clean
;
}
if
((
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
&
sTblToken
,
pSql
))
!=
TSDB_CODE_SUCCESS
)
{
if
((
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
&
sTblToken
,
pSql
,
dbIncluded
))
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
ebc1fd6c
...
...
@@ -558,8 +558,10 @@ static int32_t retrieveTableMeta(TAOS* taos, char* tableName, STableMeta** pTabl
registerSqlObj
(
pSql
);
SStrToken
tableToken
=
{.
z
=
tableNameLowerCase
,
.
n
=
(
uint32_t
)
strlen
(
tableNameLowerCase
),
.
type
=
TK_ID
};
tGetToken
(
tableNameLowerCase
,
&
tableToken
.
type
);
bool
dbIncluded
=
false
;
// Check if the table name available or not
if
(
tscValidateName
(
&
tableToken
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
&
tableToken
,
true
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH
;
sprintf
(
pSql
->
cmd
.
payload
,
"table name is invalid"
);
tscFreeRegisteredSqlObj
(
pSql
);
...
...
@@ -567,7 +569,7 @@ static int32_t retrieveTableMeta(TAOS* taos, char* tableName, STableMeta** pTabl
}
SName
sname
=
{
0
};
if
((
code
=
tscSetTableFullName
(
&
sname
,
&
tableToken
,
pSql
))
!=
TSDB_CODE_SUCCESS
)
{
if
((
code
=
tscSetTableFullName
(
&
sname
,
&
tableToken
,
pSql
,
dbIncluded
))
!=
TSDB_CODE_SUCCESS
)
{
tscFreeRegisteredSqlObj
(
pSql
);
return
code
;
}
...
...
src/client/src/tscPrepare.c
浏览文件 @
ebc1fd6c
...
...
@@ -1585,9 +1585,10 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
SSqlObj
*
pSql
=
pStmt
->
pSql
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
uint32_t
nameLen
=
(
uint32_t
)
strlen
(
name
);
if
(
name
==
NULL
)
{
tscError
(
"0x%"
PRIx64
" name is NULL"
,
pSql
->
self
);
if
(
name
==
NULL
||
nameLen
<=
0
)
{
tscError
(
"0x%"
PRIx64
"
tb
name is NULL"
,
pSql
->
self
);
STMT_RET
(
invalidOperationMsg
(
tscGetErrorMsgPayload
(
&
pStmt
->
pSql
->
cmd
),
"name is NULL"
));
}
...
...
@@ -1603,6 +1604,19 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
pStmt
->
last
=
STMT_SETTBNAME
;
SStrToken
tname
=
{
0
};
tname
.
type
=
TK_STRING
;
tname
.
z
=
(
char
*
)
name
;
tname
.
n
=
(
uint32_t
)
strlen
(
name
);
bool
dbIncluded
=
false
;
// Check if the table name available or not
if
(
tscValidateName
(
&
tname
,
true
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"0x%"
PRIx64
" tbname[%s] is invalid"
,
pSql
->
self
,
name
);
STMT_RET
(
invalidOperationMsg
(
tscGetErrorMsgPayload
(
&
pStmt
->
pSql
->
cmd
),
"name is invalid"
));
}
uint64_t
*
uid
=
(
uint64_t
*
)
taosHashGet
(
pStmt
->
mtb
.
pTableHash
,
name
,
strlen
(
name
));
if
(
uid
!=
NULL
)
{
pStmt
->
mtb
.
currentUid
=
*
uid
;
...
...
@@ -1632,13 +1646,9 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
char
sTableName
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
tstrncpy
(
sTableName
,
pTableMeta
->
sTableName
,
sizeof
(
sTableName
));
SStrToken
tname
=
{
0
};
tname
.
type
=
TK_STRING
;
tname
.
z
=
(
char
*
)
name
;
tname
.
n
=
(
uint32_t
)
strlen
(
name
);
SName
fullname
=
{
0
};
tscSetTableFullName
(
&
fullname
,
&
tname
,
pSql
);
tscSetTableFullName
(
&
fullname
,
&
tname
,
pSql
,
dbIncluded
);
memcpy
(
&
pTableMetaInfo
->
name
,
&
fullname
,
sizeof
(
fullname
));
...
...
src/client/src/tscSQLParser.c
浏览文件 @
ebc1fd6c
...
...
@@ -142,6 +142,8 @@ static int32_t checkQueryRangeForFill(SSqlCmd* pCmd, SQueryInfo* pQueryInfo);
static
int32_t
loadAllTableMeta
(
SSqlObj
*
pSql
,
struct
SSqlInfo
*
pInfo
);
static
tSqlExpr
*
extractExprForSTable
(
SSqlCmd
*
pCmd
,
tSqlExpr
**
pExpr
,
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
int
validateTableName
(
char
*
tblName
,
int
len
,
SStrToken
*
psTblToken
,
bool
*
dbIncluded
);
static
bool
isTimeWindowQuery
(
SQueryInfo
*
pQueryInfo
)
{
return
pQueryInfo
->
interval
.
interval
>
0
||
pQueryInfo
->
sessionWindow
.
gap
>
0
;
}
...
...
@@ -568,7 +570,9 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SStrToken
*
pzName
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
bool
escapeEnabled
=
(
pInfo
->
type
==
TSDB_SQL_DROP_TABLE
)
?
true
:
false
;
if
((
pInfo
->
type
!=
TSDB_SQL_DROP_DNODE
)
&&
(
tscValidateName
(
pzName
,
escapeEnabled
)
!=
TSDB_CODE_SUCCESS
))
{
bool
dbIncluded
=
false
;
if
((
pInfo
->
type
!=
TSDB_SQL_DROP_DNODE
)
&&
(
tscValidateName
(
pzName
,
escapeEnabled
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
))
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -582,7 +586,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
else
if
(
pInfo
->
type
==
TSDB_SQL_DROP_TABLE
)
{
assert
(
taosArrayGetSize
(
pInfo
->
pMiscInfo
->
a
)
==
1
);
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
pzName
,
pSql
);
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
pzName
,
pSql
,
dbIncluded
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -606,7 +610,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const
char
*
msg
=
"invalid db name"
;
SStrToken
*
pToken
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
if
(
tscValidateName
(
pToken
,
false
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
pToken
,
false
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
);
}
...
...
@@ -653,7 +657,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
,
false
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
&
token
,
false
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
...
...
@@ -700,7 +704,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
if
(
tscValidateName
(
pName
,
false
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
pName
,
false
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -722,11 +726,13 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const
char
*
msg1
=
"invalid table name"
;
SStrToken
*
pToken
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
if
(
tscValidateName
(
pToken
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
bool
dbIncluded
=
false
;
if
(
tscValidateName
(
pToken
,
true
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
// additional msg has been attached already
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
pToken
,
pSql
);
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
pToken
,
pSql
,
dbIncluded
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -738,11 +744,13 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const
char
*
msg1
=
"invalid table name"
;
SStrToken
*
pToken
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
if
(
tscValidateName
(
pToken
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
bool
dbIncluded
=
false
;
if
(
tscValidateName
(
pToken
,
true
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
pToken
,
pSql
);
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
pToken
,
pSql
,
dbIncluded
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -753,7 +761,8 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const
char
*
msg1
=
"invalid database name"
;
SStrToken
*
pToken
=
taosArrayGet
(
pInfo
->
pMiscInfo
->
a
,
0
);
if
(
tscValidateName
(
pToken
,
false
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
pToken
,
false
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
...
...
@@ -817,7 +826,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
if
(
tscValidateName
(
pName
,
false
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
pName
,
false
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -1337,7 +1346,7 @@ int32_t parseSlidingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStrToken* pSl
return
TSDB_CODE_SUCCESS
;
}
int32_t
tscSetTableFullName
(
SName
*
pName
,
SStrToken
*
pTableName
,
SSqlObj
*
pSql
)
{
int32_t
tscSetTableFullName
(
SName
*
pName
,
SStrToken
*
pTableName
,
SSqlObj
*
pSql
,
bool
dbIncluded
)
{
const
char
*
msg1
=
"name too long"
;
const
char
*
msg2
=
"acctId too long"
;
const
char
*
msg3
=
"no acctId"
;
...
...
@@ -1346,7 +1355,12 @@ int32_t tscSetTableFullName(SName* pName, SStrToken* pTableName, SSqlObj* pSql)
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
idx
=
getDelimiterIndex
(
pTableName
);
int32_t
idx
=
-
1
;
if
(
dbIncluded
)
{
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
)
{
...
...
@@ -3206,8 +3220,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
if
(
pDbPrefixToken
->
n
<=
0
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg5
);
}
if
(
tscValidateName
(
pDbPrefixToken
,
false
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
pDbPrefixToken
,
false
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
...
...
@@ -5866,12 +5879,13 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
pCmd
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
DEFAULT_TABLE_INDEX
);
bool
dbIncluded
=
false
;
if
(
tscValidateName
(
&
(
pAlterSQL
->
name
,
true
)
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
&
(
pAlterSQL
->
name
),
true
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
&
(
pAlterSQL
->
name
),
pSql
);
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
&
(
pAlterSQL
->
name
),
pSql
,
dbIncluded
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -7421,12 +7435,13 @@ int32_t doCheckForCreateTable(SSqlObj* pSql, int32_t subClauseIndex, SSqlInfo* p
// if sql specifies db, use it, otherwise use default db
SStrToken
*
pzTableName
=
&
(
pCreateTable
->
name
);
if
(
tscValidateName
(
pzTableName
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
bool
dbIncluded
=
false
;
if
(
tscValidateName
(
pzTableName
,
true
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
int32_t
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
pzTableName
,
pSql
);
int32_t
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
pzTableName
,
pSql
,
dbIncluded
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -7486,11 +7501,13 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
SCreatedTableInfo
*
pCreateTableInfo
=
taosArrayGet
(
pCreateTable
->
childTableInfo
,
j
);
SStrToken
*
pToken
=
&
pCreateTableInfo
->
stableName
;
if
(
tscValidateName
(
pToken
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
bool
dbIncluded
=
false
;
if
(
tscValidateName
(
pToken
,
true
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
int32_t
code
=
tscSetTableFullName
(
&
pStableMetaInfo
->
name
,
pToken
,
pSql
);
int32_t
code
=
tscSetTableFullName
(
&
pStableMetaInfo
->
name
,
pToken
,
pSql
,
dbIncluded
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -7659,14 +7676,15 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
kvRowCpy
(
pTag
->
data
,
row
);
free
(
row
);
bool
dbIncluded2
=
false
;
// table name
if
(
tscValidateName
(
&
(
pCreateTableInfo
->
name
,
true
)
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
&
(
pCreateTableInfo
->
name
),
true
,
&
dbIncluded2
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
TABLE_INDEX
);
ret
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
&
pCreateTableInfo
->
name
,
pSql
);
ret
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
&
pCreateTableInfo
->
name
,
pSql
,
dbIncluded2
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
...
...
@@ -7703,8 +7721,9 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) {
// if sql specifies db, use it, otherwise use default db
SStrToken
*
pName
=
&
(
pCreateTable
->
name
);
SSqlNode
*
pSqlNode
=
pCreateTable
->
pSelect
;
bool
dbIncluded1
=
false
;
if
(
tscValidateName
(
pName
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
pName
,
true
,
&
dbIncluded1
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
...
...
@@ -7719,11 +7738,13 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) {
SRelElementPair
*
p1
=
taosArrayGet
(
pFromInfo
->
list
,
0
);
SStrToken
srcToken
=
{.
z
=
p1
->
tableName
.
z
,
.
n
=
p1
->
tableName
.
n
,
.
type
=
TK_STRING
};
if
(
tscValidateName
(
&
srcToken
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
bool
dbIncluded2
=
false
;
if
(
tscValidateName
(
&
srcToken
,
true
,
&
dbIncluded2
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
int32_t
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
&
srcToken
,
pSql
);
int32_t
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
&
srcToken
,
pSql
,
dbIncluded2
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -7765,7 +7786,7 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) {
}
// set the created table[stream] name
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
pName
,
pSql
);
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
pName
,
pSql
,
dbIncluded1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -8156,14 +8177,18 @@ static int32_t getTableNameFromSqlNode(SSqlNode* pSqlNode, SArray* tableNameList
if
(
t
->
type
==
TK_INTEGER
||
t
->
type
==
TK_FLOAT
)
{
return
invalidOperationMsg
(
msgBuf
,
msg1
);
}
tscDequoteAndTrimToken
(
t
);
if
(
tscValidateName
(
t
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
bool
dbIncluded
=
false
;
char
buf
[
TSDB_TABLE_FNAME_LEN
];
SStrToken
sTblToken
;
sTblToken
.
z
=
buf
;
if
(
validateTableName
(
t
->
z
,
t
->
n
,
&
sTblToken
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
msgBuf
,
msg1
);
}
SName
name
=
{
0
};
int32_t
code
=
tscSetTableFullName
(
&
name
,
t
,
pSql
);
int32_t
code
=
tscSetTableFullName
(
&
name
,
&
sTblToken
,
pSql
,
dbIncluded
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -8418,12 +8443,14 @@ static int32_t doLoadAllTableMeta(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNod
}
tscDequoteAndTrimToken
(
oriName
);
if
(
tscValidateName
(
oriName
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
bool
dbIncluded
=
false
;
if
(
tscValidateName
(
oriName
,
true
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
i
);
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
oriName
,
pSql
);
code
=
tscSetTableFullName
(
&
pTableMetaInfo
->
name
,
oriName
,
pSql
,
dbIncluded
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -8435,7 +8462,7 @@ static int32_t doLoadAllTableMeta(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNod
}
tscDequoteAndTrimToken
(
aliasName
);
if
(
tscValidateName
(
aliasName
,
false
)
!=
TSDB_CODE_SUCCESS
||
aliasName
->
n
>=
TSDB_TABLE_NAME_LEN
)
{
if
(
tscValidateName
(
aliasName
,
false
,
NULL
)
!=
TSDB_CODE_SUCCESS
||
aliasName
->
n
>=
TSDB_TABLE_NAME_LEN
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
...
...
src/client/src/tscServer.c
浏览文件 @
ebc1fd6c
...
...
@@ -2869,7 +2869,7 @@ int32_t getMultiTableMetaFromMnode(SSqlObj *pSql, SArray* pNameList, SArray* pVg
for
(
int32_t
i
=
0
;
i
<
numOfTable
;
++
i
)
{
char
*
name
=
taosArrayGetP
(
pNameList
,
i
);
if
(
i
<
numOfTable
-
1
||
numOfVgroupList
>
0
||
numOfUdf
>
0
)
{
len
=
sprintf
(
start
,
"%s
,
"
,
name
);
len
=
sprintf
(
start
,
"%s
·
"
,
name
);
}
else
{
len
=
sprintf
(
start
,
"%s"
,
name
);
}
...
...
@@ -2880,7 +2880,7 @@ int32_t getMultiTableMetaFromMnode(SSqlObj *pSql, SArray* pNameList, SArray* pVg
for
(
int32_t
i
=
0
;
i
<
numOfVgroupList
;
++
i
)
{
char
*
name
=
taosArrayGetP
(
pVgroupNameList
,
i
);
if
(
i
<
numOfVgroupList
-
1
||
numOfUdf
>
0
)
{
len
=
sprintf
(
start
,
"%s
,
"
,
name
);
len
=
sprintf
(
start
,
"%s
·
"
,
name
);
}
else
{
len
=
sprintf
(
start
,
"%s"
,
name
);
}
...
...
@@ -2891,7 +2891,7 @@ int32_t getMultiTableMetaFromMnode(SSqlObj *pSql, SArray* pNameList, SArray* pVg
for
(
int32_t
i
=
0
;
i
<
numOfUdf
;
++
i
)
{
SUdfInfo
*
u
=
taosArrayGet
(
pUdfList
,
i
);
if
(
i
<
numOfUdf
-
1
)
{
len
=
sprintf
(
start
,
"%s
,
"
,
u
->
name
);
len
=
sprintf
(
start
,
"%s
·
"
,
u
->
name
);
}
else
{
len
=
sprintf
(
start
,
"%s"
,
u
->
name
);
}
...
...
src/client/src/tscUtil.c
浏览文件 @
ebc1fd6c
...
...
@@ -2730,13 +2730,13 @@ void tscColumnListDestroy(SArray* pColumnList) {
* 'first_part.second_part'
*
*/
static
int32_t
validateQuoteToken
(
SStrToken
*
pToken
)
{
static
int32_t
validateQuoteToken
(
SStrToken
*
pToken
,
bool
escapeEnabled
,
bool
*
dbIncluded
)
{
tscDequoteAndTrimToken
(
pToken
);
int32_t
k
=
tGetToken
(
pToken
->
z
,
&
pToken
->
type
);
if
(
pToken
->
type
==
TK_STRING
)
{
return
tscValidateName
(
pToken
);
return
tscValidateName
(
pToken
,
escapeEnabled
,
dbIncluded
);
}
if
(
k
!=
pToken
->
n
||
pToken
->
type
!=
TK_ID
)
{
...
...
@@ -2833,15 +2833,24 @@ void tscRmEscapeAndTrimToken(SStrToken* pToken) {
int32_t
tscValidateName
(
SStrToken
*
pToken
,
bool
escapeEnabled
)
{
int32_t
tscValidateName
(
SStrToken
*
pToken
,
bool
escapeEnabled
,
bool
*
dbIncluded
)
{
if
(
pToken
==
NULL
||
pToken
->
z
==
NULL
||
(
escapeEnabled
&&
pToken
->
type
!=
TK_STRING
&&
pToken
->
type
!=
TK_ID
&&
pToken
->
type
!=
TK_ESCAPE
)
||
((
!
escapeEnabled
)
&&
pToken
->
type
!=
TK_STRING
&&
pToken
->
type
!=
TK_ID
))
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
char
*
sep
=
strnchr
(
pToken
->
z
,
TS_PATH_DELIMITER
[
0
],
pToken
->
n
,
true
);
char
*
sep
=
NULL
;
if
(
escapeEnabled
)
{
sep
=
tableNameGetPosition
(
pToken
,
TS_PATH_DELIMITER
[
0
]);
}
else
{
sep
=
strnchr
(
pToken
->
z
,
TS_PATH_DELIMITER
[
0
],
pToken
->
n
,
true
);
}
if
(
sep
==
NULL
)
{
// single part
if
(
dbIncluded
)
*
dbIncluded
=
false
;
if
(
pToken
->
type
==
TK_STRING
)
{
tscDequoteAndTrimToken
(
pToken
);
...
...
@@ -2852,14 +2861,14 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled) {
// single token, validate it
if
(
len
==
pToken
->
n
)
{
return
validateQuoteToken
(
pToken
);
return
validateQuoteToken
(
pToken
,
escapeEnabled
,
NULL
);
}
else
{
sep
=
strnchr
(
pToken
->
z
,
TS_PATH_DELIMITER
[
0
],
pToken
->
n
,
true
);
if
(
sep
==
NULL
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
return
tscValidateName
(
pToken
);
return
tscValidateName
(
pToken
,
escapeEnabled
,
NULL
);
}
}
else
if
(
escapeEnabled
&&
pToken
->
type
==
TK_ESCAPE
)
{
tscRmEscapeAndTrimToken
(
pToken
);
...
...
@@ -2872,6 +2881,9 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled) {
}
else
{
// two part
int32_t
oldLen
=
pToken
->
n
;
char
*
pStr
=
pToken
->
z
;
bool
firstPartQuote
=
false
;
if
(
dbIncluded
)
*
dbIncluded
=
true
;
if
(
pToken
->
type
==
TK_SPACE
)
{
pToken
->
n
=
(
uint32_t
)
strtrim
(
pToken
->
z
);
...
...
@@ -2886,8 +2898,13 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled) {
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
if
(
pToken
->
type
==
TK_STRING
&&
validateQuoteToken
(
pToken
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
if
(
pToken
->
type
==
TK_STRING
)
{
if
(
validateQuoteToken
(
pToken
,
escapeEnabled
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
else
{
tscStrToLower
(
pToken
->
z
,
pToken
->
n
);
firstPartQuote
=
true
;
}
}
int32_t
firstPartLen
=
pToken
->
n
;
...
...
@@ -2900,18 +2917,20 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled) {
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
if
(
pToken
->
type
==
TK_STRING
&&
validateQuoteToken
(
pToken
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
if
(
pToken
->
type
==
TK_STRING
)
{
if
(
validateQuoteToken
(
pToken
,
escapeEnabled
,
NULL
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
else
{
tscStrToLower
(
pToken
->
z
,
pToken
->
n
);
}
}
if
(
escapeEnabled
&&
pToken
->
type
==
TK_ESCAPE
)
{
tscRmEscapeAndTrimToken
(
pToken
);
}
xxxxxxxtolower
// re-build the whole name string
if
(
pStr
[
firstPartLen
]
==
TS_PATH_DELIMITER
[
0
]
)
{
if
(
!
firstPartQuote
)
{
// first part do not have quote do nothing
}
else
{
pStr
[
firstPartLen
]
=
TS_PATH_DELIMITER
[
0
];
...
...
@@ -2921,8 +2940,6 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled) {
}
pToken
->
n
+=
(
firstPartLen
+
sizeof
(
TS_PATH_DELIMITER
[
0
]));
pToken
->
z
=
pStr
;
tscStrToLower
(
pToken
->
z
,
pToken
->
n
);
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -5036,14 +5053,16 @@ static int32_t doAddTableName(char* nextStr, char** str, SArray* pNameArray, SSq
SStrToken
sToken
=
{.
n
=
len
,
.
type
=
TK_ID
,
.
z
=
tablename
};
tGetToken
(
tablename
,
&
sToken
.
type
);
bool
dbIncluded
=
false
;
// Check if the table name available or not
if
(
tscValidateName
(
&
sToken
,
true
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
&
sToken
,
true
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
sprintf
(
pCmd
->
payload
,
"table name is invalid"
);
return
TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH
;
}
SName
name
=
{
0
};
if
((
code
=
tscSetTableFullName
(
&
name
,
&
sToken
,
pSql
))
!=
TSDB_CODE_SUCCESS
)
{
if
((
code
=
tscSetTableFullName
(
&
name
,
&
sToken
,
pSql
,
dbIncluded
))
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
src/common/inc/tname.h
浏览文件 @
ebc1fd6c
...
...
@@ -92,6 +92,8 @@ size_t tableIdPrefix(const char* name, char* prefix, int32_t len);
void
extractTableNameFromToken
(
SStrToken
*
pToken
,
SStrToken
*
pTable
);
char
*
tableNameGetPosition
(
SStrToken
*
pToken
,
char
target
);
SSchema
tGetUserSpecifiedColumnSchema
(
tVariant
*
pVal
,
SStrToken
*
exprStr
,
const
char
*
name
);
bool
tscValidateTableNameLength
(
size_t
len
);
...
...
src/common/src/tname.c
浏览文件 @
ebc1fd6c
...
...
@@ -151,6 +151,39 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, in
#endif
char
*
tableNameGetPosition
(
SStrToken
*
pToken
,
char
target
)
{
bool
inEscape
=
false
;
bool
inQuota
=
false
;
char
quotaStr
=
0
;
for
(
uint32_t
i
=
0
;
i
<
pToken
->
n
;
++
i
)
{
if
(
*
(
pToken
->
z
+
i
)
==
target
&&
(
!
inEscape
)
&&
(
!
inQuota
))
{
return
pToken
->
z
+
i
;
}
if
(
*
(
pToken
->
z
+
i
)
==
TS_ESCAPE_CHAR
)
{
if
(
!
inQuota
)
{
inEscape
=
!
inEscape
;
}
}
if
(
*
(
pToken
->
z
+
i
)
==
'\''
||
*
(
pToken
->
z
+
i
)
==
'"'
)
{
if
(
!
inEscape
)
{
if
(
!
inQuota
)
{
quotaStr
=
*
(
pToken
->
z
+
i
);
inQuota
=
!
inQuota
;
}
else
if
(
quotaStr
==
*
(
pToken
->
z
+
i
))
{
inQuota
=
!
inQuota
;
}
}
}
}
return
NULL
;
}
/*
* tablePrefix.columnName
* extract table name and save it in pTable, with only column name in pToken
...
...
@@ -162,12 +195,17 @@ void extractTableNameFromToken(SStrToken* pToken, SStrToken* pTable) {
return
;
}
char
*
r
=
strnchr
(
pToken
->
z
,
sep
,
pToken
->
n
,
false
);
if
(
r
!=
NULL
)
{
// record the table name token
pTable
->
n
=
(
uint32_t
)(
r
-
pToken
->
z
);
pTable
->
z
=
pToken
->
z
;
char
*
r
=
tableNameGetPosition
(
pToken
,
sep
);
if
(
r
!=
NULL
)
{
// record the table name token
if
(
pToken
->
z
[
0
]
==
TS_ESCAPE_CHAR
&&
*
(
r
-
1
)
==
TS_ESCAPE_CHAR
)
{
pTable
->
n
=
(
uint32_t
)(
r
-
pToken
->
z
-
2
);
pTable
->
z
=
pToken
->
z
+
1
;
}
else
{
pTable
->
n
=
(
uint32_t
)(
r
-
pToken
->
z
);
pTable
->
z
=
pToken
->
z
;
}
r
+=
1
;
pToken
->
n
-=
(
uint32_t
)(
r
-
pToken
->
z
);
pToken
->
z
=
r
;
...
...
src/inc/taosdef.h
浏览文件 @
ebc1fd6c
...
...
@@ -98,6 +98,7 @@ extern const int32_t TYPE_BYTES[15];
#define TSDB_ERR -1
#define TS_PATH_DELIMITER "."
#define TS_ESCAPE_CHAR '`'
#define TSDB_TIME_PRECISION_MILLI 0
#define TSDB_TIME_PRECISION_MICRO 1
...
...
src/inc/ttokendef.h
浏览文件 @
ebc1fd6c
...
...
@@ -216,6 +216,7 @@
#define TK_SPACE 300
#define TK_COMMENT 301
#define TK_ILLEGAL 302
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
ebc1fd6c
...
...
@@ -2973,7 +2973,7 @@ static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg) {
int32_t
num
=
0
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
char
*
str
=
strndup
(
pInfo
->
tableNames
,
contLen
);
char
**
nameList
=
strsplit
(
str
,
"
,
"
,
&
num
);
char
**
nameList
=
strsplit
(
str
,
"
·
"
,
&
num
);
SArray
*
pList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
SMultiTableMeta
*
pMultiMeta
=
NULL
;
...
...
src/query/inc/sql.y
浏览文件 @
ebc1fd6c
...
...
@@ -694,6 +694,8 @@ expr(A) ::= LP(X) expr(Y) RP(Z). {A = Y; A->exprToken.z = X.z; A->exprToke
expr(A) ::= ID(X). { A = tSqlExprCreateIdValue(&X, TK_ID);}
expr(A) ::= ID(X) DOT ID(Y). { X.n += (1+Y.n); A = tSqlExprCreateIdValue(&X, TK_ID);}
expr(A) ::= ID(X) DOT STAR(Y). { X.n += (1+Y.n); A = tSqlExprCreateIdValue(&X, TK_ALL);}
expr(A) ::= ESCAPE(X) DOT ID(Y). { X.n += (1+Y.n); A = tSqlExprCreateIdValue(&X, TK_ID);}
expr(A) ::= ESCAPE(X) DOT STAR(Y). { X.n += (1+Y.n); A = tSqlExprCreateIdValue(&X, TK_ALL);}
expr(A) ::= INTEGER(X). { A = tSqlExprCreateIdValue(&X, TK_INTEGER);}
expr(A) ::= MINUS(X) INTEGER(Y). { X.n += Y.n; X.type = TK_INTEGER; A = tSqlExprCreateIdValue(&X, TK_INTEGER);}
...
...
src/query/src/sql.c
浏览文件 @
ebc1fd6c
此差异已折叠。
点击以展开。
src/query/tests/unitTest.cpp
浏览文件 @
ebc1fd6c
...
...
@@ -23,7 +23,7 @@ int32_t testValidateName(char* name) {
token
.
type
=
0
;
tGetToken
(
name
,
&
token
.
type
);
return
tscValidateName
(
&
token
,
false
);
return
tscValidateName
(
&
token
,
false
,
NULL
);
}
}
...
...
tests/script/fullGeneralSuite.sim
浏览文件 @
ebc1fd6c
...
...
@@ -223,3 +223,4 @@ run general/db/show_create_db.sim
run general/db/show_create_table.sim
run general/parser/like.sim
run general/parser/regex.sim
run general/parser/tbname_escape.sim
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录