|
The QMReadNext() function retrieves the next entry from a select list. It is analogous to the QMBasic READNEXT statement.
The function arguments are:
| ListNo | is the number of the select list to be processed in the range 0 to 10. |
| Err | receives an error value indicating the outcome of the request. This argument is not present in all variants of the QMClient API/ |
The QMReadNext() function retrieves the next entry from the select list identified by the ListNo argument.
If successful, the function returns the list entry and, in the Visual Basic and QMBasic APIs, Err is set to SV_OK.
See Select lists in QMClient sessions for a description of the alternative ways to handle select list with QMClient.
See also the QMReadList() function for a discussion of the relationship between QMReadNext() and QMReadList().
The example program fragments below builds select list 1 and use it to process records from the file open as fClients.
char * QMReadNext(short int ListNo)
QMSelect(fClients, 1);
while((Id = QMReadNext(1)) != NULL)
{
if (Id == NULL) break;
Rec = QMRead(fClients, Id, Err);
if (Err == 0)
{
...process record...
QMFree(Rec);
}
QMFree(Id);
}
If successful, the function returns a pointer to a dynamically allocated memory area holding the item from the list. This memory must be released using QMFree() when no longer needed. If the function fails, the return value is NULL.
|
QMReadNext(ByVal ListNo as Short) as String
QMSelect fClients, 1
Do
Id = QMReadNext(1)
If Id Is Nothing Then Exit Do
Rec = QMRead(fClients, Id, Err)
If Err = 0 Then
...process record...
End If
Loop
If successful, the function returns the item from the list. If the function fails, the return value is Nothing.
|
ReadNext(ListNo, Err)
session->Select(fClients, 1)
loop
Id = session->ReadNext(1)
until Id = ""
Rec = session->Read(fClients, Id, Err)
if Err = 0 then
...process record...
end
repeat
If successful, the function returns the item from the list and the Err argument variable is set to SV_OK. If the function fails, the return value is a null string and the Err argument variable will be non-zero.
|
String ReadNext(int ListNo)
qm.Select(fClients, 1);
while(true)
{
Id = qm.ReadNext(1);
if (qm.ServerError != SV$OK) break;
Rec = qm.Read(fClients, Id);
if (qm.ServerError == SV$OK)
{
...process record...
}
}
|
ReadNext(ListNo)
qm.Select(fClients, 1)
while True:
Id = qm.ReadNext(1)
if Id = "": break
Rec, Err = qm.Read(fClients, Id)
...process record...
If successful, the server error status will be set to SV_OK. If there are no further items to extract from the list, The return id will be a null string and the server error status will be set to SV_ELSE.
|
|