提交 f6e19a72 编写于 作者: wmmhello's avatar wmmhello

TD-6129<feature> fix select * from json tag

上级 bb66d8ae
...@@ -727,12 +727,14 @@ static void setResRawPtrImpl(SSqlRes* pRes, SInternalField* pInfo, int32_t i, bo ...@@ -727,12 +727,14 @@ static void setResRawPtrImpl(SSqlRes* pRes, SInternalField* pInfo, int32_t i, bo
char* p = pRes->urow[i]; char* p = pRes->urow[i];
for (int32_t k = 0; k < pRes->numOfRows; ++k) { for (int32_t k = 0; k < pRes->numOfRows; ++k) {
char* dst = pRes->buffer[i] + k * pInfo->field.bytes; char* dst = pRes->buffer[i] + k * pInfo->field.bytes;
p = varDataVal(p);
char* realData = p + CHAR_BYTES; char* realData = p + CHAR_BYTES;
if (*p == SELECT_ALL_JSON_TAG){ if (*p == SELECT_ALL_JSON_TAG){
char* json = parseTagDatatoJson(realData, pInfo->field.type); char* json = parseTagDatatoJson(realData, pInfo->field.type);
if(json) { if(json) {
memcpy(varDataVal(dst), json, strlen(json)); memcpy(varDataVal(dst), json, strlen(json));
varDataSetLen(dst, strlen(json)); varDataSetLen(dst, strlen(json));
assert(varDataTLen(dst) <= pInfo->field.type);
tfree(json); tfree(json);
} }
}else if (*p == SELECT_ELEMENT_JSON_TAG){ }else if (*p == SELECT_ELEMENT_JSON_TAG){
......
...@@ -3362,6 +3362,7 @@ static void doSetTagValueInParam(void* pTable, int32_t tagColId, tVariant *tag, ...@@ -3362,6 +3362,7 @@ static void doSetTagValueInParam(void* pTable, int32_t tagColId, tVariant *tag,
tVariantCreateFromBinary(tag, val, bytes, type); tVariantCreateFromBinary(tag, val, bytes, type);
memcpy(tag->pz + 1, tag->pz, bytes - 1); // move back 1 byte for select type memcpy(tag->pz + 1, tag->pz, bytes - 1); // move back 1 byte for select type
*(tag->pz) = SELECT_ALL_JSON_TAG; *(tag->pz) = SELECT_ALL_JSON_TAG;
tag->nLen++;
} }
else { else {
tVariantCreateFromBinary(tag, val, bytes, type); tVariantCreateFromBinary(tag, val, bytes, type);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册