SPQLFETCH() API Function

Gets row data from a statement token.

Valid in: SPD Server

Syntax

int spqlfetch(void *stmttok, void **bufptr, int *bufsize)

Required Arguments

int

void *stmttok

the statement token to use to access row data from the SELECT statement.

void **bufptr

contains a pointer to the caller's row buffer to fill with row data. If it is NULL on entry, it returns a pointer to the internal result set buffer.

int *bufsize

returns the size of the row buffer that was returned to the caller.

Details

INT fetches each row that an executing statement returns. Each call to spqlfetch returns a row from a statement to the caller's buffer. If bufptr contains a NULL value, the routine returns a pointer to a buffer containing the next row. If the value is not NULL, it assumes that the buffer is owned by the caller and returns the data to the caller's buffer. In either case, bufsize is updated with the row length returned. Callers that use locate-mode SPQLFETCH() semantics (that is, who specify bufptr as NULL) should NEVER FREE the memory pointer returned by spqlfetch. A call to spqlfetch(), after all rows for the statement are returned, returns a bufsize of 0.
Returns: 0 if successful; SPQL_ENDDATA if the statement has no more rows to return; SPQL_FETCHFAILED if there is an unexpected failure while fetching the next row buffer.
Last updated: February 8, 2017