5.2.52hdfql_variable_transient_register
Syntax
int hdfql_variable_transient_register(const void *variable)
Description
Register a variable named variable in a transient way for subsequent use. This function is similar to hdfql_variable_register, except that after the execution of a script (via the function hdfql_execute) that uses variable, variable is automatically unregistered (by HDFql), thus alleviating the programmer from having to do it.
Parameter(s)
variable – pointer to a variable to register in a transient way for subsequent use.
Return
int – depending on the success in registering the variable in a transient way for subsequent use, it can be equal to or greater than zero (i.e. the number assigned to the variable when successfully registered), HDFQL_ERROR_NO_ADDRESS, HDFQL_ERROR_FULL, or HDFQL_ERROR_UNEXPECTED_DATA_TYPE.
Example(s)
// declare variables
char script[1024];
short data[3];
int number;
// create an HDF5 dataset named "my_dataset" of data type short of one dimension (size 3)
hdfql_execute("CREATE DATASET my_dataset AS SMALLINT(3)");
// populate variable "data" with certain values
data[0] = 21;
data[1] = 18;
data[2] = 75;
// register variable "data" in a transient way for subsequent use (by HDFql)
number = hdfql_variable_transient_register(data);
// prepare script to insert (i.e. write) values from variable "data" into dataset "my_dataset"
sprintf(script, "INSERT INTO my_dataset VALUES FROM MEMORY %d", number);
// execute script (variable "data" is automatically unregistered immediately after the execution of the script (i.e. there is no need to explicitly unregister the variable))
hdfql_execute(script);