未验证 提交 49082a7e 编写于 作者: F fangpanpan 提交者: GitHub

Merge pull request #896 from taosdata/feature/lihui

[TBASE-1323]
...@@ -139,7 +139,7 @@ void tVariantCreateFromBinary(tVariant *pVar, char *pz, uint32_t len, uint32_t t ...@@ -139,7 +139,7 @@ void tVariantCreateFromBinary(tVariant *pVar, char *pz, uint32_t len, uint32_t t
} }
case TSDB_DATA_TYPE_NCHAR: { // here we get the nchar length from raw binary bits length case TSDB_DATA_TYPE_NCHAR: { // here we get the nchar length from raw binary bits length
pVar->nLen = len / TSDB_NCHAR_SIZE; pVar->nLen = len / TSDB_NCHAR_SIZE;
pVar->wpz = malloc((pVar->nLen + 1) * TSDB_NCHAR_SIZE); pVar->wpz = calloc(1, (pVar->nLen + 1) * TSDB_NCHAR_SIZE);
wcsncpy(pVar->wpz, (wchar_t *)pz, pVar->nLen); wcsncpy(pVar->wpz, (wchar_t *)pz, pVar->nLen);
pVar->wpz[pVar->nLen] = 0; pVar->wpz[pVar->nLen] = 0;
...@@ -998,6 +998,14 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) { ...@@ -998,6 +998,14 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) {
*((int8_t *)val) = GET_INT8_VAL(src); *((int8_t *)val) = GET_INT8_VAL(src);
break; break;
}; };
case TSDB_DATA_TYPE_BINARY: {
strncpy(val, src, len);
break;
};
case TSDB_DATA_TYPE_NCHAR: {
wcsncpy((wchar_t*)val, (wchar_t*)src, len / TSDB_NCHAR_SIZE);
break;
};
default: { default: {
memcpy(val, src, len); memcpy(val, src, len);
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册