5.2.16hdfql_cursor_get_position
Syntax
long long hdfql_cursor_get_position(const HDFQL_CURSOR *cursor)
Description
Get the current position of a cursor named cursor within the result set. The current position refers to the result of a DATA QUERY LANGUAGE (DQL) or DATA INTROSPECTION LANGUAGE (DIL) operation redirected into a cursor. The first element of the result set is at position zero, while the last element is located at the position returned by hdfql_cursor_get_count - 1. If cursor has never been populated or has been initialized or cleared, the returned current position is minus one. If cursor was moved before the first element or after the last element, the returned current position is minus one or the number of elements in the result set, respectively.
Parameter(s)
cursor – pointer to a cursor to get its current position within the result set. If the pointer is NULL (in C), the current position of the cursor in use is returned instead. The equivalent of a NULL pointer in C++, Java, Python, C#, Fortran, R, and MATLAB HDFql wrappers is NULL, null, None, null, NULL(), NULL, and NaN, respectively. While in C cursor is mandatory, in C++, Java, Python, C#, Fortran, R, and MATLAB it is optional (when not specified, the current position of the cursor in use is returned instead).
Return
long long – current position of the cursor within the result set.
Example(s)
// show (i.e. get) working directory currently in use
hdfql_execute("SHOW USE DIRECTORY");
// move the cursor in use to the first position within the result set
hdfql_cursor_first(NULL);
// display position of the cursor in use within the result set (should be "Position of cursor is 0")
printf("Position of cursor is %lld\n", hdfql_cursor_get_position(NULL));
// clear the cursor in use
hdfql_cursor_clear(NULL);
// display (again) position of the cursor in use within the result set (should be "Position of cursor is -1")
printf("Position of cursor is %lld\n", hdfql_cursor_get_position(NULL));