enh: insert nchar by sql
This commit is contained in:
parent
e4a450fa69
commit
706ac9a9e6
|
@ -1572,13 +1572,13 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
case TSDB_DATA_TYPE_NCHAR: {
|
||||
// if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long'
|
||||
int32_t len = 0;
|
||||
int64_t maxLen = pToken->n << 2;
|
||||
if (maxLen > pSchema->bytes - VARSTR_HEADER_SIZE) maxLen = pSchema->bytes - VARSTR_HEADER_SIZE;
|
||||
char* pUcs4 = taosMemoryMalloc(maxLen);
|
||||
int64_t realLen = pToken->n << 2;
|
||||
if (realLen > pSchema->bytes - VARSTR_HEADER_SIZE) realLen = pSchema->bytes - VARSTR_HEADER_SIZE;
|
||||
char* pUcs4 = taosMemoryMalloc(realLen);
|
||||
if (NULL == pUcs4) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)pUcs4, maxLen, &len)) {
|
||||
if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)pUcs4, realLen, &len)) {
|
||||
taosMemoryFree(pUcs4);
|
||||
if (errno == E2BIG) {
|
||||
return generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name);
|
||||
|
|
Loading…
Reference in New Issue