ugetblob
Get segmented data from the Uniface kernel.
long
ugetblob
(uc, fnum, segdata,
segmax, nextseg)
struct uctrl
*uc;
int
fnum;
unsigned char
*segdata;
long
segmax;
int
nextseg;
Parameters
- uc—address of the current control block.
- fnum—field number of the segmented pointer field.
- segdata—pointer to the memory allocated by the connector where the Uniface kernel can place the segmented field data.
- segmax—maximum size of data the DBMS connector can get in one segment.
- nextseg—NULL when asking the kernel to send the first segment. Not NULL when asking to send the next segment.
Return Values
The total number
of bytes available prior to the ugetblob
call.
For example, if segmax = 100,
and the return value is 200, there are still 100 bytes which the
Uniface kernel has not sent to the DBMS connector.
Description
ugetblob
is used during write and
update to get the segmented data from the Uniface kernel. The DBMS
connector continues to call ugetblob
until all
the data has been transferred, at which time the return value of ugetblob
will be less than segmax.
You can use the following variables as follows:
struct uctrl *ControlBlock; /* UNIFACE connector control block /* Pointer */ struct ufldlst *FieldList; /* Pointer to array of field list */ /* structures */ unsigned char Segment[MAXSEGSIZE]; /* Buffer to store segments of */ /* segmented field */ long SegmentLength; /* Actual length of segment */ int FieldNumber; /* Field number of segmented pointer */ /* field */ int NextSegmentFlag; /* Flag to differentiate between first */ /* and subsequent segments */
Sample code fragment for ugetblob
:
for (FieldList = ControlBlock–>uflist, FieldNumber = 0; FieldNumber < ControlBlock–>ufnum; FieldNumber++, FieldList++) { if (!(FieldList–>ufbits & 8)) continue; /* Not a segmented field */ NextSegmentFlag = 0; /* Indicate first segment */ do { SegmentLength = ugetblob(ControlBlock, FieldNumber, Segment, MAXSEGSIZE, NextSegmentFlag); if (SegmentLength > MAXSEGSIZE) /* More segments after current */ { /* segment are available */ PutSegmentInDB(Segment, MAXSEGSIZE); /* Fictitious routine to place */ /* segments of segmented field */ /* into the database */ } else /* This was the last segment */ { PutSegmentInDB(Segment, SegmentLength); /* Fictitious routine to place */ /* segments of segmented field */ /* into the database */ } NextSegmentFlag = 1; /* Indicate subsequent segments */ } while (SegmentLength > MAXSEGSIZE); }