提交 7ed514b7 编写于 作者: H hzcheng

TD-166

上级 4a56bea1
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
#include "tdataformat.h" #include "tdataformat.h"
#include "tutil.h" #include "tutil.h"
#include "wchar.h"
/** /**
* Create a SSchema object with nCols columns * Create a SSchema object with nCols columns
...@@ -174,7 +175,12 @@ int tdAppendColVal(SDataRow row, void *value, int8_t type, int32_t bytes, int32_ ...@@ -174,7 +175,12 @@ int tdAppendColVal(SDataRow row, void *value, int8_t type, int32_t bytes, int32_
if (value == NULL) { if (value == NULL) {
*(int32_t *)dataRowAt(row, toffset) = -1; *(int32_t *)dataRowAt(row, toffset) = -1;
} else { } else {
int16_t slen = (type) ? strnlen((char *)value, bytes) : wcsnlen((wchar_t *)value, bytes/TSDB_NCHAR_SIZE) * TSDB_NCHAR_SIZE; int16_t slen = 0;
if (type == TSDB_DATA_TYPE_BINARY) {
slen = strnlen((char *)value, bytes);
} else {
slen = wcsnlen((wchar_t *)value, (bytes) / TSDB_NCHAR_SIZE) * TSDB_NCHAR_SIZE;
}
if (slen > bytes) return -1; if (slen > bytes) return -1;
*(int32_t *)dataRowAt(row, toffset) = dataRowLen(row); *(int32_t *)dataRowAt(row, toffset) = dataRowLen(row);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册