Merge pull request #2608 from taosdata/bugfix/stream
fix invalid read in CQ
This commit is contained in:
commit
88d8f04e8f
|
@ -269,8 +269,14 @@ static void cqProcessStreamRes(void *param, TAOS_RES *tres, TAOS_ROW row) {
|
||||||
void* val = row[i];
|
void* val = row[i];
|
||||||
if (val == NULL) {
|
if (val == NULL) {
|
||||||
val = getNullValue(c->type);
|
val = getNullValue(c->type);
|
||||||
} else if (IS_VAR_DATA_TYPE(c->type)) {
|
} else if (c->type == TSDB_DATA_TYPE_BINARY) {
|
||||||
val = ((char*)val) - sizeof(VarDataLenT);
|
val = ((char*)val) - sizeof(VarDataLenT);
|
||||||
|
} else if (c->type == TSDB_DATA_TYPE_NCHAR) {
|
||||||
|
char buf[TSDB_MAX_NCHAR_LEN];
|
||||||
|
size_t len = taos_fetch_lengths(tres)[i];
|
||||||
|
taosMbsToUcs4(val, len, buf, sizeof(buf), &len);
|
||||||
|
memcpy(val + sizeof(VarDataLenT), buf, len);
|
||||||
|
varDataLen(val) = len;
|
||||||
}
|
}
|
||||||
tdAppendColVal(trow, val, c->type, c->bytes, c->offset);
|
tdAppendColVal(trow, val, c->type, c->bytes, c->offset);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue