Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d3618a86
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d3618a86
编写于
12月 16, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225]fix clang-tidy warning.
上级
9bb0233f
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
207 addition
and
185 deletion
+207
-185
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+28
-28
src/query/inc/qSqlparser.h
src/query/inc/qSqlparser.h
+23
-23
src/query/inc/sql.y
src/query/inc/sql.y
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+1
-1
src/query/src/qParserImpl.c
src/query/src/qParserImpl.c
+54
-54
src/query/src/sql.c
src/query/src/sql.c
+99
-77
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
d3618a86
...
...
@@ -1357,7 +1357,7 @@ int tsParseSql(SSqlObj *pSql, bool initial) {
ret
=
tscToSQLCmd
(
pSql
,
&
SQLInfo
);
}
S
QL
InfoDestroy
(
&
SQLInfo
);
S
ql
InfoDestroy
(
&
SQLInfo
);
}
/*
...
...
src/client/src/tscSQLParser.c
浏览文件 @
d3618a86
...
...
@@ -66,9 +66,9 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
static
int32_t
setObjFullName
(
char
*
fullName
,
const
char
*
account
,
SStrToken
*
pDB
,
SStrToken
*
tableName
,
int32_t
*
len
);
static
void
getColumnName
(
tS
QL
ExprItem
*
pItem
,
char
*
resultFieldName
,
int32_t
nameLength
);
static
void
getColumnName
(
tS
ql
ExprItem
*
pItem
,
char
*
resultFieldName
,
int32_t
nameLength
);
static
int32_t
addExprAndResultField
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
int32_t
colIndex
,
tS
QL
ExprItem
*
pItem
,
bool
finalResult
);
static
int32_t
addExprAndResultField
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
int32_t
colIndex
,
tS
ql
ExprItem
*
pItem
,
bool
finalResult
);
static
int32_t
insertResultField
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputIndex
,
SColumnList
*
pIdList
,
int16_t
bytes
,
int8_t
type
,
char
*
fieldName
,
SSqlExpr
*
pSqlExpr
);
...
...
@@ -87,7 +87,7 @@ static int32_t parseIntervalClause(SSqlObj* pSql, SQueryInfo* pQueryInfo, SQuery
static
int32_t
parseOffsetClause
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SQuerySQL
*
pQuerySql
);
static
int32_t
parseSlidingClause
(
SSqlObj
*
pSql
,
SQueryInfo
*
pQueryInfo
,
SQuerySQL
*
pQuerySql
);
static
int32_t
addProjectionExprAndResultField
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tS
QL
ExprItem
*
pItem
);
static
int32_t
addProjectionExprAndResultField
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tS
ql
ExprItem
*
pItem
);
static
int32_t
parseWhereClause
(
SQueryInfo
*
pQueryInfo
,
tSQLExpr
**
pExpr
,
SSqlObj
*
pSql
);
static
int32_t
parseFillClause
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SQuerySQL
*
pQuerySQL
);
...
...
@@ -1279,7 +1279,7 @@ static void tscInsertPrimaryTSSourceColumn(SQueryInfo* pQueryInfo, SColumnIndex*
tscColumnListInsert
(
pQueryInfo
->
colList
,
&
tsCol
);
}
static
int32_t
handleArithmeticExpr
(
SSqlCmd
*
pCmd
,
int32_t
clauseIndex
,
int32_t
exprIndex
,
tS
QL
ExprItem
*
pItem
)
{
static
int32_t
handleArithmeticExpr
(
SSqlCmd
*
pCmd
,
int32_t
clauseIndex
,
int32_t
exprIndex
,
tS
ql
ExprItem
*
pItem
)
{
const
char
*
msg1
=
"invalid column name, illegal column type, or columns in arithmetic expression from two tables"
;
const
char
*
msg2
=
"invalid arithmetic expression in select clause"
;
const
char
*
msg3
=
"tag columns can not be used in arithmetic expression"
;
...
...
@@ -1420,7 +1420,7 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t
return
TSDB_CODE_SUCCESS
;
}
static
void
addProjectQueryCol
(
SQueryInfo
*
pQueryInfo
,
int32_t
startPos
,
SColumnIndex
*
pIndex
,
tS
QL
ExprItem
*
pItem
)
{
static
void
addProjectQueryCol
(
SQueryInfo
*
pQueryInfo
,
int32_t
startPos
,
SColumnIndex
*
pIndex
,
tS
ql
ExprItem
*
pItem
)
{
SSqlExpr
*
pExpr
=
doAddProjectCol
(
pQueryInfo
,
pIndex
->
columnIndex
,
pIndex
->
tableIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
pIndex
->
tableIndex
);
...
...
@@ -1484,7 +1484,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel
for
(
int32_t
i
=
0
;
i
<
pSelection
->
nExpr
;
++
i
)
{
int32_t
outputIndex
=
(
int32_t
)
tscSqlExprNumOfExprs
(
pQueryInfo
);
tS
QL
ExprItem
*
pItem
=
&
pSelection
->
a
[
i
];
tS
ql
ExprItem
*
pItem
=
&
pSelection
->
a
[
i
];
// project on all fields
int32_t
optr
=
pItem
->
pNode
->
nSQLOptr
;
...
...
@@ -1643,7 +1643,7 @@ static int32_t doAddProjectionExprAndResultFields(SQueryInfo* pQueryInfo, SColum
return
numOfTotalColumns
;
}
int32_t
addProjectionExprAndResultField
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tS
QL
ExprItem
*
pItem
)
{
int32_t
addProjectionExprAndResultField
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tS
ql
ExprItem
*
pItem
)
{
const
char
*
msg0
=
"invalid column name"
;
const
char
*
msg1
=
"tag for normal table query is not allowed"
;
...
...
@@ -1767,7 +1767,7 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
return
TSDB_CODE_SUCCESS
;
}
void
setResultColName
(
char
*
name
,
tS
QL
ExprItem
*
pItem
,
int32_t
functionId
,
SStrToken
*
pToken
,
bool
multiCols
)
{
void
setResultColName
(
char
*
name
,
tS
ql
ExprItem
*
pItem
,
int32_t
functionId
,
SStrToken
*
pToken
,
bool
multiCols
)
{
if
(
pItem
->
aliasName
!=
NULL
)
{
tstrncpy
(
name
,
pItem
->
aliasName
,
TSDB_COL_NAME_LEN
);
}
else
if
(
multiCols
)
{
...
...
@@ -1790,7 +1790,7 @@ void setResultColName(char* name, tSQLExprItem* pItem, int32_t functionId, SStrT
}
}
int32_t
addExprAndResultField
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
int32_t
colIndex
,
tS
QL
ExprItem
*
pItem
,
bool
finalResult
)
{
int32_t
addExprAndResultField
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
int32_t
colIndex
,
tS
ql
ExprItem
*
pItem
,
bool
finalResult
)
{
STableMetaInfo
*
pTableMetaInfo
=
NULL
;
int32_t
optr
=
pItem
->
pNode
->
nSQLOptr
;
...
...
@@ -1820,7 +1820,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
pItem
->
pNode
->
pParam
!=
NULL
)
{
tS
QL
ExprItem
*
pParamElem
=
&
pItem
->
pNode
->
pParam
->
a
[
0
];
tS
ql
ExprItem
*
pParamElem
=
&
pItem
->
pNode
->
pParam
->
a
[
0
];
SStrToken
*
pToken
=
&
pParamElem
->
pNode
->
colInfo
;
int16_t
sqlOptr
=
pParamElem
->
pNode
->
nSQLOptr
;
if
((
pToken
->
z
==
NULL
||
pToken
->
n
==
0
)
...
...
@@ -1921,7 +1921,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
tS
QL
ExprItem
*
pParamElem
=
&
(
pItem
->
pNode
->
pParam
->
a
[
0
]);
tS
ql
ExprItem
*
pParamElem
=
&
(
pItem
->
pNode
->
pParam
->
a
[
0
]);
if
(
pParamElem
->
pNode
->
nSQLOptr
!=
TK_ALL
&&
pParamElem
->
pNode
->
nSQLOptr
!=
TK_ID
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -2040,7 +2040,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
/* in first/last function, multiple columns can be add to resultset */
for
(
int32_t
i
=
0
;
i
<
pItem
->
pNode
->
pParam
->
nExpr
;
++
i
)
{
tS
QL
ExprItem
*
pParamElem
=
&
(
pItem
->
pNode
->
pParam
->
a
[
i
]);
tS
ql
ExprItem
*
pParamElem
=
&
(
pItem
->
pNode
->
pParam
->
a
[
i
]);
if
(
pParamElem
->
pNode
->
nSQLOptr
!=
TK_ALL
&&
pParamElem
->
pNode
->
nSQLOptr
!=
TK_ID
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
...
...
@@ -2153,7 +2153,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
tS
QL
ExprItem
*
pParamElem
=
&
(
pItem
->
pNode
->
pParam
->
a
[
0
]);
tS
ql
ExprItem
*
pParamElem
=
&
(
pItem
->
pNode
->
pParam
->
a
[
0
]);
if
(
pParamElem
->
pNode
->
nSQLOptr
!=
TK_ID
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -2353,7 +2353,7 @@ static SColumnList getColumnList(int32_t num, int16_t tableIndex, int32_t column
return
columnList
;
}
void
getColumnName
(
tS
QL
ExprItem
*
pItem
,
char
*
resultFieldName
,
int32_t
nameLength
)
{
void
getColumnName
(
tS
ql
ExprItem
*
pItem
,
char
*
resultFieldName
,
int32_t
nameLength
)
{
if
(
pItem
->
aliasName
!=
NULL
)
{
strncpy
(
resultFieldName
,
pItem
->
aliasName
,
nameLength
);
}
else
{
...
...
@@ -3520,7 +3520,7 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSQLExpr* pExpr, SQueryInfo* pQuer
int32_t
outputIndex
=
(
int32_t
)
tscSqlExprNumOfExprs
(
pQueryInfo
);
tS
QL
ExprItem
item
=
{.
pNode
=
pExpr
,
.
aliasName
=
NULL
};
tS
ql
ExprItem
item
=
{.
pNode
=
pExpr
,
.
aliasName
=
NULL
};
// sql function list in selection clause.
// Append the sqlExpr into exprList of pQueryInfo structure sequentially
...
...
@@ -3737,7 +3737,7 @@ static int32_t setExprToCond(tSQLExpr** parent, tSQLExpr* pExpr, const char* msg
return
invalidSqlErrMsg
(
msgBuf
,
msg
);
}
*
parent
=
tS
QL
ExprCreate
((
*
parent
),
pExpr
,
parentOptr
);
*
parent
=
tS
ql
ExprCreate
((
*
parent
),
pExpr
,
parentOptr
);
}
else
{
*
parent
=
pExpr
;
}
...
...
@@ -3785,7 +3785,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQL
* to release expression, e.g., m1.ts = m2.ts,
* since this expression is used to set the join query type
*/
tS
QL
ExprDestroy
(
*
pExpr
);
tS
ql
ExprDestroy
(
*
pExpr
);
}
else
{
ret
=
setExprToCond
(
&
pCondExpr
->
pTimewindow
,
*
pExpr
,
msg3
,
parentOptr
,
pQueryInfo
->
msg
);
}
...
...
@@ -3931,17 +3931,17 @@ static void doCompactQueryExpr(tSQLExpr** pExpr) {
if
((
*
pExpr
)
->
pLeft
==
NULL
&&
(
*
pExpr
)
->
pRight
==
NULL
&&
((
*
pExpr
)
->
nSQLOptr
==
TK_OR
||
(
*
pExpr
)
->
nSQLOptr
==
TK_AND
))
{
tS
QL
ExprNodeDestroy
(
*
pExpr
);
tS
ql
ExprNodeDestroy
(
*
pExpr
);
*
pExpr
=
NULL
;
}
else
if
((
*
pExpr
)
->
pLeft
==
NULL
&&
(
*
pExpr
)
->
pRight
!=
NULL
)
{
tSQLExpr
*
tmpPtr
=
(
*
pExpr
)
->
pRight
;
tS
QL
ExprNodeDestroy
(
*
pExpr
);
tS
ql
ExprNodeDestroy
(
*
pExpr
);
(
*
pExpr
)
=
tmpPtr
;
}
else
if
((
*
pExpr
)
->
pRight
==
NULL
&&
(
*
pExpr
)
->
pLeft
!=
NULL
)
{
tSQLExpr
*
tmpPtr
=
(
*
pExpr
)
->
pLeft
;
tS
QL
ExprNodeDestroy
(
*
pExpr
);
tS
ql
ExprNodeDestroy
(
*
pExpr
);
(
*
pExpr
)
=
tmpPtr
;
}
...
...
@@ -3964,7 +3964,7 @@ static void doExtractExprForSTable(SSqlCmd* pCmd, tSQLExpr** pExpr, SQueryInfo*
(
*
pExpr
)
=
NULL
;
}
else
{
*
pOut
=
tS
QL
ExprCreate
(
NULL
,
NULL
,
(
*
pExpr
)
->
nSQLOptr
);
*
pOut
=
tS
ql
ExprCreate
(
NULL
,
NULL
,
(
*
pExpr
)
->
nSQLOptr
);
doExtractExprForSTable
(
pCmd
,
&
(
*
pExpr
)
->
pLeft
,
pQueryInfo
,
&
((
*
pOut
)
->
pLeft
),
tableIndex
);
doExtractExprForSTable
(
pCmd
,
&
(
*
pExpr
)
->
pRight
,
pQueryInfo
,
&
((
*
pOut
)
->
pRight
),
tableIndex
);
...
...
@@ -4171,23 +4171,23 @@ static int32_t validateJoinExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SCondExpr
static
void
cleanQueryExpr
(
SCondExpr
*
pCondExpr
)
{
if
(
pCondExpr
->
pTableCond
)
{
tS
QL
ExprDestroy
(
pCondExpr
->
pTableCond
);
tS
ql
ExprDestroy
(
pCondExpr
->
pTableCond
);
}
if
(
pCondExpr
->
pTagCond
)
{
tS
QL
ExprDestroy
(
pCondExpr
->
pTagCond
);
tS
ql
ExprDestroy
(
pCondExpr
->
pTagCond
);
}
if
(
pCondExpr
->
pColumnCond
)
{
tS
QL
ExprDestroy
(
pCondExpr
->
pColumnCond
);
tS
ql
ExprDestroy
(
pCondExpr
->
pColumnCond
);
}
if
(
pCondExpr
->
pTimewindow
)
{
tS
QL
ExprDestroy
(
pCondExpr
->
pTimewindow
);
tS
ql
ExprDestroy
(
pCondExpr
->
pTimewindow
);
}
if
(
pCondExpr
->
pJoinExpr
)
{
tS
QL
ExprDestroy
(
pCondExpr
->
pJoinExpr
);
tS
ql
ExprDestroy
(
pCondExpr
->
pJoinExpr
);
}
}
...
...
@@ -4255,8 +4255,8 @@ static int32_t getTagQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SCondE
tsSetSTableQueryCond
(
&
pQueryInfo
->
tagCond
,
uid
,
&
bw
);
doCompactQueryExpr
(
pExpr
);
tS
QL
ExprDestroy
(
p1
);
tS
ql
ExprDestroy
(
p1
);
tExprTreeDestroy
(
&
p
,
NULL
);
taosArrayDestroy
(
colList
);
...
...
src/query/inc/qSqlparser.h
浏览文件 @
d3618a86
...
...
@@ -202,16 +202,16 @@ typedef struct tSQLExpr {
}
tSQLExpr
;
// used in select clause. select <tSQLExprList> from xxx
typedef
struct
tS
QL
ExprItem
{
typedef
struct
tS
ql
ExprItem
{
tSQLExpr
*
pNode
;
// The list of expressions
char
*
aliasName
;
// alias name, null-terminated string
}
tS
QL
ExprItem
;
}
tS
ql
ExprItem
;
// todo refactor by using SArray
typedef
struct
tSQLExprList
{
int32_t
nExpr
;
/* Number of expressions on the list */
int32_t
nAlloc
;
/* Number of entries allocated below */
tS
QL
ExprItem
*
a
;
/* One entry for each expression */
tS
ql
ExprItem
*
a
;
/* One entry for each expression */
}
tSQLExprList
;
/**
...
...
@@ -233,63 +233,63 @@ SArray *tVariantListAppend(SArray *pList, tVariant *pVar, uint8_t sortOrder);
SArray
*
tVariantListInsert
(
SArray
*
pList
,
tVariant
*
pVar
,
uint8_t
sortOrder
,
int32_t
index
);
SArray
*
tVariantListAppendToken
(
SArray
*
pList
,
SStrToken
*
pAliasToken
,
uint8_t
sortOrder
);
tSQLExpr
*
tS
QLExprCreate
(
tSQLExpr
*
pLeft
,
tSQLExpr
*
pRight
,
int32_t
opt
Type
);
tSQLExpr
*
tS
qlExprCreate
(
tSQLExpr
*
pLeft
,
tSQLExpr
*
pRight
,
int32_t
optr
Type
);
void
tS
QLExprDestroy
(
tSQLExpr
*
);
void
tS
qlExprDestroy
(
tSQLExpr
*
pExpr
);
tSQLExprList
*
tS
QL
ExprListAppend
(
tSQLExprList
*
pList
,
tSQLExpr
*
pNode
,
SStrToken
*
pToken
);
tSQLExprList
*
tS
ql
ExprListAppend
(
tSQLExprList
*
pList
,
tSQLExpr
*
pNode
,
SStrToken
*
pToken
);
void
tS
QL
ExprListDestroy
(
tSQLExprList
*
pList
);
void
tS
ql
ExprListDestroy
(
tSQLExprList
*
pList
);
SQuerySQL
*
tSetQueryS
QL
Elems
(
SStrToken
*
pSelectToken
,
tSQLExprList
*
pSelection
,
SArray
*
pFrom
,
tSQLExpr
*
pWhere
,
SQuerySQL
*
tSetQueryS
ql
Elems
(
SStrToken
*
pSelectToken
,
tSQLExprList
*
pSelection
,
SArray
*
pFrom
,
tSQLExpr
*
pWhere
,
SArray
*
pGroupby
,
SArray
*
pSortOrder
,
SIntervalVal
*
pInterval
,
SStrToken
*
pSliding
,
SArray
*
pFill
,
SLimitVal
*
pLimit
,
SLimitVal
*
pGLimit
);
SCreateTableSQL
*
tSetCreateS
QL
Elems
(
SArray
*
pCols
,
SArray
*
pTags
,
SQuerySQL
*
pSelect
,
int32_t
type
);
SCreateTableSQL
*
tSetCreateS
ql
Elems
(
SArray
*
pCols
,
SArray
*
pTags
,
SQuerySQL
*
pSelect
,
int32_t
type
);
void
tS
QL
ExprNodeDestroy
(
tSQLExpr
*
pExpr
);
void
tS
ql
ExprNodeDestroy
(
tSQLExpr
*
pExpr
);
SAlterTableSQL
*
tAlterTableSQL
Elems
(
SStrToken
*
pTableName
,
SArray
*
pCols
,
SArray
*
pVals
,
int32_t
type
);
SAlterTableSQL
*
tAlterTableSql
Elems
(
SStrToken
*
pTableName
,
SArray
*
pCols
,
SArray
*
pVals
,
int32_t
type
);
SCreatedTableInfo
createNewChildTableInfo
(
SStrToken
*
pTableName
,
SArray
*
pTagVals
,
SStrToken
*
pToken
,
SStrToken
*
igExists
);
void
destroyAllSelectClause
(
SSubclauseInfo
*
pSql
);
void
doDestroyQuerySql
(
SQuerySQL
*
pSql
);
void
freeCreateTableInfo
(
void
*
p
);
SSqlInfo
*
setSQL
Info
(
SSqlInfo
*
pInfo
,
void
*
pSqlExprInfo
,
SStrToken
*
pTableName
,
int32_t
type
);
SSqlInfo
*
setSql
Info
(
SSqlInfo
*
pInfo
,
void
*
pSqlExprInfo
,
SStrToken
*
pTableName
,
int32_t
type
);
SSubclauseInfo
*
setSubclause
(
SSubclauseInfo
*
pClause
,
void
*
pSqlExprInfo
);
SSubclauseInfo
*
appendSelectClause
(
SSubclauseInfo
*
pInfo
,
void
*
pSubclause
);
void
setCreatedTableName
(
SSqlInfo
*
pInfo
,
SStrToken
*
pTableNameToken
,
SStrToken
*
pIfNotExists
);
void
S
QL
InfoDestroy
(
SSqlInfo
*
pInfo
);
void
S
ql
InfoDestroy
(
SSqlInfo
*
pInfo
);
void
setDCLSQLElems
(
SSqlInfo
*
pInfo
,
int32_t
type
,
int32_t
nParams
,
...);
void
setDropD
B
TableInfo
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
pToken
,
SStrToken
*
existsCheck
);
void
setDropD
b
TableInfo
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
pToken
,
SStrToken
*
existsCheck
);
void
setShowOptions
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
prefix
,
SStrToken
*
pPatterns
);
tDCLSQL
*
tTokenListAppend
(
tDCLSQL
*
pTokenList
,
SStrToken
*
pToken
);
void
setCreateDBSQL
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
pToken
,
SCreateDBInfo
*
pDB
,
SStrToken
*
pIgExists
);
void
setCreateAcctS
QL
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
pName
,
SStrToken
*
pPwd
,
SCreateAcctSQL
*
pAcctInfo
);
void
setCreateUserS
QL
(
SSqlInfo
*
pInfo
,
SStrToken
*
pName
,
SStrToken
*
pPasswd
);
void
setKillS
QL
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
ip
);
void
setAlterUserS
QL
(
SSqlInfo
*
pInfo
,
int16_t
type
,
SStrToken
*
pName
,
SStrToken
*
pPwd
,
SStrToken
*
pPrivilege
);
void
setCreateAcctS
ql
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
pName
,
SStrToken
*
pPwd
,
SCreateAcctSQL
*
pAcctInfo
);
void
setCreateUserS
ql
(
SSqlInfo
*
pInfo
,
SStrToken
*
pName
,
SStrToken
*
pPasswd
);
void
setKillS
ql
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
ip
);
void
setAlterUserS
ql
(
SSqlInfo
*
pInfo
,
int16_t
type
,
SStrToken
*
pName
,
SStrToken
*
pPwd
,
SStrToken
*
pPrivilege
);
void
setDefaultCreateDbOption
(
SCreateDBInfo
*
pDBInfo
);
// prefix show db.tables;
void
setD
BName
(
SStrToken
*
pCpxName
,
SStrToken
*
pDB
);
void
setD
bName
(
SStrToken
*
pCpxName
,
SStrToken
*
pDb
);
tSQLExpr
*
tS
QLExprIdValueCreate
(
SStrToken
*
pToken
,
int32_t
opt
Type
);
tSQLExpr
*
tS
qlExprIdValueCreate
(
SStrToken
*
pToken
,
int32_t
optr
Type
);
tSQLExpr
*
tS
QL
ExprCreateFunction
(
tSQLExprList
*
pList
,
SStrToken
*
pFuncToken
,
SStrToken
*
endToken
,
int32_t
optType
);
tSQLExpr
*
tS
ql
ExprCreateFunction
(
tSQLExprList
*
pList
,
SStrToken
*
pFuncToken
,
SStrToken
*
endToken
,
int32_t
optType
);
void
tS
QL
SetColumnInfo
(
TAOS_FIELD
*
pField
,
SStrToken
*
pName
,
TAOS_FIELD
*
pType
);
void
tS
ql
SetColumnInfo
(
TAOS_FIELD
*
pField
,
SStrToken
*
pName
,
TAOS_FIELD
*
pType
);
void
tS
QLSetColumnType
(
TAOS_FIELD
*
pField
,
SStrToken
*
pToken
);
void
tS
qlSetColumnType
(
TAOS_FIELD
*
pField
,
SStrToken
*
type
);
void
*
ParseAlloc
(
void
*
(
*
mallocProc
)(
size_t
));
...
...
src/query/inc/sql.y
浏览文件 @
d3618a86
...
...
@@ -298,7 +298,7 @@ cmd ::= CREATE TABLE create_table_args. {}
cmd ::= CREATE TABLE create_table_list(Z). { pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = Z;}
%type create_table_list{SCreateTableSQL*}
%destructor create_table_list{destroyCreateTableS
QL
($$);}
%destructor create_table_list{destroyCreateTableS
ql
($$);}
create_table_list(A) ::= create_from_stable(Z). {
SCreateTableSQL* pCreateTable = calloc(1, sizeof(SCreateTableSQL));
pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo));
...
...
src/query/src/qExecutor.c
浏览文件 @
d3618a86
...
...
@@ -2751,7 +2751,7 @@ int32_t binarySearchForKey(char *pValue, int num, TSKEY key, int order) {
}
numOfRows
=
lastPos
-
firstPos
+
1
;
midPos
=
(
numOfRows
>>
1
)
+
firstPos
;
midPos
=
(
numOfRows
>>
1
u
)
+
firstPos
;
if
(
key
<
keyList
[
midPos
])
{
lastPos
=
midPos
-
1
;
...
...
src/query/src/qParserImpl.c
浏览文件 @
d3618a86
...
...
@@ -71,13 +71,13 @@ abort_parse:
return
sqlInfo
;
}
tSQLExprList
*
tS
QL
ExprListAppend
(
tSQLExprList
*
pList
,
tSQLExpr
*
pNode
,
SStrToken
*
pToken
)
{
tSQLExprList
*
tS
ql
ExprListAppend
(
tSQLExprList
*
pList
,
tSQLExpr
*
pNode
,
SStrToken
*
pToken
)
{
if
(
pList
==
NULL
)
{
pList
=
calloc
(
1
,
sizeof
(
tSQLExprList
));
}
if
(
pList
->
nAlloc
<=
pList
->
nExpr
)
{
pList
->
nAlloc
=
(
pList
->
nAlloc
<<
1
)
+
4
;
pList
->
nAlloc
=
(
pList
->
nAlloc
<<
1
u
)
+
4
;
pList
->
a
=
realloc
(
pList
->
a
,
pList
->
nAlloc
*
sizeof
(
pList
->
a
[
0
]));
if
(
pList
->
a
==
0
)
{
pList
->
nExpr
=
pList
->
nAlloc
=
0
;
...
...
@@ -87,7 +87,7 @@ tSQLExprList *tSQLExprListAppend(tSQLExprList *pList, tSQLExpr *pNode, SStrToken
assert
(
pList
->
a
!=
0
);
if
(
pNode
||
pToken
)
{
struct
tS
QL
ExprItem
*
pItem
=
&
pList
->
a
[
pList
->
nExpr
++
];
struct
tS
ql
ExprItem
*
pItem
=
&
pList
->
a
[
pList
->
nExpr
++
];
memset
(
pItem
,
0
,
sizeof
(
*
pItem
));
pItem
->
pNode
=
pNode
;
if
(
pToken
)
{
// set the as clause
...
...
@@ -101,62 +101,62 @@ tSQLExprList *tSQLExprListAppend(tSQLExprList *pList, tSQLExpr *pNode, SStrToken
return
pList
;
}
void
tS
QL
ExprListDestroy
(
tSQLExprList
*
pList
)
{
void
tS
ql
ExprListDestroy
(
tSQLExprList
*
pList
)
{
if
(
pList
==
NULL
)
return
;
for
(
int32_t
i
=
0
;
i
<
pList
->
nExpr
;
++
i
)
{
if
(
pList
->
a
[
i
].
aliasName
!=
NULL
)
{
free
(
pList
->
a
[
i
].
aliasName
);
}
tS
QL
ExprDestroy
(
pList
->
a
[
i
].
pNode
);
tS
ql
ExprDestroy
(
pList
->
a
[
i
].
pNode
);
}
free
(
pList
->
a
);
free
(
pList
);
}
tSQLExpr
*
tS
QL
ExprIdValueCreate
(
SStrToken
*
pToken
,
int32_t
optrType
)
{
tSQLExpr
*
pS
QL
Expr
=
calloc
(
1
,
sizeof
(
tSQLExpr
));
tSQLExpr
*
tS
ql
ExprIdValueCreate
(
SStrToken
*
pToken
,
int32_t
optrType
)
{
tSQLExpr
*
pS
ql
Expr
=
calloc
(
1
,
sizeof
(
tSQLExpr
));
if
(
pToken
!=
NULL
)
{
pS
QL
Expr
->
token
=
*
pToken
;
pS
ql
Expr
->
token
=
*
pToken
;
}
if
(
optrType
==
TK_INTEGER
||
optrType
==
TK_STRING
||
optrType
==
TK_FLOAT
||
optrType
==
TK_BOOL
)
{
toTSDBType
(
pToken
->
type
);
tVariantCreate
(
&
pS
QL
Expr
->
val
,
pToken
);
pS
QL
Expr
->
nSQLOptr
=
optrType
;
tVariantCreate
(
&
pS
ql
Expr
->
val
,
pToken
);
pS
ql
Expr
->
nSQLOptr
=
optrType
;
}
else
if
(
optrType
==
TK_NOW
)
{
// use microsecond by default
pS
QL
Expr
->
val
.
i64Key
=
taosGetTimestamp
(
TSDB_TIME_PRECISION_MICRO
);
pS
QL
Expr
->
val
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pS
QL
Expr
->
nSQLOptr
=
TK_TIMESTAMP
;
// TK_TIMESTAMP used to denote the time value is in microsecond
pS
ql
Expr
->
val
.
i64Key
=
taosGetTimestamp
(
TSDB_TIME_PRECISION_MICRO
);
pS
ql
Expr
->
val
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pS
ql
Expr
->
nSQLOptr
=
TK_TIMESTAMP
;
// TK_TIMESTAMP used to denote the time value is in microsecond
}
else
if
(
optrType
==
TK_VARIABLE
)
{
int32_t
ret
=
parseAbsoluteDuration
(
pToken
->
z
,
pToken
->
n
,
&
pS
QL
Expr
->
val
.
i64Key
);
int32_t
ret
=
parseAbsoluteDuration
(
pToken
->
z
,
pToken
->
n
,
&
pS
ql
Expr
->
val
.
i64Key
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
}
pS
QL
Expr
->
val
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pS
QL
Expr
->
nSQLOptr
=
TK_TIMESTAMP
;
pS
ql
Expr
->
val
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
pS
ql
Expr
->
nSQLOptr
=
TK_TIMESTAMP
;
}
else
{
// it must be the column name (tk_id) if it is not the number
assert
(
optrType
==
TK_ID
||
optrType
==
TK_ALL
);
if
(
pToken
!=
NULL
)
{
pS
QL
Expr
->
colInfo
=
*
pToken
;
pS
ql
Expr
->
colInfo
=
*
pToken
;
}
pS
QL
Expr
->
nSQLOptr
=
optrType
;
pS
ql
Expr
->
nSQLOptr
=
optrType
;
}
return
pS
QL
Expr
;
return
pS
ql
Expr
;
}
/*
* pList is the parameters for function with id(optType)
* function name is denoted by pFunctionToken
*/
tSQLExpr
*
tS
QL
ExprCreateFunction
(
tSQLExprList
*
pList
,
SStrToken
*
pFuncToken
,
SStrToken
*
endToken
,
int32_t
optType
)
{
tSQLExpr
*
tS
ql
ExprCreateFunction
(
tSQLExprList
*
pList
,
SStrToken
*
pFuncToken
,
SStrToken
*
endToken
,
int32_t
optType
)
{
if
(
pFuncToken
==
NULL
)
return
NULL
;
tSQLExpr
*
pExpr
=
calloc
(
1
,
sizeof
(
tSQLExpr
));
...
...
@@ -177,7 +177,7 @@ tSQLExpr *tSQLExprCreateFunction(tSQLExprList *pList, SStrToken *pFuncToken, SSt
* create binary expression in this procedure
* if the expr is arithmetic, calculate the result and set it to tSQLExpr Object
*/
tSQLExpr
*
tS
QL
ExprCreate
(
tSQLExpr
*
pLeft
,
tSQLExpr
*
pRight
,
int32_t
optrType
)
{
tSQLExpr
*
tS
ql
ExprCreate
(
tSQLExpr
*
pLeft
,
tSQLExpr
*
pRight
,
int32_t
optrType
)
{
tSQLExpr
*
pExpr
=
calloc
(
1
,
sizeof
(
tSQLExpr
));
if
(
pLeft
!=
NULL
&&
pRight
!=
NULL
&&
(
optrType
!=
TK_IN
))
{
...
...
@@ -223,8 +223,8 @@ tSQLExpr *tSQLExprCreate(tSQLExpr *pLeft, tSQLExpr *pRight, int32_t optrType) {
}
}
tS
QL
ExprDestroy
(
pLeft
);
tS
QL
ExprDestroy
(
pRight
);
tS
ql
ExprDestroy
(
pLeft
);
tS
ql
ExprDestroy
(
pRight
);
}
else
if
((
pLeft
->
nSQLOptr
==
TK_FLOAT
&&
pRight
->
nSQLOptr
==
TK_INTEGER
)
||
(
pLeft
->
nSQLOptr
==
TK_INTEGER
&&
pRight
->
nSQLOptr
==
TK_FLOAT
)
||
(
pLeft
->
nSQLOptr
==
TK_FLOAT
&&
pRight
->
nSQLOptr
==
TK_FLOAT
))
{
...
...
@@ -257,8 +257,8 @@ tSQLExpr *tSQLExprCreate(tSQLExpr *pLeft, tSQLExpr *pRight, int32_t optrType) {
}
}
tS
QL
ExprDestroy
(
pLeft
);
tS
QL
ExprDestroy
(
pRight
);
tS
ql
ExprDestroy
(
pLeft
);
tS
ql
ExprDestroy
(
pRight
);
}
else
{
pExpr
->
nSQLOptr
=
optrType
;
...
...
@@ -288,7 +288,7 @@ tSQLExpr *tSQLExprCreate(tSQLExpr *pLeft, tSQLExpr *pRight, int32_t optrType) {
return
pExpr
;
}
void
tS
QL
ExprNodeDestroy
(
tSQLExpr
*
pExpr
)
{
void
tS
ql
ExprNodeDestroy
(
tSQLExpr
*
pExpr
)
{
if
(
pExpr
==
NULL
)
{
return
;
}
...
...
@@ -297,20 +297,20 @@ void tSQLExprNodeDestroy(tSQLExpr *pExpr) {
tVariantDestroy
(
&
pExpr
->
val
);
}
tS
QL
ExprListDestroy
(
pExpr
->
pParam
);
tS
ql
ExprListDestroy
(
pExpr
->
pParam
);
free
(
pExpr
);
}
void
tS
QL
ExprDestroy
(
tSQLExpr
*
pExpr
)
{
void
tS
ql
ExprDestroy
(
tSQLExpr
*
pExpr
)
{
if
(
pExpr
==
NULL
)
{
return
;
}
tS
QL
ExprDestroy
(
pExpr
->
pLeft
);
tS
QL
ExprDestroy
(
pExpr
->
pRight
);
tS
ql
ExprDestroy
(
pExpr
->
pLeft
);
tS
ql
ExprDestroy
(
pExpr
->
pRight
);
tS
QL
ExprNodeDestroy
(
pExpr
);
tS
ql
ExprNodeDestroy
(
pExpr
);
}
SArray
*
tVariantListAppendToken
(
SArray
*
pList
,
SStrToken
*
pToken
,
uint8_t
order
)
{
...
...
@@ -366,13 +366,13 @@ SArray *tVariantListInsert(SArray *pList, tVariant *pVar, uint8_t sortOrder, int
return
pList
;
}
void
setD
BName
(
SStrToken
*
pCpxName
,
SStrToken
*
pDB
)
{
pCpxName
->
type
=
pD
B
->
type
;
pCpxName
->
z
=
pD
B
->
z
;
pCpxName
->
n
=
pD
B
->
n
;
void
setD
bName
(
SStrToken
*
pCpxName
,
SStrToken
*
pDb
)
{
pCpxName
->
type
=
pD
b
->
type
;
pCpxName
->
z
=
pD
b
->
z
;
pCpxName
->
n
=
pD
b
->
n
;
}
void
tS
QL
SetColumnInfo
(
TAOS_FIELD
*
pField
,
SStrToken
*
pName
,
TAOS_FIELD
*
pType
)
{
void
tS
ql
SetColumnInfo
(
TAOS_FIELD
*
pField
,
SStrToken
*
pName
,
TAOS_FIELD
*
pType
)
{
int32_t
maxLen
=
sizeof
(
pField
->
name
)
/
sizeof
(
pField
->
name
[
0
]);
// truncate the column name
...
...
@@ -387,7 +387,7 @@ void tSQLSetColumnInfo(TAOS_FIELD *pField, SStrToken *pName, TAOS_FIELD *pType)
pField
->
bytes
=
pType
->
bytes
;
}
void
tS
QL
SetColumnType
(
TAOS_FIELD
*
pField
,
SStrToken
*
type
)
{
void
tS
ql
SetColumnType
(
TAOS_FIELD
*
pField
,
SStrToken
*
type
)
{
pField
->
type
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
tListLen
(
tDataTypeDesc
);
++
i
)
{
...
...
@@ -438,7 +438,7 @@ void tSQLSetColumnType(TAOS_FIELD *pField, SStrToken *type) {
/*
* extract the select info out of sql string
*/
SQuerySQL
*
tSetQueryS
QL
Elems
(
SStrToken
*
pSelectToken
,
tSQLExprList
*
pSelection
,
SArray
*
pFrom
,
tSQLExpr
*
pWhere
,
SQuerySQL
*
tSetQueryS
ql
Elems
(
SStrToken
*
pSelectToken
,
tSQLExprList
*
pSelection
,
SArray
*
pFrom
,
tSQLExpr
*
pWhere
,
SArray
*
pGroupby
,
SArray
*
pSortOrder
,
SIntervalVal
*
pInterval
,
SStrToken
*
pSliding
,
SArray
*
pFill
,
SLimitVal
*
pLimit
,
SLimitVal
*
pGLimit
)
{
assert
(
pSelection
!=
NULL
);
...
...
@@ -490,12 +490,12 @@ void doDestroyQuerySql(SQuerySQL *pQuerySql) {
if
(
pQuerySql
==
NULL
)
{
return
;
}
tS
QL
ExprListDestroy
(
pQuerySql
->
pSelection
);
tS
ql
ExprListDestroy
(
pQuerySql
->
pSelection
);
pQuerySql
->
pSelection
=
NULL
;
tS
QL
ExprDestroy
(
pQuerySql
->
pWhere
);
tS
ql
ExprDestroy
(
pQuerySql
->
pWhere
);
pQuerySql
->
pWhere
=
NULL
;
taosArrayDestroyEx
(
pQuerySql
->
pSortOrder
,
freeVariant
);
...
...
@@ -526,7 +526,7 @@ void destroyAllSelectClause(SSubclauseInfo *pClause) {
tfree
(
pClause
->
pClause
);
}
SCreateTableSQL
*
tSetCreateS
QL
Elems
(
SArray
*
pCols
,
SArray
*
pTags
,
SQuerySQL
*
pSelect
,
int32_t
type
)
{
SCreateTableSQL
*
tSetCreateS
ql
Elems
(
SArray
*
pCols
,
SArray
*
pTags
,
SQuerySQL
*
pSelect
,
int32_t
type
)
{
SCreateTableSQL
*
pCreate
=
calloc
(
1
,
sizeof
(
SCreateTableSQL
));
switch
(
type
)
{
...
...
@@ -570,7 +570,7 @@ SCreatedTableInfo createNewChildTableInfo(SStrToken *pTableName, SArray *pTagVal
return
info
;
}
SAlterTableSQL
*
tAlterTableS
QL
Elems
(
SStrToken
*
pTableName
,
SArray
*
pCols
,
SArray
*
pVals
,
int32_t
type
)
{
SAlterTableSQL
*
tAlterTableS
ql
Elems
(
SStrToken
*
pTableName
,
SArray
*
pCols
,
SArray
*
pVals
,
int32_t
type
)
{
SAlterTableSQL
*
pAlterTable
=
calloc
(
1
,
sizeof
(
SAlterTableSQL
));
pAlterTable
->
name
=
*
pTableName
;
...
...
@@ -591,7 +591,7 @@ SAlterTableSQL *tAlterTableSQLElems(SStrToken *pTableName, SArray *pCols, SArray
return
pAlterTable
;
}
void
*
destroyCreateTableS
QL
(
SCreateTableSQL
*
pCreate
)
{
void
*
destroyCreateTableS
ql
(
SCreateTableSQL
*
pCreate
)
{
doDestroyQuerySql
(
pCreate
->
pSelect
);
taosArrayDestroy
(
pCreate
->
colInfo
.
pColumns
);
...
...
@@ -603,13 +603,13 @@ void* destroyCreateTableSQL(SCreateTableSQL* pCreate) {
return
NULL
;
}
void
S
QL
InfoDestroy
(
SSqlInfo
*
pInfo
)
{
void
S
ql
InfoDestroy
(
SSqlInfo
*
pInfo
)
{
if
(
pInfo
==
NULL
)
return
;
if
(
pInfo
->
type
==
TSDB_SQL_SELECT
)
{
destroyAllSelectClause
(
&
pInfo
->
subclauseInfo
);
}
else
if
(
pInfo
->
type
==
TSDB_SQL_CREATE_TABLE
)
{
pInfo
->
pCreateTableInfo
=
destroyCreateTableS
QL
(
pInfo
->
pCreateTableInfo
);
pInfo
->
pCreateTableInfo
=
destroyCreateTableS
ql
(
pInfo
->
pCreateTableInfo
);
}
else
if
(
pInfo
->
type
==
TSDB_SQL_ALTER_TABLE
)
{
taosArrayDestroyEx
(
pInfo
->
pAlterInfo
->
varList
,
freeVariant
);
taosArrayDestroy
(
pInfo
->
pAlterInfo
->
pAddColumns
);
...
...
@@ -647,7 +647,7 @@ SSubclauseInfo* setSubclause(SSubclauseInfo* pSubclause, void *pSqlExprInfo) {
return
pSubclause
;
}
SSqlInfo
*
setSQL
Info
(
SSqlInfo
*
pInfo
,
void
*
pSqlExprInfo
,
SStrToken
*
pTableName
,
int32_t
type
)
{
SSqlInfo
*
setSql
Info
(
SSqlInfo
*
pInfo
,
void
*
pSqlExprInfo
,
SStrToken
*
pTableName
,
int32_t
type
)
{
pInfo
->
type
=
type
;
if
(
type
==
TSDB_SQL_SELECT
)
{
...
...
@@ -683,7 +683,7 @@ void setCreatedTableName(SSqlInfo *pInfo, SStrToken *pTableNameToken, SStrToken
void
tTokenListBuyMoreSpace
(
tDCLSQL
*
pTokenList
)
{
if
(
pTokenList
->
nAlloc
<=
pTokenList
->
nTokens
)
{
//
pTokenList
->
nAlloc
=
(
pTokenList
->
nAlloc
<<
1
)
+
4
;
pTokenList
->
nAlloc
=
(
pTokenList
->
nAlloc
<<
1
u
)
+
4
;
pTokenList
->
a
=
realloc
(
pTokenList
->
a
,
pTokenList
->
nAlloc
*
sizeof
(
pTokenList
->
a
[
0
]));
if
(
pTokenList
->
a
==
0
)
{
pTokenList
->
nTokens
=
pTokenList
->
nAlloc
=
0
;
...
...
@@ -718,7 +718,7 @@ void setDCLSQLElems(SSqlInfo *pInfo, int32_t type, int32_t nParam, ...) {
va_end
(
va
);
}
void
setDropD
B
TableInfo
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
pToken
,
SStrToken
*
existsCheck
)
{
void
setDropD
b
TableInfo
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
pToken
,
SStrToken
*
existsCheck
)
{
pInfo
->
type
=
type
;
pInfo
->
pDCLInfo
=
tTokenListAppend
(
pInfo
->
pDCLInfo
,
pToken
);
pInfo
->
pDCLInfo
->
existsCheck
=
(
existsCheck
->
n
==
1
);
...
...
@@ -758,7 +758,7 @@ void setCreateDBSQL(SSqlInfo *pInfo, int32_t type, SStrToken *pToken, SCreateDBI
pInfo
->
pDCLInfo
->
dbOpt
.
ignoreExists
=
pIgExists
->
n
;
// sql.y has: ifnotexists(X) ::= IF NOT EXISTS. {X.n = 1;}
}
void
setCreateAcctS
QL
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
pName
,
SStrToken
*
pPwd
,
SCreateAcctSQL
*
pAcctInfo
)
{
void
setCreateAcctS
ql
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
pName
,
SStrToken
*
pPwd
,
SCreateAcctSQL
*
pAcctInfo
)
{
pInfo
->
type
=
type
;
if
(
pInfo
->
pDCLInfo
==
NULL
)
{
pInfo
->
pDCLInfo
=
calloc
(
1
,
sizeof
(
tDCLSQL
));
...
...
@@ -774,7 +774,7 @@ void setCreateAcctSQL(SSqlInfo *pInfo, int32_t type, SStrToken *pName, SStrToken
}
}
void
setCreateUserS
QL
(
SSqlInfo
*
pInfo
,
SStrToken
*
pName
,
SStrToken
*
pPasswd
)
{
void
setCreateUserS
ql
(
SSqlInfo
*
pInfo
,
SStrToken
*
pName
,
SStrToken
*
pPasswd
)
{
pInfo
->
type
=
TSDB_SQL_CREATE_USER
;
if
(
pInfo
->
pDCLInfo
==
NULL
)
{
pInfo
->
pDCLInfo
=
calloc
(
1
,
sizeof
(
tDCLSQL
));
...
...
@@ -786,7 +786,7 @@ void setCreateUserSQL(SSqlInfo *pInfo, SStrToken *pName, SStrToken *pPasswd) {
pInfo
->
pDCLInfo
->
user
.
passwd
=
*
pPasswd
;
}
void
setAlterUserS
QL
(
SSqlInfo
*
pInfo
,
int16_t
type
,
SStrToken
*
pName
,
SStrToken
*
pPwd
,
SStrToken
*
pPrivilege
)
{
void
setAlterUserS
ql
(
SSqlInfo
*
pInfo
,
int16_t
type
,
SStrToken
*
pName
,
SStrToken
*
pPwd
,
SStrToken
*
pPrivilege
)
{
pInfo
->
type
=
TSDB_SQL_ALTER_USER
;
if
(
pInfo
->
pDCLInfo
==
NULL
)
{
pInfo
->
pDCLInfo
=
calloc
(
1
,
sizeof
(
tDCLSQL
));
...
...
@@ -811,7 +811,7 @@ void setAlterUserSQL(SSqlInfo *pInfo, int16_t type, SStrToken *pName, SStrToken*
}
}
void
setKillS
QL
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
ip
)
{
void
setKillS
ql
(
SSqlInfo
*
pInfo
,
int32_t
type
,
SStrToken
*
ip
)
{
pInfo
->
type
=
type
;
if
(
pInfo
->
pDCLInfo
==
NULL
)
{
pInfo
->
pDCLInfo
=
calloc
(
1
,
sizeof
(
tDCLSQL
));
...
...
src/query/src/sql.c
浏览文件 @
d3618a86
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录