diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index c86a920029ab4fdd763ddc1e9bb366298b80dedc..1ae546d1884ccfe1da8d45c66e6df7c95ee06108 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -723,7 +723,7 @@ static FORCE_INLINE int doBindParam(STableDataBlocks* pBlock, char* data, SParam if ((*bind->length) > (uintptr_t)param->bytes) { return TSDB_CODE_TSC_INVALID_VALUE; } - short size = (short)*bind->length; + uint16_t size = (uint16_t)*bind->length; STR_WITH_SIZE_TO_VARSTR(data + param->offset, bind->buffer, size); return TSDB_CODE_SUCCESS; } @@ -777,7 +777,7 @@ static FORCE_INLINE int doBindParam(STableDataBlocks* pBlock, char* data, SParam return TSDB_CODE_TSC_INVALID_VALUE; } - short size = 0; + uint16_t size = 0; switch(param->type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -808,7 +808,7 @@ static FORCE_INLINE int doBindParam(STableDataBlocks* pBlock, char* data, SParam tscError("column length is too big"); return TSDB_CODE_TSC_INVALID_VALUE; } - size = (short)*pBind->length; + size = (uint16_t)*pBind->length; STR_WITH_SIZE_TO_VARSTR(data + param->offset, pBind->buffer, size); return TSDB_CODE_SUCCESS; diff --git a/tests/system-test/1-insert/stmt_error.py b/tests/system-test/1-insert/stmt_error.py index 9a269d8023cb458385a52509317bde28da8c7e1c..a5ed032611ee86fddb0cf5344c5633c6642ac2d0 100644 --- a/tests/system-test/1-insert/stmt_error.py +++ b/tests/system-test/1-insert/stmt_error.py @@ -45,7 +45,7 @@ class TDTestCase: conn.execute( "create table if not exists log(ts timestamp, bo bool, nil tinyint, ti tinyint, si smallint, ii int,\ bi bigint, tu tinyint unsigned, su smallint unsigned, iu int unsigned, bu bigint unsigned, \ - ff float, dd double, bb binary(100), nn nchar(100), tt timestamp)", + ff float, dd double, bb binary(65059), nn nchar(100), tt timestamp)", ) conn.load_table_info("log") @@ -65,7 +65,10 @@ class TDTestCase: params[10].bigint_unsigned(9) params[11].float(10.1) params[12].double(10.11) - params[13].binary("hello") + binaryStr = '123456789' + for i in range(1301): + binaryStr += "1234567890abcdefghij1234567890abcdefghij12345hello" + params[13].binary(binaryStr) params[14].nchar("stmt") params[15].timestamp(1626861392589, PrecisionEnum.Milliseconds) @@ -88,7 +91,7 @@ class TDTestCase: #float == may not work as expected # assert row[10] == c_float(10.1) assert row[12] == 10.11 - assert row[13] == "hello" + assert row[13][65054:] == "hello" assert row[14] == "stmt" conn.execute("drop database if exists %s" % dbname)