Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e84ba7c9
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e84ba7c9
编写于
9月 17, 2021
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-6129<feature> fix json encode error
上级
9c8eee5b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
9 deletion
+11
-9
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+3
-3
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+3
-3
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+4
-2
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
e84ba7c9
...
...
@@ -1077,7 +1077,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
return
code
;
}
tdAddColToKVRow
(
&
kvRowBuilder
,
pSchema
->
colId
,
pSchema
->
type
,
tagVal
);
tdAddColToKVRow
(
&
kvRowBuilder
,
pSchema
->
colId
,
pSchema
->
type
,
tagVal
,
false
);
}
// encode json tag string
...
...
src/client/src/tscSQLParser.c
浏览文件 @
e84ba7c9
...
...
@@ -7618,7 +7618,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
tdAddColToKVRow
(
&
kvRowBuilder
,
pSchema
->
colId
,
pSchema
->
type
,
tagVal
);
tdAddColToKVRow
(
&
kvRowBuilder
,
pSchema
->
colId
,
pSchema
->
type
,
tagVal
,
false
);
findColumnIndex
=
true
;
break
;
...
...
@@ -7640,7 +7640,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
SSchema
*
pSchema
=
&
pTagSchema
[
i
];
tVariantListItem
*
pItem
=
taosArrayGet
(
pValList
,
i
);
char
tagVal
[
TSDB_MAX_TAGS_LEN
];
char
tagVal
[
TSDB_MAX_TAGS_LEN
]
=
{
0
}
;
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pItem
->
pVar
.
nLen
>
pSchema
->
bytes
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
...
...
@@ -7678,7 +7678,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
tdAddColToKVRow
(
&
kvRowBuilder
,
pSchema
->
colId
,
pSchema
->
type
,
tagVal
);
tdAddColToKVRow
(
&
kvRowBuilder
,
pSchema
->
colId
,
pSchema
->
type
,
tagVal
,
false
);
}
}
...
...
src/client/src/tscUtil.c
浏览文件 @
e84ba7c9
...
...
@@ -5178,7 +5178,7 @@ int parseJsontoTagData(char* json, SKVRowBuilder* kvRowBuilder, char* errMsg, in
}
varDataSetLen
(
tagVal
,
output
);
tdAddColToKVRow
(
kvRowBuilder
,
jsonIndex
++
,
TSDB_DATA_TYPE_NCHAR
,
tagVal
);
// add json key
tdAddColToKVRow
(
kvRowBuilder
,
jsonIndex
++
,
TSDB_DATA_TYPE_NCHAR
,
tagVal
,
false
);
// add json key
memset
(
tagVal
,
0
,
TSDB_MAX_TAGS_LEN
);
if
(
item
->
type
==
cJSON_String
){
// add json value format: type|data
...
...
@@ -5192,12 +5192,12 @@ int parseJsontoTagData(char* json, SKVRowBuilder* kvRowBuilder, char* errMsg, in
}
varDataSetLen
(
tagData
,
output
);
tdAddColToKVRow
(
kvRowBuilder
,
jsonIndex
++
,
TSDB_DATA_TYPE_NCHAR
,
tagVal
);
tdAddColToKVRow
(
kvRowBuilder
,
jsonIndex
++
,
TSDB_DATA_TYPE_NCHAR
,
tagVal
,
true
);
}
else
if
(
item
->
type
==
cJSON_Number
){
*
tagVal
=
item
->
type
;
// type
char
*
tagData
=
tagVal
+
CHAR_BYTES
;
*
((
double
*
)
tagData
)
=
item
->
valuedouble
;
tdAddColToKVRow
(
kvRowBuilder
,
jsonIndex
++
,
TSDB_DATA_TYPE_BIGINT
,
tagVal
);
tdAddColToKVRow
(
kvRowBuilder
,
jsonIndex
++
,
TSDB_DATA_TYPE_BIGINT
,
tagVal
,
true
);
}
else
{
retCode
=
tscSQLSyntaxErrMsg
(
errMsg
,
"invalidate json value"
,
NULL
);
goto
end
;
...
...
src/common/inc/tdataformat.h
浏览文件 @
e84ba7c9
...
...
@@ -544,7 +544,7 @@ void tdDestroyKVRowBuilder(SKVRowBuilder *pBuilder);
void
tdResetKVRowBuilder
(
SKVRowBuilder
*
pBuilder
);
SKVRow
tdGetKVRowFromBuilder
(
SKVRowBuilder
*
pBuilder
);
static
FORCE_INLINE
int
tdAddColToKVRow
(
SKVRowBuilder
*
pBuilder
,
int16_t
colId
,
int8_t
type
,
void
*
value
)
{
static
FORCE_INLINE
int
tdAddColToKVRow
(
SKVRowBuilder
*
pBuilder
,
int16_t
colId
,
int8_t
type
,
void
*
value
,
bool
isJumpJsonVType
)
{
if
(
pBuilder
->
nCols
>=
pBuilder
->
tCols
)
{
pBuilder
->
tCols
*=
2
;
SColIdx
*
pColIdx
=
(
SColIdx
*
)
realloc
((
void
*
)(
pBuilder
->
pColIdx
),
sizeof
(
SColIdx
)
*
pBuilder
->
tCols
);
...
...
@@ -557,7 +557,9 @@ static FORCE_INLINE int tdAddColToKVRow(SKVRowBuilder *pBuilder, int16_t colId,
pBuilder
->
nCols
++
;
int
tlen
=
IS_VAR_DATA_TYPE
(
type
)
?
varDataTLen
(
value
)
:
TYPE_BYTES
[
type
];
void
*
jumpType
=
value
;
if
(
isJumpJsonVType
)
jumpType
=
value
+
CHAR_BYTES
;
int
tlen
=
IS_VAR_DATA_TYPE
(
type
)
?
varDataTLen
(
jumpType
)
:
TYPE_BYTES
[
type
];
if
(
tlen
>
pBuilder
->
alloc
-
pBuilder
->
size
)
{
while
(
tlen
>
pBuilder
->
alloc
-
pBuilder
->
size
)
{
pBuilder
->
alloc
*=
2
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录