Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
77094cc5
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
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看板
提交
77094cc5
编写于
10月 08, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-10529]fix compiler error.
上级
36ccd827
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
806 addition
and
140 deletion
+806
-140
include/common/tmsgtype.h
include/common/tmsgtype.h
+4
-6
include/common/tvariant.h
include/common/tvariant.h
+1
-1
include/libs/parser/parser.h
include/libs/parser/parser.h
+2
-2
source/common/src/sqlcmdstr.c
source/common/src/sqlcmdstr.c
+1
-1
source/common/src/tvariant.c
source/common/src/tvariant.c
+33
-35
source/libs/executor/src/texpr.c
source/libs/executor/src/texpr.c
+9
-9
source/libs/parser/inc/astGenerator.h
source/libs/parser/inc/astGenerator.h
+3
-3
source/libs/parser/src/astGenerator.c
source/libs/parser/src/astGenerator.c
+730
-60
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+3
-3
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+1
-1
src/query/inc/sql.y
src/query/inc/sql.y
+14
-14
src/query/src/qSqlParser.c
src/query/src/qSqlParser.c
+1
-1
src/query/src/sql.c
src/query/src/sql.c
+3
-3
未找到文件。
include/common/t
cmd
type.h
→
include/common/t
msg
type.h
浏览文件 @
77094cc5
...
...
@@ -24,7 +24,7 @@ extern "C" {
#ifdef TSDB_SQL_C
#define TSDB_DEFINE_SQL_TYPE( name, msg ) msg,
char
*
sql
Cmd
[]
=
{
char
*
sql
MsgType
[]
=
{
"null"
,
#else
#define TSDB_DEFINE_SQL_TYPE( name, msg ) name,
...
...
@@ -103,15 +103,13 @@ enum {
};
// create table operation type
enum
TSQL_TYPE
{
TSQL_CREATE_TABLE
=
0x1
,
enum
TSQL_
CREATE_TABLE_
TYPE
{
TSQL_CREATE_TABLE
=
0x1
,
TSQL_CREATE_STABLE
=
0x2
,
TSQL_CREATE_
TABLE_FROM_S
TABLE
=
0x3
,
TSQL_CREATE_
C
TABLE
=
0x3
,
TSQL_CREATE_STREAM
=
0x4
,
};
extern
char
*
sqlCmd
[];
#ifdef __cplusplus
}
#endif
...
...
include/common/tvariant.h
浏览文件 @
77094cc5
...
...
@@ -38,7 +38,7 @@ typedef struct SVariant {
bool
taosVariantIsValid
(
SVariant
*
pVar
);
//void taosVariantCreate(SVariant *pVar, SToken *token
);
void
taosVariantCreate
(
SVariant
*
pVar
,
char
*
z
,
int32_t
n
,
int32_t
type
);
void
taosVariantCreateFromBinary
(
SVariant
*
pVar
,
const
char
*
pz
,
size_t
len
,
uint32_t
type
);
...
...
include/libs/parser/parser.h
浏览文件 @
77094cc5
...
...
@@ -183,7 +183,7 @@ bool qIsInsertSql(const char* pStr, size_t length);
* @param msg extended error message if exists.
* @return error code
*/
int32_t
qParseQuerySql
(
const
char
*
pStr
,
size_t
length
,
struct
SQueryStmtInfo
**
pQueryInfo
,
int64_t
id
,
char
*
msg
);
int32_t
qParseQuerySql
(
const
char
*
pStr
,
size_t
length
,
struct
SQueryStmtInfo
**
pQueryInfo
,
int64_t
id
,
char
*
msg
,
int32_t
msgLen
);
/**
* Parse the insert sql statement.
...
...
@@ -194,7 +194,7 @@ int32_t qParseQuerySql(const char* pStr, size_t length, struct SQueryStmtInfo**
* @param msg extended error message if exists to help avoid the problem in sql statement.
* @return
*/
int32_t
qParseInsertSql
(
const
char
*
pStr
,
size_t
length
,
struct
SInsertStmtInfo
**
pInsertInfo
,
int64_t
id
,
char
*
msg
);
int32_t
qParseInsertSql
(
const
char
*
pStr
,
size_t
length
,
struct
SInsertStmtInfo
**
pInsertInfo
,
int64_t
id
,
char
*
msg
,
int32_t
msgLen
);
/**
* Convert a normal sql statement to only query tags information to enable that the subscribe client can be aware quickly of the true vgroup ids that
...
...
source/common/src/sqlcmdstr.c
浏览文件 @
77094cc5
...
...
@@ -15,4 +15,4 @@
#define TSDB_SQL_C
#include "t
cmd
type.h"
#include "t
msg
type.h"
source/common/src/tvariant.c
浏览文件 @
77094cc5
...
...
@@ -29,18 +29,16 @@
if ((res) > (maxv)) { *exti = 1; break; } \
assert(0); \
} while (0)
#if 0
void tVariantCreate(SVariant *pVar, SToken *token) {
int32_t ret = 0;
int32_t type = token->type;
void
taosVariantCreate
(
SVariant
*
pVar
,
char
*
z
,
int32_t
n
,
int32_t
type
)
{
int32_t
ret
=
0
;
memset
(
pVar
,
0
,
sizeof
(
SVariant
));
switch (t
oken->t
ype) {
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
{
if (strncasecmp(
token->
z, "true", 4) == 0) {
if
(
strncasecmp
(
z
,
"true"
,
4
)
==
0
)
{
pVar
->
i64
=
TSDB_TRUE
;
} else if (strncasecmp(
token->
z, "false", 5) == 0) {
}
else
if
(
strncasecmp
(
z
,
"false"
,
5
)
==
0
)
{
pVar
->
i64
=
TSDB_FALSE
;
}
else
{
return
;
...
...
@@ -53,35 +51,35 @@ void tVariantCreate(SVariant *pVar, SToken *token) {
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_INT
:{
ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, true);
if (ret != 0) {
SToken t = {0};
tGetToken(token->z, &t.type);
if (t.type == TK_MINUS) { // it is a signed number which is greater than INT64_MAX or less than INT64_MIN
pVar->nType = -1; // -1 means error type
return;
}
// data overflow, try unsigned parse the input number
ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, false);
if (ret != 0) {
pVar->nType = -1; // -1 means error type
return;
}
}
//
ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, true);
//
if (ret != 0) {
//
SToken t = {0};
//
tGetToken(token->z, &t.type);
//
if (t.type == TK_MINUS) { // it is a signed number which is greater than INT64_MAX or less than INT64_MIN
//
pVar->nType = -1; // -1 means error type
//
return;
//
}
//
//
// data overflow, try unsigned parse the input number
//
ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, false);
//
if (ret != 0) {
//
pVar->nType = -1; // -1 means error type
//
return;
//
}
//
}
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
case
TSDB_DATA_TYPE_FLOAT
:
{
pVar->d = strtod(
token->
z, NULL);
pVar
->
d
=
strtod
(
z
,
NULL
);
break
;
}
case
TSDB_DATA_TYPE_BINARY
:
{
pVar->pz = strndup(
token->z, token->
n);
pVar->nLen = strRmquote(pVar->pz,
token->
n);
pVar
->
pz
=
strndup
(
z
,
n
);
pVar
->
nLen
=
strRmquote
(
pVar
->
pz
,
n
);
break
;
}
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
...
...
@@ -96,7 +94,7 @@ void tVariantCreate(SVariant *pVar, SToken *token) {
pVar
->
nType
=
type
;
}
#endif
/**
* create SVariant from binary string, not ascii data
...
...
@@ -105,7 +103,7 @@ void tVariantCreate(SVariant *pVar, SToken *token) {
* @param len
* @param type
*/
void
tVariantCreateFromBinary
(
SVariant
*
pVar
,
const
char
*
pz
,
size_t
len
,
uint32_t
type
)
{
void
t
aos
VariantCreateFromBinary
(
SVariant
*
pVar
,
const
char
*
pz
,
size_t
len
,
uint32_t
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
{
...
...
@@ -183,7 +181,7 @@ void tVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uint32
pVar
->
nType
=
type
;
}
void
tVariantDestroy
(
SVariant
*
pVar
)
{
void
t
aos
VariantDestroy
(
SVariant
*
pVar
)
{
if
(
pVar
==
NULL
)
return
;
if
(
pVar
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pVar
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
...
...
@@ -206,12 +204,12 @@ void tVariantDestroy(SVariant *pVar) {
}
}
bool
tVariantIsValid
(
SVariant
*
pVar
)
{
bool
t
aos
VariantIsValid
(
SVariant
*
pVar
)
{
assert
(
pVar
!=
NULL
);
return
isValidDataType
(
pVar
->
nType
);
}
void
tVariantAssign
(
SVariant
*
pDst
,
const
SVariant
*
pSrc
)
{
void
t
aos
VariantAssign
(
SVariant
*
pDst
,
const
SVariant
*
pSrc
)
{
if
(
pSrc
==
NULL
||
pDst
==
NULL
)
return
;
pDst
->
nType
=
pSrc
->
nType
;
...
...
@@ -255,7 +253,7 @@ void tVariantAssign(SVariant *pDst, const SVariant *pSrc) {
}
}
int32_t
tVariantCompare
(
const
SVariant
*
p1
,
const
SVariant
*
p2
)
{
int32_t
t
aos
VariantCompare
(
const
SVariant
*
p1
,
const
SVariant
*
p2
)
{
if
(
p1
->
nType
==
TSDB_DATA_TYPE_NULL
&&
p2
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
return
0
;
}
...
...
@@ -295,7 +293,7 @@ int32_t tVariantCompare(const SVariant* p1, const SVariant* p2) {
}
}
int32_t
tVariantToString
(
SVariant
*
pVar
,
char
*
dst
)
{
int32_t
t
aos
VariantToString
(
SVariant
*
pVar
,
char
*
dst
)
{
if
(
pVar
==
NULL
||
dst
==
NULL
)
return
0
;
switch
(
pVar
->
nType
)
{
...
...
@@ -893,7 +891,7 @@ int32_t tVariantDumpEx(SVariant *pVariant, char *payload, int16_t type, bool inc
* transfer data from variant serve as the implicit data conversion: from input sql string pVariant->nType
* to column type defined in schema
*/
int32_t
tVariantDump
(
SVariant
*
pVariant
,
char
*
payload
,
int16_t
type
,
bool
includeLengthPrefix
)
{
int32_t
t
aos
VariantDump
(
SVariant
*
pVariant
,
char
*
payload
,
int16_t
type
,
bool
includeLengthPrefix
)
{
return
tVariantDumpEx
(
pVariant
,
payload
,
type
,
includeLengthPrefix
,
NULL
,
NULL
);
}
...
...
@@ -974,4 +972,4 @@ int32_t tVariantTypeSetType(SVariant *pVariant, char type) {
}
return
0
;
}
}
\ No newline at end of file
source/libs/executor/src/texpr.c
浏览文件 @
77094cc5
...
...
@@ -117,7 +117,7 @@ void tExprTreeDestroy(tExprNode *pNode, void (*fp)(void *)) {
if
(
pNode
->
nodeType
==
TSQL_NODE_EXPR
)
{
doExprTreeDestroy
(
&
pNode
,
fp
);
}
else
if
(
pNode
->
nodeType
==
TSQL_NODE_VALUE
)
{
tVariantDestroy
(
pNode
->
pVal
);
t
aos
VariantDestroy
(
pNode
->
pVal
);
}
else
if
(
pNode
->
nodeType
==
TSQL_NODE_COL
)
{
tfree
(
pNode
->
pSchema
);
}
...
...
@@ -138,7 +138,7 @@ static void doExprTreeDestroy(tExprNode **pExpr, void (*fp)(void *)) {
fp
((
*
pExpr
)
->
_node
.
info
);
}
}
else
if
((
*
pExpr
)
->
nodeType
==
TSQL_NODE_VALUE
)
{
tVariantDestroy
((
*
pExpr
)
->
pVal
);
t
aos
VariantDestroy
((
*
pExpr
)
->
pVal
);
free
((
*
pExpr
)
->
pVal
);
}
else
if
((
*
pExpr
)
->
nodeType
==
TSQL_NODE_COL
)
{
free
((
*
pExpr
)
->
pSchema
);
...
...
@@ -492,8 +492,8 @@ void buildFilterSetFromBinary(void **q, const char *buf, int32_t len) {
uint32_t
type
=
tbufReadUint32
(
&
br
);
SHashObj
*
pObj
=
taosHashInit
(
256
,
taosGetDefaultHashFunction
(
type
),
true
,
false
);
taosHashSetEqualFp
(
pObj
,
taosGetDefaultEqualFunction
(
type
));
// taosHashSetEqualFp(pObj, taosGetDefaultEqualFunction(type));
int
dummy
=
-
1
;
int32_t
sz
=
tbufReadInt32
(
&
br
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
...
...
@@ -528,7 +528,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
uint32_t
sType
=
tbufReadUint32
(
&
br
);
SHashObj
*
pObj
=
taosHashInit
(
256
,
taosGetDefaultHashFunction
(
tType
),
true
,
false
);
taosHashSetEqualFp
(
pObj
,
taosGetDefaultEqualFunction
(
tType
));
// taosHashSetEqualFp(pObj, taosGetDefaultEqualFunction(tType));
int
dummy
=
-
1
;
SVariant
tmpVar
=
{
0
};
...
...
@@ -603,7 +603,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
return
;
}
tVariantCreateFromBinary
(
&
tmpVar
,
(
char
*
)
pvar
,
t
,
sType
);
t
aos
VariantCreateFromBinary
(
&
tmpVar
,
(
char
*
)
pvar
,
t
,
sType
);
if
(
bufLen
<
t
)
{
tmp
=
realloc
(
tmp
,
t
*
TSDB_NCHAR_SIZE
);
...
...
@@ -686,7 +686,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
}
taosHashPut
(
pObj
,
(
char
*
)
pvar
,
t
,
&
dummy
,
sizeof
(
dummy
));
tVariantDestroy
(
&
tmpVar
);
t
aos
VariantDestroy
(
&
tmpVar
);
memset
(
&
tmpVar
,
0
,
sizeof
(
tmpVar
));
}
...
...
@@ -694,7 +694,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
pObj
=
NULL
;
err_ret:
tVariantDestroy
(
&
tmpVar
);
t
aos
VariantDestroy
(
&
tmpVar
);
taosHashCleanup
(
pObj
);
tfree
(
tmp
);
}
...
...
@@ -716,7 +716,7 @@ tExprNode* exprdup(tExprNode* pNode) {
pCloned
->
_node
.
hasPK
=
pNode
->
_node
.
hasPK
;
}
else
if
(
pNode
->
nodeType
==
TSQL_NODE_VALUE
)
{
pCloned
->
pVal
=
calloc
(
1
,
sizeof
(
SVariant
));
tVariantAssign
(
pCloned
->
pVal
,
pNode
->
pVal
);
t
aos
VariantAssign
(
pCloned
->
pVal
,
pNode
->
pVal
);
}
else
if
(
pNode
->
nodeType
==
TSQL_NODE_COL
)
{
pCloned
->
pSchema
=
calloc
(
1
,
sizeof
(
SSchema
));
*
pCloned
->
pSchema
=
*
pNode
->
pSchema
;
...
...
source/libs/parser/inc/astGenerator.h
浏览文件 @
77094cc5
...
...
@@ -285,8 +285,7 @@ int32_t tSqlExprCompare(tSqlExpr *left, tSqlExpr *right);
SCreateTableSql
*
tSetCreateTableInfo
(
SArray
*
pCols
,
SArray
*
pTags
,
SSqlNode
*
pSelect
,
int32_t
type
);
SAlterTableInfo
*
tSetAlterTableInfo
(
SToken
*
pTableName
,
SArray
*
pCols
,
SArray
*
pVals
,
int32_t
type
,
int16_t
tableTable
);
SAlterTableInfo
*
tSetAlterTableInfo
(
SToken
*
pTableName
,
SArray
*
pCols
,
SArray
*
pVals
,
int32_t
type
,
int16_t
tableType
);
SCreatedTableInfo
createNewChildTableInfo
(
SToken
*
pTableName
,
SArray
*
pTagNames
,
SArray
*
pTagVals
,
SToken
*
pToken
,
SToken
*
igExists
);
...
...
@@ -299,6 +298,7 @@ SArray *setSubclause(SArray *pList, void *pSqlNode);
SArray
*
appendSelectClause
(
SArray
*
pList
,
void
*
pSubclause
);
void
setCreatedTableName
(
SSqlInfo
*
pInfo
,
SToken
*
pTableNameToken
,
SToken
*
pIfNotExists
);
void
*
destroyCreateTableSql
(
SCreateTableSql
*
pCreate
);
void
SqlInfoDestroy
(
SSqlInfo
*
pInfo
);
...
...
@@ -351,7 +351,7 @@ void *ParseAlloc(void *(*mallocProc)(size_t));
* @param str sql string
* @return sql ast
*/
SSqlInfo
gen
AST
(
const
char
*
str
);
SSqlInfo
doGenerate
AST
(
const
char
*
str
);
#ifdef __cplusplus
}
...
...
source/libs/parser/src/astGenerator.c
浏览文件 @
77094cc5
此差异已折叠。
点击以展开。
source/libs/parser/src/parser.c
浏览文件 @
77094cc5
...
...
@@ -21,13 +21,13 @@ bool qIsInsertSql(const char* pStr, size_t length) {
return
false
;
}
int32_t
qParseQuerySql
(
const
char
*
pStr
,
size_t
length
,
struct
SQueryStmtInfo
**
pQueryInfo
,
int64_t
id
,
char
*
msg
)
{
int32_t
qParseQuerySql
(
const
char
*
pStr
,
size_t
length
,
struct
SQueryStmtInfo
**
pQueryInfo
,
int64_t
id
,
char
*
msg
,
int32_t
msgLen
)
{
*
pQueryInfo
=
calloc
(
1
,
sizeof
(
SQueryStmtInfo
));
if
(
*
pQueryInfo
==
NULL
)
{
return
-
1
;
// set correct error code.
}
SSqlInfo
info
=
gen
AST
(
pStr
);
SSqlInfo
info
=
doGenerate
AST
(
pStr
);
if
(
!
info
.
valid
)
{
strcpy
(
msg
,
info
.
msg
);
return
-
1
;
// set correct error code.
...
...
@@ -42,7 +42,7 @@ int32_t qParseQuerySql(const char* pStr, size_t length, struct SQueryStmtInfo**
return
0
;
}
int32_t
qParseInsertSql
(
const
char
*
pStr
,
size_t
length
,
struct
SInsertStmtInfo
**
pInsertInfo
,
int64_t
id
,
char
*
msg
)
{
int32_t
qParseInsertSql
(
const
char
*
pStr
,
size_t
length
,
struct
SInsertStmtInfo
**
pInsertInfo
,
int64_t
id
,
char
*
msg
,
int32_t
msgLen
)
{
return
0
;
}
...
...
src/client/inc/tsclient.h
浏览文件 @
77094cc5
...
...
@@ -36,7 +36,7 @@ extern "C" {
#include "qSqlparser.h"
#include "qTsbuf.h"
#include "qUtil.h"
#include "t
cmd
type.h"
#include "t
msg
type.h"
typedef
enum
{
TAOS_REQ_FROM_SHELL
,
...
...
src/client/src/tscServer.c
浏览文件 @
77094cc5
...
...
@@ -17,8 +17,8 @@
#include "os.h"
#include "qPlan.h"
#include "qTableMeta.h"
#include "tcmdtype.h"
#include "tlockfree.h"
#include "tmsgtype.h"
#include "trpc.h"
#include "tscGlobalmerge.h"
#include "tscLog.h"
...
...
src/query/inc/sql.y
浏览文件 @
77094cc5
...
...
@@ -259,7 +259,7 @@ acct_optr(Y) ::= pps(C) tseries(D) storage(P) streams(F) qtime(Q) dbs(E) users(K
intitemlist(A) ::= intitemlist(X) COMMA intitem(Y). { A = tVariantListAppend(X, &Y, -1); }
intitemlist(A) ::= intitem(X). { A = tVariantListAppend(NULL, &X, -1); }
intitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
intitem(A) ::= INTEGER(X). { toTSDBType(X.type); t
aos
VariantCreate(&A, &X); }
%type keep {SArray*}
%destructor keep {taosArrayDestroy($$);}
...
...
@@ -444,39 +444,39 @@ column(A) ::= ids(X) typename(Y). {
tagitemlist(A) ::= tagitemlist(X) COMMA tagitem(Y). { A = tVariantListAppend(X, &Y, -1); }
tagitemlist(A) ::= tagitem(X). { A = tVariantListAppend(NULL, &X, -1); }
tagitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
tagitem(A) ::= STRING(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
tagitem(A) ::= BOOL(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
tagitem(A) ::= NULL(X). { X.type = 0; tVariantCreate(&A, &X); }
tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&A, &X);}
tagitem(A) ::= INTEGER(X). { toTSDBType(X.type); t
aos
VariantCreate(&A, &X); }
tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); t
aos
VariantCreate(&A, &X); }
tagitem(A) ::= STRING(X). { toTSDBType(X.type); t
aos
VariantCreate(&A, &X); }
tagitem(A) ::= BOOL(X). { toTSDBType(X.type); t
aos
VariantCreate(&A, &X); }
tagitem(A) ::= NULL(X). { X.type = 0; t
aos
VariantCreate(&A, &X); }
tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; t
aos
VariantCreate(&A, &X);}
tagitem(A) ::= MINUS(X) INTEGER(Y).{
X.n += Y.n;
X.type = Y.type;
toTSDBType(X.type);
tVariantCreate(&A, &X);
t
aos
VariantCreate(&A, &X);
}
tagitem(A) ::= MINUS(X) FLOAT(Y). {
X.n += Y.n;
X.type = Y.type;
toTSDBType(X.type);
tVariantCreate(&A, &X);
t
aos
VariantCreate(&A, &X);
}
tagitem(A) ::= PLUS(X) INTEGER(Y). {
X.n += Y.n;
X.type = Y.type;
toTSDBType(X.type);
tVariantCreate(&A, &X);
t
aos
VariantCreate(&A, &X);
}
tagitem(A) ::= PLUS(X) FLOAT(Y). {
X.n += Y.n;
X.type = Y.type;
toTSDBType(X.type);
tVariantCreate(&A, &X);
t
aos
VariantCreate(&A, &X);
}
//////////////////////// The SELECT statement /////////////////////////////////
...
...
@@ -599,7 +599,7 @@ fill_opt(N) ::= . { N = 0; }
fill_opt(N) ::= FILL LP ID(Y) COMMA tagitemlist(X) RP. {
tVariant A = {0};
toTSDBType(Y.type);
tVariantCreate(&A, &Y);
t
aos
VariantCreate(&A, &Y);
tVariantListInsert(X, &A, -1, 0);
N = X;
...
...
@@ -639,7 +639,7 @@ item(A) ::= ids(X) cpxName(Y). {
toTSDBType(X.type);
X.n += Y.n;
tVariantCreate(&A, &X);
t
aos
VariantCreate(&A, &X);
}
%type sortorder {int}
...
...
@@ -719,7 +719,7 @@ expr(A) ::= BOOL(X). { A = tSqlExprCreateIdValue(&X, TK_BOOL);}
expr(A) ::= NULL(X). { A = tSqlExprCreateIdValue(&X, TK_NULL);}
// ordinary functions: min(x), max(x), top(k, 20)
expr(A) ::= ID(X) LP exprlist(Y) RP(E). {
tStrTokenAppend
(pInfo->funcs, &X); A = tSqlExprCreateFunction(Y, &X, &E, X.type); }
expr(A) ::= ID(X) LP exprlist(Y) RP(E). { (pInfo->funcs, &X); A = tSqlExprCreateFunction(Y, &X, &E, X.type); }
// for parsing sql functions with wildcard for parameters. e.g., count(*)/first(*)/last(*) operation
expr(A) ::= ID(X) LP STAR RP(Y). { tStrTokenAppend(pInfo->funcs, &X); A = tSqlExprCreateFunction(NULL, &X, &Y, X.type); }
...
...
src/query/src/qSqlParser.c
浏览文件 @
77094cc5
...
...
@@ -17,7 +17,7 @@
#include "os.h"
#include "taosdef.h"
#include "taosmsg.h"
#include "t
cmd
type.h"
#include "t
msg
type.h"
#include "tstrbuild.h"
#include "ttoken.h"
#include "ttokendef.h"
...
...
src/query/src/sql.c
浏览文件 @
77094cc5
...
...
@@ -27,13 +27,13 @@
/************ Begin %include sections from the grammar ************************/
#line 23 "sql.y"
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
#include "qSqlparser.h"
#include "t
cmd
type.h"
#include "t
msg
type.h"
#include "ttoken.h"
#include "ttokendef.h"
#include "tutil.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录