Skip to content

Commit

Permalink
fix warnings and test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
bimalkjha committed Mar 15, 2021
1 parent 4ea327a commit 3fff3ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/odbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ void ODBC::GetArrayParam(Local<Value> 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;
}
Expand All @@ -1233,7 +1233,7 @@ void ODBC::GetArrayParam(Local<Value> 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;
Expand Down Expand Up @@ -1267,7 +1267,7 @@ void ODBC::GetArrayParam(Local<Value> 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);
Expand Down
3 changes: 3 additions & 0 deletions test/test-sp-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3fff3ce

Please sign in to comment.