HDFql Reference Manual v2.6.0

5.2.56hdfql_variable_get_data_type

Syntax

int hdfql_variable_get_data_type(const void *variable)

Description

Get the data type of the result set stored in a variable named variable. The data type refers to the result of a DATA QUERY LANGUAGE (DQL) or DATA INTROSPECTION LANGUAGE (DIL) operation redirected into memory – and not to the data type of variable declared in the program. If variable has been registered but has never been populated through a redirection operation, the returned data type is undefined (HDFQL_UNDEFINED). Please refer to Table 6.3 for a complete enumeration of HDFql data types.

Parameter(s)

variable – pointer to a variable whose data type is to be obtained.

Return

int – depending on the success in getting the data type of the variable, it can be HDFQL_TINYINT, HDFQL_UNSIGNED_TINYINT, HDFQL_SMALLINT, HDFQL_UNSIGNED_SMALLINT, HDFQL_INT, HDFQL_UNSIGNED_INT, HDFQL_BIGINT, HDFQL_UNSIGNED_BIGINT, HDFQL_FLOAT, HDFQL_DOUBLE, HDFQL_CHAR, HDFQL_VARTINYINT, HDFQL_UNSIGNED_VARTINYINT, HDFQL_VARSMALLINT, HDFQL_UNSIGNED_VARSMALLINT, HDFQL_VARINT, HDFQL_UNSIGNED_VARINT, HDFQL_VARBIGINT, HDFQL_UNSIGNED_VARBIGINT, HDFQL_VARFLOAT, HDFQL_VARDOUBLE, HDFQL_VARCHAR, HDFQL_OPAQUE, HDFQL_BITFIELD, HDFQL_ENUMERATION, HDFQL_COMPOUND, HDFQL_REFERENCE, HDFQL_UNDEFINED, HDFQL_ERROR_NO_ADDRESS, or HDFQL_ERROR_NOT_REGISTERED.

Example(s)

// declare variables 
char script[1024]; 
char data[1024];

// register variable "data" for subsequent use (by HDFql) 
hdfql_variable_register(data);

// prepare script to show (i.e. get) working directory currently in use and populate variable "data" with it
sprintf(script, "SHOW USE DIRECTORY INTO MEMORY %d", hdfql_variable_get_number(data));

// execute script 
hdfql_execute(script); 

// display data type of variable "data" (should be "Data type of variable is 2097152") 
printf("Data type of variable is %d\n", hdfql_variable_get_data_type(data));