II_EXTERN II_BOOL IIapi_validPColCount( IIAPI_STMTHNDL *stmtHndl, IIAPI_PUTCOLPARM *putColParm ) { II_BOOL valid = TRUE; /* ** Any non-empty subset is valid. There are no ** restrictions on single segment BLOBs. For ** multi-segment BLOBs (the more Segments flag ** is set), the BLOB must be the last column in ** the current group. Note: we cannot detect ** the case where two BLOBs are in the current ** group and pc_moreSegments applies to the first. ** In this case we will send the first as a single ** segment BLOB and assume that the second has ** additional segments. */ if ( putColParm->pc_columnCount < 1 || (stmtHndl->sh_colIndex + putColParm->pc_columnCount) > stmtHndl->sh_colCount ) { valid = FALSE; /* Not a proper non-empty subset */ } else if ( putColParm->pc_moreSegments && ! IIapi_isBLOB( stmtHndl->sh_colDescriptor[ stmtHndl->sh_colIndex + putColParm->pc_columnCount - 1 ].ds_dataType ) ) { valid = FALSE; /* Must be sending BLOB to set moreSegments */ } return( valid ); }
II_EXTERN II_BOOL IIapi_validParmCount( IIAPI_STMTHNDL *stmtHndl, IIAPI_PUTPARMPARM *putParmParm ) { II_BOOL valid; /* ** Any non-empty subset is valid as long as all the service ** parameters are included in the first set. There are no ** restrictions on single segment BLOBs. For multi-segment ** BLOBs (the more Segments flag is set), the BLOB must be ** the last parameter in the current group. Note: we cannot ** detect the case where two BLOBs are in the current group ** and pp_moreSegments applies to the first. In this case ** we will send the first as a single segment BLOB and assume ** that the second has additional segments. */ if ( putParmParm->pp_parmCount < 1 || (stmtHndl->sh_parmIndex + putParmParm->pp_parmCount) > stmtHndl->sh_parmCount ) { valid = FALSE; /* Not a proper non-empty subset */ } else if ( putParmParm->pp_moreSegments && ! IIapi_isBLOB( stmtHndl->sh_parmDescriptor[ stmtHndl->sh_parmIndex + putParmParm->pp_parmCount - 1 ].ds_dataType ) ) { valid = FALSE; /* Must be sending BLOB to set moreSegments */ } else if ( stmtHndl->sh_parmIndex ) valid = TRUE; /* Proper subset (not first) */ else { i4 count; /* ** Count the number of service parms expected. ** Service parms, if present, are contiguous at ** start of parameters. */ for( count = 0; count < stmtHndl->sh_parmCount && stmtHndl->sh_parmDescriptor[ count ].ds_columnType == IIAPI_COL_SVCPARM; count++ ); /* ** Make sure we have all the service parms. */ valid = (count <= putParmParm->pp_parmCount) ? TRUE : FALSE; } return( valid ); }
static II_VOID load_columns ( IIAPI_STMTHNDL *stmtHndl, IIAPI_GETCOLPARM *getColParm, IIAPI_MSG_BUFF *msgBuff ) { IIAPI_DESCRIPTOR *descr; IIAPI_DATAVALUE *value; i4 length; u_i2 len; bool done; IIAPI_TRACE( IIAPI_TR_VERBOSE ) ( "IIapi_loadColumns: %d columns starting with %d, %d total columns\n", (II_LONG)stmtHndl->sh_colFetch, (II_LONG)stmtHndl->sh_colIndex, (II_LONG)stmtHndl->sh_colCount ); descr = &stmtHndl->sh_colDescriptor[ stmtHndl->sh_colIndex ]; value = &getColParm->gc_columnData[ (getColParm->gc_rowsReturned * getColParm->gc_columnCount) + getColParm->gc_columnCount - stmtHndl->sh_colFetch ]; /* ** Process columns until all done or input buffer exhausted. */ for( ; stmtHndl->sh_colFetch; stmtHndl->sh_colFetch--, stmtHndl->sh_colIndex++, descr++, value++ ) { /* ** Clear column info at start of row. The more segments ** flag must not be set otherwise the first column is a ** LOB which has already been partially processed. There ** must also be at least some data available for the first ** column, otherwise we may be clearing the info when the ** last row has already been received. */ if ( stmtHndl->sh_colIndex == 0 && ! (stmtHndl->sh_flags & IIAPI_SH_MORE_SEGMENTS) && msgBuff->length > 0 ) { i2 i; for( i = 0; i < stmtHndl->sh_colCount; i++ ) stmtHndl->sh_colInfo[ i ].ci_flags = 0; } /* ** Blobs are broken into segments of variable lengths ** and require special handling to load segments using ** internal data value info. */ if ( IIapi_isBLOB( descr->ds_dataType ) ) done = load_blob( stmtHndl, getColParm, descr, msgBuff, value ); else done = cnvtGDV2DataValue( stmtHndl, descr, msgBuff, value, (stmtHndl->sh_flags & IIAPI_SH_COMP_VARCHAR) ? TRUE : FALSE ); if ( ! done ) break; /* Need more data for current column */ stmtHndl->sh_colInfo[ stmtHndl->sh_colIndex ].ci_flags |= IIAPI_CI_AVAIL; IIAPI_TRACE( IIAPI_TR_VERBOSE ) ( "IIapi_loadColumns: loaded data for column %d\n", (II_LONG)stmtHndl->sh_colIndex ); } return; }