Skip to content

Commit bb2d1df

Browse files
author
bimalkjha
committed
fix warning and installer update
1 parent 8d149e9 commit bb2d1df

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

installer/driverInstall.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,19 @@ var install_node_ibm_db = function(file_url) {
4040
var ODBC_BINDINGS_V4 = 'build\/Release\/odbc_bindings.node.4.6.1';
4141
var ODBC_BINDINGS_V6 = 'build\/Release\/odbc_bindings.node.6.9.1';
4242

43-
//ERROR: NodeJs version < 0.12.x Support for node-ibm_db Windows has been discontinued.
44-
if(Number(process.version.match(/^v(\d+\.\d+)/)[1]) < 0.12){
43+
// Windows add-on binary for node.js v0.10.x has been discontinued.
44+
if(Number(process.version.match(/^v(\d+\.\d+)/)[1]) == 0.10){
4545
console.log('\nERROR: Found unsupported node.js version ' + process.version +
46-
'\nnode-ibm_db is not supported for node.js version < 0.12.0 on Widnows.\n' +
47-
'Please use the latest version of node.js.\n');
48-
46+
'\nnode-ibm_db do not have precompiled add-on file odbc_bindings.node for\n' +
47+
'node.js v0.10.x on Widnows. Please use the latest version of node.js.\n');
4948
process.exit(1);
5049
}
5150

52-
//WARNING: NodeJs version 0.12.x Support for node-ibm_db Windows has been depreciated.
51+
// Windows add-on binary for node.js v0.12.x has been deprecated.
5352
if(Number(process.version.match(/^v(\d+\.\d+)/)[1]) == 0.12){
5453
console.log('\nWARNING: Found node.js version ' + process.version +
55-
'\nSupport for node-ibm_db on Windows for node.js version 0.12.x is deprecated and will be discontinued soon.\n' +
56-
'Please use the latest version of node.js.\n');
54+
'\nSupport for node-ibm_db on Windows for node.js version 0.12.x is deprecated\n' +
55+
'and will be discontinued soon. Please use the latest version of node.js.\n');
5756
}
5857

5958
/*

src/odbc_connection.cpp

+14-5
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ void ODBCConnection::SetConnectionAttributes( ODBCConnection* conn )
317317
DEBUG_PRINTF("ODBCConnection::SetConnectionAttributes - timeOut = %i, systemNaming = %i\n",
318318
timeOut, conn->systemNaming);
319319

320-
if(timeOut < 0 || timeOut > 32767)
320+
if( timeOut > 32767 )
321321
{
322322
timeOut = DEFAULT_CONNECTION_TIMEOUT ;
323323
DEBUG_PRINTF("ODBCConnection::SetConnectionAttributes - Invalid connection timeout value changed to default.");
@@ -1675,17 +1675,26 @@ NAN_METHOD(ODBCConnection::SetIsolationLevel) {
16751675

16761676
ODBCConnection* conn = Nan::ObjectWrap::Unwrap<ODBCConnection>(info.Holder());
16771677

1678-
OPT_INT_ARG(0, isolationLevel, SQL_TXN_READ_COMMITTED)
1679-
16801678
Local<Value> objError;
1681-
SQLRETURN ret;
1679+
SQLRETURN ret = SQL_SUCCESS;
16821680
bool error = false;
1681+
SQLUINTEGER isolationLevel = SQL_TXN_READ_COMMITTED;
1682+
1683+
if (info.Length() <= 0) {
1684+
isolationLevel = SQL_TXN_READ_COMMITTED;
1685+
}
1686+
else if (info[0]->IsInt32()) {
1687+
isolationLevel = info[0]->Int32Value();
1688+
}
1689+
else {
1690+
return Nan::ThrowTypeError("Argument #0 must be an integer.");
1691+
}
16831692

16841693
//set the connection manual commits
16851694
ret = SQLSetConnectAttr(
16861695
conn->m_hDBC,
16871696
SQL_ATTR_TXN_ISOLATION,
1688-
(SQLPOINTER) isolationLevel,
1697+
(SQLPOINTER)(intptr_t)isolationLevel,
16891698
SQL_NTS);
16901699

16911700
DEBUG_PRINTF("ODBCConnection::SetIsolationLevel isolationLevel=%i; ret=%d\n",

0 commit comments

Comments
 (0)