HDFql Reference Manual v2.6.0

5.2.9hdfql_cursor_clear

Syntax

int hdfql_cursor_clear(HDFQL_CURSOR *cursor)

Description

Clear (i.e. empty) a cursor named cursor. Specifically, this function removes all elements (i.e. result set) stored in the cursor, sets its data type to undefined (HDFQL_UNDEFINED), changes its current element to NULL, and resets its count, number of dimensions, and position attributes to zero, zero, and minus one, respectively.

Parameter(s)

cursor – pointer to a cursor to clear (i.e. empty). If the pointer is NULL (in C), the cursor in use is cleared 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 cursor in use is cleared instead).

Return

int – depending on the success in clearing cursor, it can either be HDFQL_SUCCESS or HDFQL_ERROR_NOT_REGISTERED.

Example(s)

// show (i.e. get) working directory currently in use 
hdfql_execute("SHOW USE DIRECTORY");

// display number of elements in the cursor in use (should be "Number of elements in cursor is 1")
printf("Number of elements in cursor is %d\n", hdfql_cursor_get_count(NULL));

// clear the cursor in use 
hdfql_cursor_clear(NULL);

// display (again) number of elements in the cursor in use (should be "Number of elements in cursor is 0")
printf("Number of elements in cursor is %d\n", hdfql_cursor_get_count(NULL));