|
The QMClearSelect() function clears a select list. It is analogous to the QMBasic CLEARSELECT statement.
The function takes a single argument, ListNo, which is the select list number to be cleared. This must be in the range 0 to 10. No error occurs if the list was not active.
Applications that could leave unprocessed items in the list should always clear when it is no longer required. This is particularly important with the default select list (list 0) as items left in this list may affect commands executed on the server later in the session.
The program fragment in the examples below builds select list 1 and uses it to process records from the file open as fClients. It exits from the loop when it finds the first record where field 1 is empty. Because this could leave a partially processed select list, QMClearSelect() is used to clear the list.
void QMClearSelect(int ListNo)
QMSelect(fClients, 1);
do {
Id = QMReadNext(1);
if (Id == NULL) break;
Rec = QMRead(fClients, Id, Err);
QMFree(Id);
Fld = QMExtract(Rec, 1, 0, 0);
QMFree(Rec);
if (Fld[0] == '\0') break;
QMFree(Fld);
} while(1);
QMClearSelect(1);
Note that this example leaves variables Fld pointing to a dynamically allocated memory area on exit from the loop. This must be released using QMFree() when no longer needed.
|
QMClearSelect ByVal ListNo as Integer
QMSelect fClients, 1
Do
Id = QMReadNext(1)
If ID is Nothing Then Exit Do
Rec = QMRead(fClients, Id, Err)
If QMExtract(Rec, 1, 0, 0) = "" Then Exit Do
Loop
QMClearSelect 1
|
ClearSelect(ListNo)
session->Select(fClients, 1)
loop
Id = session->ReadNext(1)
until Id = ""
Rec = session->Read(fClients, Id, Err)
until Rec<1> = ""
repeat
session->ClearSelect(1)
|
ClearSelect(int ListNo)
qm.Select(fClients, 1);
do {
Id = qm.ReadNext(1);
if (qm.ServerError != SV$OK) break;
Rec = qm.Read(fClients, Id);
Fld = qm.Extract(Rec, 1, 0, 0);
} while(Fld.length() != 0);
qm.ClearSelect(1);
|
ClearSelect(ListNo)
QMSelect(fClients, 1)
while True:
Id = qm.ReadNext(1)
if Id = "": break
Rec, Err = QMRead(fClients, Id)
If Err != SV_OK: break
Fld = QMExtract(Rec, 1, 0, 0)
if Fld == "": break
qm.ClearSelect(1)
|
|