5.2.15hdfql_cursor_get_dimension
Syntax
long long hdfql_cursor_get_dimension(const HDFQL_CURSOR *cursor, int index)
Description
Get the size of a certain dimension (specified by index) of the result set stored in a cursor named cursor. The size of a certain dimension refers to the result of a DATA QUERY LANGUAGE (DQL) or DATA INTROSPECTION LANGUAGE (DIL) operation redirected into a cursor. The index of the first dimension is zero. If cursor has never been populated or has been initialized or cleared, or index is not between 0 and the value returned by hdfql_cursor_get_dimension_count - 1, an error is returned.
Parameter(s)
cursor – pointer to a cursor to get the size of one of its dimensions. If the pointer is NULL (in C), the size of a certain dimension of the result set stored in 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 size of a certain dimension of the result set stored in the cursor in use is returned instead).
index – integer that specifies the index of the dimension whose size is to be obtained.
Return
long long – depending on the success in getting the size of a certain dimension of the cursor, it can either be equal to or greater than zero (i.e. the size of the specified dimension) or HDFQL_ERROR_OUTSIDE_LIMIT.
Example(s)
// create an HDF5 dataset named "my_dataset" of data type int of two dimensions (size 5x3)
hdfql_execute("CREATE DATASET my_dataset AS INT(5, 3)");
// select (i.e. read) data from dataset "my_dataset" and populate cursor in use with it
hdfql_execute("SELECT FROM my_dataset");
// display size of the first dimension of the result set stored in the cursor in use (should be "Size of first dimension of result set stored in cursor is 5")
printf("Size of first dimension of result set stored in cursor is %lld\n", hdfql_cursor_get_dimension(NULL, 0));
// display size of the second dimension of the result set stored in the cursor in use (should be "Size of second dimension of result set stored in cursor is 3")
printf("Size of second dimension of result set stored in cursor is %lld\n", hdfql_cursor_get_dimension(NULL, 1));