QMRead()

Top  Previous  Next

 

The QMRead() function reads a record without locking.

 

 

Format

 

VBQMRead(ByVal FileNo as Integer, ByVal Id as String, ByRef Errno as Integer) as String

 

Cchar * QMRead(int FileNo, char * Id, int * Errno)

 

ObjStr = Session->Read(FileNo, Id, Errno)

 

where

 

FileNois the file number returned by a previous QMOpen() call.

 

Idis the id of the record to be read.

 

Errnois an integer variable to receive status information.

 

 

The QMRead() function requests the server to return the record with key Id from the file opened as FileNo.

 

If successful, the function returns the record as a dynamic array string and the Errno variable is set to SV_OK.

 

If the record cannot be found, the function returns a null string and the Errno variable is set to SV_ELSE. The QMStatus() function can be used to retrieve the error number.

 

Conditions that would normally cause a QMBasic program to abort or to take the ON ERROR clause of a READ statement return a null string and the Errno variable is set to SV_ON_ERROR. The QMStatus() function can be used to retrieve the error number.

 

In the C API library, the dynamic memory allocated for the returned string must subsequently be freed by the calling program.