@@ -935,12 +935,13 @@ void Connection::Async_Execute (uv_work_t *req)
935935 }
936936 }
937937
938- /* For each OUT Binds of CURSOR type, get the number of columns */
938+ /* For each OUT Binds of CURSOR type, get the dpistmt state */
939939 for ( unsigned int b = 0 ; b < executeBaton->binds .size (); b ++ )
940940 {
941941 Bind *bind = executeBaton->binds [b];
942942
943- if ( bind->isOut && bind->type == dpi::DpiRSet )
943+ /* Here bind->isOut is expected to be TRUE, and is checked earlier */
944+ if ( bind->type == dpi::DpiRSet )
944945 {
945946 unsigned long state = ((Stmt*)bind->value )->getState ();
946947
@@ -1424,14 +1425,14 @@ void Connection::DoDefines ( eBaton* executeBaton, const dpi::MetaData* meta,
14241425 defines[col].fetchType = Connection::GetTargetType ( executeBaton,
14251426 executeBaton->columnNames [col],
14261427 meta[col].dbType );
1428+
14271429 /*
14281430 * the buffer size is increased to account for possible character
14291431 * size expansion when data is converted from the DB character set
14301432 * to AL32UTF8
14311433 */
14321434
1433- defines[col].maxSize = (meta[col].dbSize ) * csratio;
1434-
1435+ defines[col].maxSize = (meta[col].dbSize ) * csratio;
14351436
14361437 if ( NJS_SIZE_T_OVERFLOW ( defines[col].maxSize ,
14371438 executeBaton->maxRows ) )
@@ -2064,6 +2065,10 @@ Handle<Value> Connection::GetValueRefCursor ( eBaton *executeBaton,
20642065 {
20652066 resultSet = NanNew (ResultSet::resultSetTemplate_s)->
20662067 GetFunction () ->NewInstance ();
2068+ /*
2069+ * IN case of REFCURSOR, bind->flags will indicate whether we got
2070+ * a valid handle, based on that numCols, metaData are queried.
2071+ */
20672072 (ObjectWrap::Unwrap<ResultSet> (resultSet))->
20682073 setResultSet ( (dpi::Stmt*)(bind->value ),
20692074 executeBaton);
@@ -2827,7 +2832,7 @@ void Connection::cbDynBufferAllocate ( void *ctx, bool dmlReturning,
28272832 }
28282833 else
28292834 {
2830- bind->ind = (short *)malloc ( nRows * sizeof ( short ) ) ;
2835+ bind->ind = (short *)malloc ( ( size_t ) nRows * sizeof ( short ) ) ;
28312836 if ( !bind->ind )
28322837 {
28332838 executeBaton->error = NJSMessages::getErrorMsg ( errInsufficientMemory );
0 commit comments