uaddrec
Adds an entry to the Uniface hitlist.
void
uaddrec
(uc, pra, pralen, pk,
pklen, ord, ordlen)
struct uctrl
*uc;
unsigned char
*pra, *pk, *ord;
short
pralen, pklen, ordlen;
Parameters
- uc—address of the current control block.
- pra—address of a buffer containing the physical row address.
- pralen—length of the physical row address pointed to by pra. Zero means physical row addresses are not supported.
- pk—address of a buffer containing the concatenated primary key.
- pklen—length of the primary key pointed to by pk. Zero means that the primary key is not available, or not yet available.
- ord—address of a buffer
containing the sort data. This parameter only needs to be supplied
with a field-level DBMS which is not capable of sorting the data
itself, and only when ordering is requested in the Select request.
The sort data must be concatenated according to the sort specification
in the
ordlst
structure. - ordlen—length of the sort data pointed to by ord. Zero means that no sort data is supplied to Uniface in the Select connector request.
Note: pralen and pklen cannot both be zero.
Return Values
Not applicable.
Description
Adds an entry to the Uniface hitlist. Depending on optimization performed by Uniface, the complete record may be stored in the select cache.
If the connector sets uctrl->uonum
to
0 in the Select mode 0 request to indicate that the DBMS can sort
records itself, the connector must add hits in the requested order.
When uaddrec
is
called, the values of all fields must be available in the general
I/O buffer. In a field-level connector, the actual length
of the fields must be available in the field
list.
In both field-level and record-level connectors, the total length
of the record must be available in uctrl->udatlen
.
Uniface might decide not to store the complete record in the select cache, but it will add an entry to the hitlist and store the primary key, or the physical row address, or both.
uaddrec
can
only be called in the Select request mode 0 and 3.
The ubldprm
or ubldprim
service functions can be
used to build the concatenated primary key.
This example returns
records that are found during the Select connector request. When
the mode of request is 0 or 3, the ubldprim
service function
is used to construct the primary key needed to call the uaddrec
service function.
This examples creates the DrvAdminType
data
structure, which holds the PRA in its PRA field and the primary
key in its PKBuffer
field. Such a
structure would usually be stored in the connector workspace (uctrl->udrv
).
ReturnRecordsFoundInSelect ( struct uctrl *ControlBlock, DrvAdminType *ConnectorAdministration ) { unsigned char Dummy; if ( ControlBlock->umode == 1 || ControlBlock->umode == 2 ) { /* Ready: modes 1 and 2 do not require hit. */ } else { if ( ControlBlock->umode == 4 ) { usumhit ( ControlBlock ); } else { /* For modes 0 and 3 */ ubldprim ( ControlBlock, DrvAdministration->PKBuffer ); uaddrec ( ControlBlock, DrvAdministration->PRA, ControlBlock->uralen, DrvAdministration->PKBuffer, ControlBlock->uprimlen, (unsigned char*)Dummy, 0 ); } } }