diff --git a/src/odbc.cpp b/src/odbc.cpp index f046d879..94c15656 100644 --- a/src/odbc.cpp +++ b/src/odbc.cpp @@ -1212,7 +1212,7 @@ void ODBC::GetArrayParam(Local value, Parameter * param, int num) GetNumberParam(val, param, num); number[i] = *(double*)param->buffer; param->strLenArray[i] = param->length; - delete param->buffer; + delete (double *)param->buffer; param->buffer = NULL; decimals = (decimals < param->decimals) ? param->decimals : decimals; } @@ -1233,7 +1233,7 @@ void ODBC::GetArrayParam(Local value, Parameter * param, int num) GetBoolParam(val, param, num); boolean[i] = *(int64_t*)(param->buffer); param->strLenArray[i] = (SQLINTEGER)param->length; - delete param->buffer; + delete (int64_t *)param->buffer; param->buffer = NULL; } param->buffer = boolean; @@ -1267,7 +1267,7 @@ void ODBC::GetArrayParam(Local value, Parameter * param, int num) "cbValueMax=%i\n", num, bufflen, cbValueMax); } bufflen = cbValueMax; // Length of max data to be copied. - if( param->length > 0 && bufflen > param->length ) { + if( param->length > 0 && bufflen > (SQLUINTEGER)param->length ) { bufflen = param->length; } memcpy((char*)buff + i * cbValueMax, param->buffer, bufflen); diff --git a/test/test-sp-array.js b/test/test-sp-array.js index b6698476..20cea1c2 100644 --- a/test/test-sp-array.js +++ b/test/test-sp-array.js @@ -22,6 +22,9 @@ ibmdb.open(common.connectionString, function (err, conn) { params: [param1, param2], ArraySize: 5}; + try { conn.querySync("drop table arrtab2;"); } + catch (e) { } + conn.beginTransactionSync(); var ret = conn.querySync("create table arrtab2(c1 int, c2 varchar(10));"); console.log("crete table ret = ", ret);