Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
46d8e1eb
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
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看板
提交
46d8e1eb
编写于
10月 29, 2020
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify code
上级
9f7f3b67
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
49 addition
and
49 deletion
+49
-49
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+49
-49
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
46d8e1eb
...
@@ -3733,24 +3733,32 @@ int32_t getDelCond(SSqlCmd* pCmd, SQueryInfo *pQueryInfo, tSQLExpr* pExpr, int64
...
@@ -3733,24 +3733,32 @@ int32_t getDelCond(SSqlCmd* pCmd, SQueryInfo *pQueryInfo, tSQLExpr* pExpr, int64
const
char
*
msg1
=
"invalid time stamp"
;
const
char
*
msg1
=
"invalid time stamp"
;
const
char
*
msg2
=
"illegal column name"
;
const
char
*
msg2
=
"illegal column name"
;
if
(
pExpr
->
nSQLOptr
==
TK_IN
)
{
tSQLExpr
*
pLeft
=
pExpr
->
pLeft
;
tSQLExpr
*
pLeft
=
pExpr
->
pLeft
;
tSQLExpr
*
pRight
=
pExpr
->
pRight
;
tSQLExpr
*
pRight
=
pExpr
->
pRight
;
if
(
pLeft
==
NULL
||
pLeft
->
nSQLOptr
!=
TK_ID
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
if
(
pRight
==
NULL
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
if
(
getColumnIndexByName
(
pCmd
,
&
pLeft
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getColumnIndexByName
(
pCmd
,
&
pLeft
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
int16_t
timePrecision
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
).
precision
;
int16_t
timePrecision
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
).
precision
;
if
(
index
.
columnIndex
!=
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
if
(
index
.
columnIndex
==
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
if
(
pRight
==
NULL
||
pRight
->
nSQLOptr
!=
TK_SET
||
pRight
->
pParam
==
NULL
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
int32_t
nParam
=
-
1
;
int32_t
nParam
=
pRight
->
pParam
->
nExpr
;
if
(
pExpr
->
nSQLOptr
==
TK_IN
)
{
if
(
pRight
->
nSQLOptr
!=
TK_SET
||
pRight
->
pParam
==
NULL
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
nParam
=
pRight
->
pParam
->
nExpr
;
*
tsBuf
=
malloc
(
sizeof
(
int64_t
)
*
nParam
);
*
tsBuf
=
malloc
(
sizeof
(
int64_t
)
*
nParam
);
*
sz
=
nParam
;
if
(
*
tsBuf
==
NULL
)
{
if
(
*
tsBuf
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
...
@@ -3763,31 +3771,23 @@ int32_t getDelCond(SSqlCmd* pCmd, SQueryInfo *pQueryInfo, tSQLExpr* pExpr, int64
...
@@ -3763,31 +3771,23 @@ int32_t getDelCond(SSqlCmd* pCmd, SQueryInfo *pQueryInfo, tSQLExpr* pExpr, int64
}
}
}
}
qsort
(
*
tsBuf
,
nParam
,
sizeof
((
*
tsBuf
)[
0
]),
getComparFunc
(
TSDB_DATA_TYPE_TIMESTAMP
,
0
));
qsort
(
*
tsBuf
,
nParam
,
sizeof
((
*
tsBuf
)[
0
]),
getComparFunc
(
TSDB_DATA_TYPE_TIMESTAMP
,
0
));
}
else
{
*
sz
=
nParam
;
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
else
if
(
pExpr
->
nSQLOptr
==
TK_EQ
)
{
nParam
=
1
;
*
tsBuf
=
malloc
(
sizeof
(
int64_t
)
*
nParam
);
if
(
*
tsBuf
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
int64_t
ts
;
if
(
getTimeFromExpr
(
pRight
,
timePrecision
,
&
ts
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
(
*
tsBuf
)[
nParam
-
1
]
=
ts
;
*
sz
=
nParam
;
}
else
{
}
else
{
return
TSDB_CODE_TSC_INVALID_SQL
;
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
//const char* msg1 = "del condition must use 'or'";
//tSQLExpr* pLeft = pExpr->pLeft;
//tSQLExpr* pRight = pExpr->pRight;
//int32_t leftType = -1;
//int32_t rightType = -1;
//if (!isExprDirectParentOfLeafNode(pExpr)) {
// int32_t ret = getDelCond(pCmd, pQueryInfo, pExpr->pLeft);
// if (ret != TSDB_CODE_SUCCESS) {
// return ret;
// }
// ret = getDelCond(pCmd, pQueryInfo, pExpr->pRight);
// if (ret != TSDB_CODE_SUCCESS) {
// return ret;
// }
//}
//return handleExprInDelCond(pCmd, pQueryInfo, pExpr);
}
}
int32_t
getQueryCondExpr
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tSQLExpr
**
pExpr
,
SCondExpr
*
pCondExpr
,
int32_t
getQueryCondExpr
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tSQLExpr
**
pExpr
,
SCondExpr
*
pCondExpr
,
int32_t
*
type
,
int32_t
parentOptr
)
{
int32_t
*
type
,
int32_t
parentOptr
)
{
...
@@ -4664,7 +4664,7 @@ int32_t setDelInfo(SSqlObj *pSql, struct SSqlInfo* pInfo) {
...
@@ -4664,7 +4664,7 @@ int32_t setDelInfo(SSqlObj *pSql, struct SSqlInfo* pInfo) {
const
char
*
msg1
=
"invalid table name"
;
const
char
*
msg1
=
"invalid table name"
;
const
char
*
msg2
=
"invalid delete sql"
;
const
char
*
msg2
=
"invalid delete sql"
;
const
char
*
msg3
=
"data deletion is not supported on super table"
;
const
char
*
msg3
=
"data deletion is not supported on super table"
;
const
char
*
msg4
=
"Only data deletion by
row is not
supported "
;
const
char
*
msg4
=
"Only data deletion by
timestamp is
supported "
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录