1
- // Copyright (c) 2015, 2019 , Oracle and/or its affiliates. All rights reserved.
1
+ // Copyright (c) 2015, 2020 , Oracle and/or its affiliates. All rights reserved.
2
2
3
3
//-----------------------------------------------------------------------------
4
4
//
@@ -463,14 +463,12 @@ static napi_value njsConnection_createLob(napi_env env,
463
463
static bool njsConnection_createLobAsync (njsBaton * baton )
464
464
{
465
465
njsConnection * conn = (njsConnection * ) baton -> callingInstance ;
466
- dpiOracleTypeNum typeNum ;
467
466
468
- typeNum = (baton -> lobType == NJS_DATATYPE_CLOB ) ? DPI_ORACLE_TYPE_CLOB :
469
- DPI_ORACLE_TYPE_BLOB ;
470
467
baton -> lob = calloc (1 , sizeof (njsLobBuffer ));
471
468
if (!baton -> lob )
472
469
return njsBaton_setError (baton , errInsufficientMemory );
473
- if (dpiConn_newTempLob (conn -> handle , typeNum , & baton -> lob -> handle ) < 0 )
470
+ if (dpiConn_newTempLob (conn -> handle , baton -> lobType ,
471
+ & baton -> lob -> handle ) < 0 )
474
472
return njsBaton_setErrorDPI (baton );
475
473
baton -> lob -> dataType = baton -> lobType ;
476
474
if (!njsLob_populateBuffer (baton , baton -> lob ))
@@ -503,11 +501,10 @@ static bool njsConnection_createLobProcessArgs(njsBaton *baton,
503
501
{
504
502
if (!njsUtils_getUnsignedIntArg (env , args , 0 , & baton -> lobType ))
505
503
return false;
506
- if (baton -> lobType != NJS_DATATYPE_CLOB &&
507
- baton -> lobType != NJS_DATATYPE_BLOB ) {
508
- njsUtils_throwError (env , errInvalidParameterValue , 1 );
509
- return false;
510
- }
504
+ if (baton -> lobType != DPI_ORACLE_TYPE_CLOB &&
505
+ baton -> lobType != DPI_ORACLE_TYPE_BLOB &&
506
+ baton -> lobType != DPI_ORACLE_TYPE_NCLOB )
507
+ return njsUtils_throwError (env , errInvalidParameterValue , 1 );
511
508
512
509
return true;
513
510
}
@@ -2309,17 +2306,17 @@ static bool njsConnection_scanExecuteBinds(njsBaton *baton, napi_env env,
2309
2306
}
2310
2307
2311
2308
// get bind information from value if it has not already been specified
2312
- if (var -> bindDataType == NJS_DATATYPE_DEFAULT || !var -> maxSize ||
2309
+ if (var -> varTypeNum == NJS_DATATYPE_DEFAULT || !var -> maxSize ||
2313
2310
var -> maxSize == NJS_MAX_OUT_BIND_SIZE ) {
2314
- defaultBindType = var -> bindDataType ;
2311
+ defaultBindType = var -> varTypeNum ;
2315
2312
defaultMaxSize = var -> maxSize ;
2316
2313
defaultObjectTypeHandle = var -> dpiObjectTypeHandle ;
2317
2314
if (!njsConnection_getBindInfoFromValue (baton , false, env ,
2318
2315
bindValue , & defaultBindType , & defaultMaxSize ,
2319
2316
& defaultObjectTypeHandle ))
2320
2317
return false;
2321
- if (var -> bindDataType == NJS_DATATYPE_DEFAULT )
2322
- var -> bindDataType = defaultBindType ;
2318
+ if (var -> varTypeNum == NJS_DATATYPE_DEFAULT )
2319
+ var -> varTypeNum = defaultBindType ;
2323
2320
if (defaultMaxSize > var -> maxSize )
2324
2321
var -> maxSize = defaultMaxSize ;
2325
2322
if (!var -> dpiObjectTypeHandle && defaultObjectTypeHandle )
@@ -2331,7 +2328,7 @@ static bool njsConnection_scanExecuteBinds(njsBaton *baton, napi_env env,
2331
2328
// specified by the application; for OUT binds, the value from the
2332
2329
// application must be accepted as is as there is no way to
2333
2330
// validate it
2334
- if (var -> bindDataType != NJS_DATATYPE_OBJECT ) {
2331
+ if (var -> varTypeNum != DPI_ORACLE_TYPE_OBJECT ) {
2335
2332
2336
2333
NJS_CHECK_NAPI (env , napi_is_array (env , bindValue , & check ))
2337
2334
if (check ) {
@@ -2415,7 +2412,7 @@ static bool njsConnection_scanExecuteBindUnit(njsBaton *baton,
2415
2412
if (!njsDbObjectType_getFromClass (env , value , & var -> objectType ))
2416
2413
return false;
2417
2414
var -> dpiObjectTypeHandle = var -> objectType -> handle ;
2418
- var -> bindDataType = NJS_DATATYPE_OBJECT ;
2415
+ var -> varTypeNum = DPI_ORACLE_TYPE_OBJECT ;
2419
2416
okBindUnit = true;
2420
2417
} else if (valueType == napi_string ) {
2421
2418
@@ -2447,11 +2444,11 @@ static bool njsConnection_scanExecuteBindUnit(njsBaton *baton,
2447
2444
dpiObjectType_release (objTypeHandle );
2448
2445
}
2449
2446
var -> dpiObjectTypeHandle = var -> objectType -> handle ;
2450
- var -> bindDataType = NJS_DATATYPE_OBJECT ;
2447
+ var -> varTypeNum = DPI_ORACLE_TYPE_OBJECT ;
2451
2448
okBindUnit = true;
2452
2449
} else {
2453
2450
if (!njsBaton_getUnsignedIntFromArg (baton , env , args , 1 , "type" ,
2454
- & var -> bindDataType , & found ))
2451
+ & var -> varTypeNum , & found ))
2455
2452
return false;
2456
2453
if (found ) {
2457
2454
okBindUnit = true;
@@ -2474,8 +2471,8 @@ static bool njsConnection_scanExecuteBindUnit(njsBaton *baton,
2474
2471
if (found ) {
2475
2472
okBindUnit = true;
2476
2473
} else if (inExecuteMany ) {
2477
- if (var -> bindDataType == NJS_DATATYPE_STR ||
2478
- var -> bindDataType == NJS_DATATYPE_BUFFER ) {
2474
+ if (var -> varTypeNum == DPI_ORACLE_TYPE_VARCHAR ||
2475
+ var -> varTypeNum == DPI_ORACLE_TYPE_RAW ) {
2479
2476
if (var -> pos > 0 )
2480
2477
return njsBaton_setError (baton , errMissingMaxSizeByPos ,
2481
2478
var -> pos );
@@ -2557,15 +2554,15 @@ static bool njsConnection_scanExecuteManyBinds(njsBaton *baton,
2557
2554
continue ;
2558
2555
2559
2556
// otherwise, determine bind type and size by examining the value
2560
- defaultBindType = var -> bindDataType ;
2557
+ defaultBindType = var -> varTypeNum ;
2561
2558
defaultMaxSize = var -> maxSize ;
2562
2559
defaultObjectTypeHandle = var -> dpiObjectTypeHandle ;
2563
2560
if (!njsConnection_getBindInfoFromValue (baton , true, env ,
2564
2561
value , & defaultBindType , & defaultMaxSize ,
2565
2562
& defaultObjectTypeHandle ))
2566
2563
return false;
2567
- if (var -> bindDataType == NJS_DATATYPE_DEFAULT )
2568
- var -> bindDataType = defaultBindType ;
2564
+ if (var -> varTypeNum == NJS_DATATYPE_DEFAULT )
2565
+ var -> varTypeNum = defaultBindType ;
2569
2566
if (defaultMaxSize > var -> maxSize )
2570
2567
var -> maxSize = defaultMaxSize ;
2571
2568
if (!var -> dpiObjectTypeHandle && defaultObjectTypeHandle )
0 commit comments