HDFql Reference Manual v2.6.0

5.2.1hdfql_execute

Syntax

int hdfql_execute(const char *script)

Description

Execute a script named script. A script can be composed of one or more operations – in the case of multiple operations, these can either be separated with a semicolon (;) or an end-of-line (EOL) terminator. In HDFql, operations are case insensitive, meaning that, for example, the operation “SHOW DATASET” is equivalent to “show dataset” or any other case variation. If a certain operation raises an error, any subsequent operations within script are not executed. Please refer to Table 6.2 for a complete enumeration of HDFql operations.

Parameter(s)

script – string containing one or more operations to execute. Multiple operations are either separated with a semicolon (;) or an end-of-line (EOL) terminator.

Return

int – depending on the success in executing script, it can be HDFQL_SUCCESS, HDFQL_ERROR_PARSE, HDFQL_ERROR_NOT_SPECIFIED, HDFQL_ERROR_NOT_FOUND, HDFQL_ERROR_NO_ACCESS, HDFQL_ERROR_NOT_OPEN, HDFQL_ERROR_TEMPORARILY_UNAVAILABLE, HDFQL_ERROR_INVALID_NAME, HDFQL_ERROR_INVALID_FILE, HDFQL_ERROR_NOT_SUPPORTED, HDFQL_ERROR_NOT_ENOUGH_SPACE, HDFQL_ERROR_NOT_ENOUGH_MEMORY, HDFQL_ERROR_ALREADY_EXISTS, HDFQL_ERROR_EMPTY, HDFQL_ERROR_FULL, HDFQL_ERROR_BEFORE_FIRST, HDFQL_ERROR_AFTER_LAST, HDFQL_ERROR_OUTSIDE_LIMIT, HDFQL_ERROR_NO_ADDRESS, HDFQL_ERROR_UNEXPECTED_TYPE, HDFQL_ERROR_UNEXPECTED_DATA_TYPE, HDFQL_ERROR_UNEXPECTED_STORAGE_TYPE, HDFQL_ERROR_DANGLING_LINK, HDFQL_ERROR_NOT_REGISTERED, HDFQL_ERROR_INVALID_OPERATION, HDFQL_ERROR_INVALID_REGULAR_EXPRESSION, HDFQL_ERROR_INVALID_SELECTION, or HDFQL_ERROR_UNKNOWN.

Example(s)

// declare variable 
int status;

// execute script (composed of only one operation (i.e. SHOW USE FILE)) 
status = hdfql_execute("SHOW USE FILE");

// display message about the status of executed script (i.e. successful or not) 
if (status == HDFQL_SUCCESS)
    printf("Execution was successful\n");
else
    printf("Execution was not successful and returned status is %d\n", status);
// execute script (composed of two operations (i.e. USE FILE my_file.h5 and SHOW)) 
hdfql_execute("USE FILE my_file.h5 ; SHOW");