Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
10b44984
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看板
未验证
提交
10b44984
编写于
3月 13, 2021
作者:
H
huili
提交者:
GitHub
3月 13, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5431 from taosdata/fix/TD-3283
[TD-3283]<fix>: fix unsigned fields support in http rest json
上级
5a42914c
7dfa4d83
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
0 deletion
+26
-0
src/plugins/http/inc/httpJson.h
src/plugins/http/inc/httpJson.h
+2
-0
src/plugins/http/src/httpJson.c
src/plugins/http/src/httpJson.c
+12
-0
src/plugins/http/src/httpRestJson.c
src/plugins/http/src/httpRestJson.c
+12
-0
未找到文件。
src/plugins/http/inc/httpJson.h
浏览文件 @
10b44984
...
@@ -63,9 +63,11 @@ void httpJsonString(JsonBuf* buf, char* sVal, int32_t len);
...
@@ -63,9 +63,11 @@ void httpJsonString(JsonBuf* buf, char* sVal, int32_t len);
void
httpJsonOriginString
(
JsonBuf
*
buf
,
char
*
sVal
,
int32_t
len
);
void
httpJsonOriginString
(
JsonBuf
*
buf
,
char
*
sVal
,
int32_t
len
);
void
httpJsonStringForTransMean
(
JsonBuf
*
buf
,
char
*
SVal
,
int32_t
maxLen
);
void
httpJsonStringForTransMean
(
JsonBuf
*
buf
,
char
*
SVal
,
int32_t
maxLen
);
void
httpJsonInt64
(
JsonBuf
*
buf
,
int64_t
num
);
void
httpJsonInt64
(
JsonBuf
*
buf
,
int64_t
num
);
void
httpJsonUInt64
(
JsonBuf
*
buf
,
uint64_t
num
);
void
httpJsonTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
);
void
httpJsonTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
);
void
httpJsonUtcTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
);
void
httpJsonUtcTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
);
void
httpJsonInt
(
JsonBuf
*
buf
,
int32_t
num
);
void
httpJsonInt
(
JsonBuf
*
buf
,
int32_t
num
);
void
httpJsonUInt
(
JsonBuf
*
buf
,
uint32_t
num
);
void
httpJsonFloat
(
JsonBuf
*
buf
,
float
num
);
void
httpJsonFloat
(
JsonBuf
*
buf
,
float
num
);
void
httpJsonDouble
(
JsonBuf
*
buf
,
double
num
);
void
httpJsonDouble
(
JsonBuf
*
buf
,
double
num
);
void
httpJsonNull
(
JsonBuf
*
buf
);
void
httpJsonNull
(
JsonBuf
*
buf
);
...
...
src/plugins/http/src/httpJson.c
浏览文件 @
10b44984
...
@@ -256,6 +256,12 @@ void httpJsonInt64(JsonBuf* buf, int64_t num) {
...
@@ -256,6 +256,12 @@ void httpJsonInt64(JsonBuf* buf, int64_t num) {
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%"
PRId64
,
num
);
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%"
PRId64
,
num
);
}
}
void
httpJsonUInt64
(
JsonBuf
*
buf
,
uint64_t
num
)
{
httpJsonItemToken
(
buf
);
httpJsonTestBuf
(
buf
,
MAX_NUM_STR_SZ
);
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%"
PRIu64
,
num
);
}
void
httpJsonTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
)
{
void
httpJsonTimestamp
(
JsonBuf
*
buf
,
int64_t
t
,
bool
us
)
{
char
ts
[
35
]
=
{
0
};
char
ts
[
35
]
=
{
0
};
struct
tm
*
ptm
;
struct
tm
*
ptm
;
...
@@ -303,6 +309,12 @@ void httpJsonInt(JsonBuf* buf, int32_t num) {
...
@@ -303,6 +309,12 @@ void httpJsonInt(JsonBuf* buf, int32_t num) {
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%d"
,
num
);
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%d"
,
num
);
}
}
void
httpJsonUInt
(
JsonBuf
*
buf
,
uint32_t
num
)
{
httpJsonItemToken
(
buf
);
httpJsonTestBuf
(
buf
,
MAX_NUM_STR_SZ
);
buf
->
lst
+=
snprintf
(
buf
->
lst
,
MAX_NUM_STR_SZ
,
"%u"
,
num
);
}
void
httpJsonFloat
(
JsonBuf
*
buf
,
float
num
)
{
void
httpJsonFloat
(
JsonBuf
*
buf
,
float
num
)
{
httpJsonItemToken
(
buf
);
httpJsonItemToken
(
buf
);
httpJsonTestBuf
(
buf
,
MAX_NUM_STR_SZ
);
httpJsonTestBuf
(
buf
,
MAX_NUM_STR_SZ
);
...
...
src/plugins/http/src/httpRestJson.c
浏览文件 @
10b44984
...
@@ -162,6 +162,18 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result,
...
@@ -162,6 +162,18 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result,
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
httpJsonInt64
(
jsonBuf
,
*
((
int64_t
*
)
row
[
i
]));
httpJsonInt64
(
jsonBuf
,
*
((
int64_t
*
)
row
[
i
]));
break
;
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
httpJsonUInt
(
jsonBuf
,
*
((
uint8_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
httpJsonUInt
(
jsonBuf
,
*
((
uint16_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_UINT
:
httpJsonUInt
(
jsonBuf
,
*
((
uint32_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
httpJsonUInt64
(
jsonBuf
,
*
((
uint64_t
*
)
row
[
i
]));
break
;
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_FLOAT
:
httpJsonFloat
(
jsonBuf
,
GET_FLOAT_VAL
(
row
[
i
]));
httpJsonFloat
(
jsonBuf
,
GET_FLOAT_VAL
(
row
[
i
]));
break
;
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录