HDFql Reference Manual v2.6.0

5.2.46hdfql_cursor_get_float

Syntax

float *hdfql_cursor_get_float(const HDFQL_CURSOR *cursor)

Description

Get the current element of a cursor named cursor as a FLOAT. In other words, the current element is interpreted as a “float” C data type and returned as a pointer to such type. If the result set is empty or the cursor is located before or after the first or last element of the result set, the returned element is NULL.

Parameter(s)

cursor – pointer to a cursor to get the current element as a FLOAT. If the pointer is NULL (in C), the current element 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 element of the cursor in use is returned instead).

Return

float * – pointer to the current element of the cursor. If there is no current element, the pointer will be NULL.

Example(s)

// create an HDF5 dataset named "my_dataset" of data type float of one dimension (size 3) 
hdfql_execute("CREATE DATASET my_dataset AS FLOAT(3)");

// insert (i.e. write) values into dataset "my_dataset" 
hdfql_execute("INSERT INTO my_dataset VALUES(5.5, 8.1, 4.9)");

// select (i.e. read) data from dataset "my_dataset" and populate cursor in use with it  
hdfql_execute("SELECT FROM my_dataset");

// move the cursor in use to next position within the result set (i.e. first position) 
hdfql_cursor_next(NULL); 

// display current element of the cursor in use as a float (should be "Current element of cursor is 5.5")
printf("Current element of cursor is %f\n", *hdfql_cursor_get_float(NULL));