6.7.7SHOW TYPE
Syntax
SHOW TYPE [file_name] object_name [, [file_name] object_name]* [BY NAME]
[post_processing_option]
[output_redirecting_option]
Description
Show (i.e. get) the type of an object named object_name. Multiple objects’ types can be obtained at once by separating their names with a comma (,). If object_name was not found or its type could not be obtained (due to unknown/unexpected reasons), no subsequent objects are checked, and an error is raised.
Parameter(s)
file_name – optional string that specifies the name of the HDF5 file storing the object whose type is to be obtained. If file_name is specified, the file is opened on the fly, the type of the object is obtained, and the file is subsequently closed. If not specified, the file currently in use is used instead.
object_name – name of the object whose type is to be obtained.
post_processing_option – optional option that transforms the result set according to the programmer’s needs, such as ordering or truncating (please refer to the section PROCESSING for additional information).
output_redirecting_option – optional option that specifies the cursor in use, an HDF5 object (i.e. dataset or attribute), a (text, binary, or Excel) file, or memory (i.e. user-defined variable) to write the result set into (please refer to the subsection INTO for additional information). If not specified, the cursor in use is populated with the result set instead (please refer to the chapter CURSOR for additional information).
Return
If the keyword BY NAME is not specified, it returns the type of an object as an HDFQL_INT, which can be HDFQL_GROUP, HDFQL_DATASET, HDFQL_ATTRIBUTE, HDFQL_SOFT_LINK, HDFQL_EXTERNAL_LINK, HDFQL_SOFT_LINK | HDFQL_GROUP, HDFQL_EXTERNAL_LINK | HDFQL_GROUP, HDFQL_SOFT_LINK | HDFQL_DATASET, or HDFQL_EXTERNAL_LINK | HDFQL_DATASET depending on whether the object is a group, dataset, attribute, (soft) link, external link, (soft) link and group at the same time, external link and group at the same time, (soft) link and dataset at the same time, or external link and dataset at the same time, respectively. Otherwise, if the keyword BY NAME is specified, it returns the type of an object as an HDFQL_VARCHAR, which can be “GROUP”, “DATASET”, “ATTRIBUTE”, “SOFT_LINK”, “EXTERNAL_LINK”, “SOFT_LINK | GROUP”, “EXTERNAL_LINK | GROUP”, “SOFT_LINK | DATASET”, or “EXTERNAL_LINK | DATASET”.
Example(s)
# create an HDF5 group named "my_object0"
CREATE GROUP my_object0
# create an HDF5 dataset named "my_object1" of data type double
CREATE DATASET my_object1 AS DOUBLE
# create an HDF5 attribute named "my_object2" of data type float
CREATE ATTRIBUTE my_object2 AS FLOAT
# create an HDF5 soft link named "my_object3" to object "my_object0"
CREATE SOFT LINK my_object3 TO my_object0
# create an HDF5 external link named "my_object4" to object "my_object" (assumed to be a dataset) in file "my_file.h5"
CREATE EXTERNAL LINK my_object4 TO my_file.h5 my_object
# show (i.e. get) type of object "my_object0" (should return 4 (i.e. HDFQL_GROUP))
SHOW TYPE my_object0
# show (i.e. get) type of object "my_object1" (should return 8 (i.e. HDFQL_DATASET))
SHOW TYPE my_object1
# show (i.e. get) type of object "my_object2" (should return 16 (i.e. HDFQL_ATTRIBUTE))
SHOW TYPE my_object2
# show (i.e. get) type of both objects "my_object0" and "my_object2" at once (should return 4, 16)
SHOW TYPE my_object0, my_object2
# show (i.e. get) type of both objects "my_object0" and "my_object2" at once by name (should return "GROUP", "ATTRIBUTE")
SHOW TYPE my_object0, my_object2 BY NAME
# show (i.e. get) type of object "my_object3" (should return 36 (i.e. HDFQL_SOFT_LINK | HDFQL_GROUP))
SHOW TYPE my_object3
# show (i.e. get) type of object "my_object4" (should return 136 (i.e. HDFQL_EXTERNAL_LINK | HDFQL_DATASET))
SHOW TYPE my_object4