@@ -317,7 +317,7 @@ void ODBCConnection::SetConnectionAttributes( ODBCConnection* conn )
317
317
DEBUG_PRINTF (" ODBCConnection::SetConnectionAttributes - timeOut = %i, systemNaming = %i\n " ,
318
318
timeOut, conn->systemNaming );
319
319
320
- if (timeOut < 0 || timeOut > 32767 )
320
+ if ( timeOut > 32767 )
321
321
{
322
322
timeOut = DEFAULT_CONNECTION_TIMEOUT ;
323
323
DEBUG_PRINTF (" ODBCConnection::SetConnectionAttributes - Invalid connection timeout value changed to default." );
@@ -1675,17 +1675,26 @@ NAN_METHOD(ODBCConnection::SetIsolationLevel) {
1675
1675
1676
1676
ODBCConnection* conn = Nan::ObjectWrap::Unwrap<ODBCConnection>(info.Holder ());
1677
1677
1678
- OPT_INT_ARG (0 , isolationLevel, SQL_TXN_READ_COMMITTED)
1679
-
1680
1678
Local<Value> objError;
1681
- SQLRETURN ret;
1679
+ SQLRETURN ret = SQL_SUCCESS ;
1682
1680
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
+ }
1683
1692
1684
1693
// set the connection manual commits
1685
1694
ret = SQLSetConnectAttr (
1686
1695
conn->m_hDBC ,
1687
1696
SQL_ATTR_TXN_ISOLATION,
1688
- (SQLPOINTER) isolationLevel,
1697
+ (SQLPOINTER)( intptr_t ) isolationLevel,
1689
1698
SQL_NTS);
1690
1699
1691
1700
DEBUG_PRINTF (" ODBCConnection::SetIsolationLevel isolationLevel=%i; ret=%d\n " ,
0 commit comments