File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -136,10 +136,20 @@ function getConnection(a1, a2) {
136
136
var timeoutHandle ;
137
137
var timerIdx ;
138
138
var poolMax ;
139
- var getConnectionCb = arguments [ arguments . length - 1 ] ;
139
+ var getConnectionCb ;
140
140
var options = { } ;
141
141
142
142
nodbUtil . assert ( arguments . length >= 1 && arguments . length <= 2 , 'NJS-009' ) ;
143
+ switch ( arguments . length ) {
144
+ case 1 :
145
+ getConnectionCb = a1 ;
146
+ break ;
147
+ case 2 :
148
+ nodbUtil . assert ( nodbUtil . isObject ( a1 ) , 'NJS-006' , 1 ) ;
149
+ options = a1 ;
150
+ getConnectionCb = a2 ;
151
+ break ;
152
+ }
143
153
nodbUtil . assert ( typeof getConnectionCb === 'function' , 'NJS-006' , arguments . length ) ;
144
154
145
155
if ( self . status === self . _oracledb . POOL_STATUS_DRAINING ) { // closing soon
@@ -150,12 +160,6 @@ function getConnection(a1, a2) {
150
160
return ;
151
161
}
152
162
153
- // Optional JSON parameter
154
- if ( arguments . length > 1 ) {
155
- options = arguments [ 0 ] ;
156
- nodbUtil . assert ( nodbUtil . isObject ( options ) , 'NJS-006' , 1 ) ;
157
- }
158
-
159
163
if ( self . _enableStats ) {
160
164
self . _totalConnectionRequests += 1 ;
161
165
}
You can’t perform that action at this time.
0 commit comments