@@ -1376,7 +1376,7 @@ void Connection::DoDefines ( eBaton* executeBaton, const dpi::MetaData* meta,
1376
1376
unsigned int numCols )
1377
1377
{
1378
1378
Define *defines = executeBaton->defines = new Define[numCols];
1379
- int lxgratio = executeBaton->dpiconn ->getByteExpansionRation ();
1379
+ int csratio = executeBaton->dpiconn ->getByteExpansionRatio ();
1380
1380
1381
1381
for (unsigned int col = 0 ; col < numCols; col++)
1382
1382
{
@@ -1418,13 +1418,12 @@ void Connection::DoDefines ( eBaton* executeBaton, const dpi::MetaData* meta,
1418
1418
executeBaton->columnNames [col],
1419
1419
meta[col].dbType );
1420
1420
/*
1421
- * While fetching non-ascii characters, each byte on the server
1422
- * can take upto maximum of 3 bytes when it converted to AL32UTF8
1423
- * because the client character set is always set to AL32UTF8
1424
- * in node-oracledb. If server has AL32UTF8 then ratio is 1.
1421
+ * the buffer size is increased to account for possible character
1422
+ * size expansion when data is converted from the DB character set
1423
+ * to AL32UTF8
1425
1424
*/
1426
1425
1427
- defines[col].maxSize = (meta[col].dbSize ) * lxgratio ;
1426
+ defines[col].maxSize = (meta[col].dbSize ) * csratio ;
1428
1427
1429
1428
1430
1429
if ( NJS_SIZE_T_OVERFLOW ( defines[col].maxSize ,
@@ -2814,7 +2813,7 @@ void Connection::cbDynBufferAllocate ( void *ctx, bool dmlReturning,
2814
2813
eBaton *executeBaton = (eBaton *)ctx;
2815
2814
Bind *bind = (Bind *)executeBaton->binds [bndpos];
2816
2815
2817
- if ( NJS_SIZE_T_OVERFLOW ( nRows, sizeof ( short )) )
2816
+ if ( NJS_SIZE_T_OVERFLOW ( sizeof ( short ), nRows ) )
2818
2817
{
2819
2818
executeBaton->error = NJSMessages::getErrorMsg ( errResultsTooLarge );
2820
2819
return ;
@@ -2830,7 +2829,7 @@ void Connection::cbDynBufferAllocate ( void *ctx, bool dmlReturning,
2830
2829
}
2831
2830
if ( dmlReturning )
2832
2831
{
2833
- if ( NJS_SIZE_T_OVERFLOW ( nRows, sizeof ( unsigned int )) )
2832
+ if ( NJS_SIZE_T_OVERFLOW ( sizeof ( unsigned int ), nRows ) )
2834
2833
{
2835
2834
executeBaton->error = NJSMessages::getErrorMsg ( errResultsTooLarge );
2836
2835
return ;
@@ -2943,10 +2942,6 @@ void Connection::cbDynBufferAllocate ( void *ctx, bool dmlReturning,
2943
2942
}
2944
2943
}
2945
2944
if ( !dmlReturning )
2946
- {
2947
- *(bind->len ) = sizeof ( unsigned int ) ;
2948
- }
2949
- if ( !dmlReturning )
2950
2945
{
2951
2946
*(bind->len ) = sizeof ( double ) ;
2952
2947
}
@@ -2968,7 +2963,7 @@ void Connection::cbDynBufferAllocate ( void *ctx, bool dmlReturning,
2968
2963
}
2969
2964
else
2970
2965
{
2971
- bind->value = (void *)malloc (sizeof (Descriptor *) * bind-> rowsReturned );
2966
+ bind->value = (void *)malloc (sizeof (Descriptor *) * nRows );
2972
2967
if ( !bind->value )
2973
2968
{
2974
2969
executeBaton->error = NJSMessages::getErrorMsg (
0 commit comments