5.2.12hdfql_cursor_get_count
Syntax
long long hdfql_cursor_get_count(const HDFQL_CURSOR *cursor)
Description
Get the number of elements (i.e. result set size) stored in a cursor named cursor. The number of elements refers to the result of a DATA QUERY LANGUAGE (DQL) or DATA INTROSPECTION LANGUAGE (DIL) operation redirected into a cursor. If the result set stores data from a dataset or attribute that does not have a dimension (i.e. if it is scalar), the returned number of elements is one. Otherwise, if the result set stores data from a dataset or attribute that has dimensions, the returned number of elements equals the multiplication of all its dimensions’ sizes (e.g. if a cursor stores a result set of two dimensions of size 10x3, the number of elements is 30). If cursor has never been populated or has been initialized or cleared, the returned number of elements is zero.
Parameter(s)
cursor – pointer to a cursor to get its number of elements (i.e. result set size). If the pointer is NULL (in C), the number of elements 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 number of elements of the cursor in use is returned instead).
Return
long long – number of elements (i.e. result set size) stored in the cursor.
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 %lld\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 %lld\n", hdfql_cursor_get_count(NULL));