Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
电商架构修炼
TDengine
提交
e5f37302
TDengine
项目概览
电商架构修炼
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e5f37302
编写于
9月 09, 2021
作者:
X
xywang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TS-263]<fix>: make response of alter consistent with create and drop
上级
23fc7163
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
4 deletion
+32
-4
src/plugins/http/inc/httpUtil.h
src/plugins/http/inc/httpUtil.h
+1
-0
src/plugins/http/src/httpRestJson.c
src/plugins/http/src/httpRestJson.c
+19
-4
src/plugins/http/src/httpUtil.c
src/plugins/http/src/httpUtil.c
+12
-0
未找到文件。
src/plugins/http/inc/httpUtil.h
浏览文件 @
e5f37302
...
...
@@ -17,6 +17,7 @@
#define TDENGINE_HTTP_UTIL_H
bool
httpCheckUsedbSql
(
char
*
sql
);
bool
httpCheckAlterSql
(
char
*
sql
);
void
httpTimeToString
(
int32_t
t
,
char
*
buf
,
int32_t
buflen
);
bool
httpUrlMatch
(
HttpContext
*
pContext
,
int32_t
pos
,
char
*
cmp
);
...
...
src/plugins/http/src/httpRestJson.c
浏览文件 @
e5f37302
...
...
@@ -16,6 +16,7 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "tglobal.h"
#include "tsclient.h"
#include "httpLog.h"
#include "httpJson.h"
#include "httpRestHandle.h"
...
...
@@ -62,13 +63,21 @@ void restStartSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result)
httpJsonItemToken
(
jsonBuf
);
httpJsonToken
(
jsonBuf
,
JsonArrStt
);
SSqlObj
*
pObj
=
(
SSqlObj
*
)
result
;
bool
isAlterSql
=
(
pObj
->
sqlstr
==
NULL
)
?
false
:
httpCheckAlterSql
(
pObj
->
sqlstr
);
if
(
num_fields
==
0
)
{
httpJsonItemToken
(
jsonBuf
);
httpJsonString
(
jsonBuf
,
REST_JSON_AFFECT_ROWS
,
REST_JSON_AFFECT_ROWS_LEN
);
}
else
{
for
(
int32_t
i
=
0
;
i
<
num_fields
;
++
i
)
{
if
(
isAlterSql
==
true
)
{
httpJsonItemToken
(
jsonBuf
);
httpJsonString
(
jsonBuf
,
fields
[
i
].
name
,
(
int32_t
)
strlen
(
fields
[
i
].
name
));
httpJsonString
(
jsonBuf
,
REST_JSON_AFFECT_ROWS
,
REST_JSON_AFFECT_ROWS_LEN
);
}
else
{
for
(
int32_t
i
=
0
;
i
<
num_fields
;
++
i
)
{
httpJsonItemToken
(
jsonBuf
);
httpJsonString
(
jsonBuf
,
fields
[
i
].
name
,
(
int32_t
)
strlen
(
fields
[
i
].
name
));
}
}
}
...
...
@@ -99,8 +108,14 @@ void restStartSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result)
httpJsonItemToken
(
jsonBuf
);
httpJsonToken
(
jsonBuf
,
JsonArrStt
);
httpJsonItemToken
(
jsonBuf
);
httpJsonString
(
jsonBuf
,
fields
[
i
].
name
,
(
int32_t
)
strlen
(
fields
[
i
].
name
));
if
(
isAlterSql
==
true
)
{
httpJsonItemToken
(
jsonBuf
);
httpJsonString
(
jsonBuf
,
REST_JSON_AFFECT_ROWS
,
REST_JSON_AFFECT_ROWS_LEN
);
}
else
{
httpJsonItemToken
(
jsonBuf
);
httpJsonString
(
jsonBuf
,
fields
[
i
].
name
,
(
int32_t
)
strlen
(
fields
[
i
].
name
));
}
httpJsonItemToken
(
jsonBuf
);
httpJsonInt
(
jsonBuf
,
fields
[
i
].
type
);
httpJsonItemToken
(
jsonBuf
);
...
...
src/plugins/http/src/httpUtil.c
浏览文件 @
e5f37302
...
...
@@ -21,6 +21,7 @@
#include "httpResp.h"
#include "httpSql.h"
#include "httpUtil.h"
#include "ttoken.h"
bool
httpCheckUsedbSql
(
char
*
sql
)
{
if
(
strstr
(
sql
,
"use "
)
!=
NULL
)
{
...
...
@@ -29,6 +30,17 @@ bool httpCheckUsedbSql(char *sql) {
return
false
;
}
bool
httpCheckAlterSql
(
char
*
sql
)
{
int32_t
index
=
0
;
do
{
SStrToken
t0
=
tStrGetToken
(
sql
,
&
index
,
false
);
if
(
t0
.
type
!=
TK_LP
)
{
return
t0
.
type
==
TK_ALTER
;
}
}
while
(
1
);
}
void
httpTimeToString
(
int32_t
t
,
char
*
buf
,
int32_t
buflen
)
{
memset
(
buf
,
0
,
(
size_t
)
buflen
);
char
ts
[
32
]
=
{
0
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录