Name

mysql_row_seek —

Synopsis

MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET offset)

Moves the pointer for a result set (MYSQL_RES structure) to a specific row and returns the original row number. This function requires that the offset be an actual MYSQL_ROW_OFFSET structure, not a simple row number. If you have only a row number, use the mysql_data_seek function. You can obtain a MYSQL_ROW_OFFSET structure from a call to either mysql_row_tell or mysql_row_seek.

This function is useful only if the result set contains all the data from the query. Therefore, it should be used in conjunction with mysql_store_result and not used with mysql_use_result.

Example

/* result is a result set pointer created with mysql_store_result(  ) */
MYSQL_ROW_OFFSET where, other_place;
where = mysql_row_tell( result );
/* Do some more work with the result set... */
/* Go back to where you were before, but remember where you are now: */
other_place = mysql_row_seek( result, where );
/* Do some more work... */
/* Go back to the second marker: */
mysql_row_seek( result, other_place );

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.