6.7.8SHOW DATA TYPE
Syntax
SHOW DATA TYPE [DATASET | ATTRIBUTE] [file_name] object_name [BY NAME]
[post_processing_option]
[output_redirecting_option]
Description
Show (i.e. get) the data type of an HDF5 dataset or attribute or of its members named object_name. In case a dataset and an attribute with identical names (object_name) are stored in the same location (i.e. group) and neither the keyword DATASET nor ATTRIBUTE is specified, the data type returned belongs to the dataset. To explicitly get the data type of object_name according to its type, the keyword DATASET or ATTRIBUTE must be specified. If object_name ends with “/” and is of data type HDFQL_ENUMERATION or HDFQL_COMPOUND, the data types of members of object_name are returned instead.
Parameter(s)
file_name – optional string that specifies the name of the HDF5 file storing the dataset or attribute whose data type is to be obtained. If file_name is specified, the file is opened on the fly, the data type of the dataset or attribute is obtained, and the file is subsequently closed. If not specified, the file currently in use is used instead.
object_name – mandatory string that specifies the name of the HDF5 dataset or attribute whose data type is to be obtained, or the data types of its members if the name ends with “/” and the dataset or attribute is of data type HDFQL_ENUMERATION or HDFQL_COMPOUND.
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 data type of an HDF5 dataset or attribute or of its members as an HDFQL_INT, which 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, or HDFQL_UNDEFINED, respectively (please refer to Table 6.3 for additional information about data types). Otherwise, if the keyword BY NAME is specified, it returns the data type of a dataset or attribute or of its members as an HDFQL_VARCHAR, which can be “TINYINT”, “UNSIGNED_TINYINT”, “SMALLINT”, “UNSIGNED_SMALLINT”, “INT”, “UNSIGNED_INT”, “BIGINT”, “UNSIGNED_BIGINT”, “FLOAT”, “DOUBLE”, “CHAR”, “VARTINYINT”, “UNSIGNED_VARTINYINT”, “VARSMALLINT”, “UNSIGNED_VARSMALLINT”, “VARINT”, “UNSIGNED_VARINT”, “VARBIGINT”, “UNSIGNED_VARBIGINT”, “VARFLOAT”, “VARDOUBLE”, “VARCHAR”, “OPAQUE”, “BITFIELD”, “ENUMERATION”, “COMPOUND”, “REFERENCE”, or “UNDEFINED”.
Example(s)
# create an HDF5 dataset named "my_dataset0" of data type double
CREATE DATASET my_dataset0 AS DOUBLE
# show (i.e. get) data type of dataset "my_dataset0" (should return 512 (i.e. HDFQL_DOUBLE))
SHOW DATA TYPE my_dataset0
# create an HDF5 dataset named "my_dataset1" of data type float
CREATE DATASET my_dataset1 AS FLOAT
# show (i.e. get) data type of dataset "my_dataset1" (should return 256 (i.e. HDFQL_FLOAT))
SHOW DATA TYPE my_dataset1
# create an HDF5 dataset named "my_common" of data type short
CREATE DATASET my_common AS SMALLINT
# create an HDF5 attribute named "my_common" of data type int
CREATE ATTRIBUTE my_common AS INT
# show (i.e. get) data type of dataset "my_common" (should return 4 (i.e. HDFQL_SMALLINT))
SHOW DATA TYPE my_common
# show (i.e. get) data type of dataset "my_common" (should return 4 (i.e. HDFQL_SMALLINT))
SHOW DATA TYPE DATASET my_common
# show (i.e. get) data type of attribute "my_common" (should return 16 (i.e. HDFQL_INT))
SHOW DATA TYPE ATTRIBUTE my_common# create an HDF5 dataset named "my_dataset2" of data type enumeration composed of four members named "dog" (with value 0), "cat" (with value 1), "cow" (with value 2), and "owl" (with value 3)
CREATE DATASET my_dataset2 AS ENUMERATION(dog, cat, cow, owl)
# show (i.e. get) data type of dataset "my_dataset2" (should return 16777216 (i.e. HDFQL_ENUMERATION))
SHOW DATA TYPE my_dataset2
# show (i.e. get) data types of members of dataset "my_dataset2" (should return 1 (i.e. HDFQL_TINYINT), 1 (i.e. HDFQL_TINYINT), 1 (i.e. HDFQL_TINYINT), 1 (i.e. HDFQL_TINYINT))
SHOW DATA TYPE my_dataset2/
# create an HDF5 attribute named "my_attribute0" of data type enumeration composed of two members named "car" (with value 1000) and "plane" (with value 2000)
CREATE ATTRIBUTE my_attribute0 AS ENUMERATION(car AS 1000, plane AS 2000)
# show (i.e. get) data types of members of attribute "my_attribute0" (should return 4 (i.e. HDFQL_SMALLINT), 4 (i.e. HDFQL_SMALLINT))
SHOW DATA TYPE my_attribute0/
# create an HDF5 dataset named "my_dataset3" of data type compound composed of three members named "person" (of data type variable-length char), "age" (of data type unsigned int), and "weight" (of data type float)
CREATE DATASET my_dataset3 AS COMPOUND(person AS VARCHAR, age AS UNSIGNED INT, weight AS FLOAT)
# show (i.e. get) data type of dataset "my_dataset3" (should return 33554432 (i.e. HDFQL_COMPOUND))
SHOW DATA TYPE my_dataset3
# show (i.e. get) data types of members of dataset "my_dataset3" (should return 2097152 (i.e. HDFQL_VARCHAR), 32 (i.e. HDFQL_UNSIGNED_INT), 256 (i.e. HDFQL_FLOAT))
SHOW DATA TYPE my_dataset3/
# show (i.e. get) data types of members of dataset "my_dataset3" by name (should return "VARCHAR", "UNSIGNED_INT", "FLOAT")
SHOW DATA TYPE my_dataset3/ BY NAME
# create an HDF5 attribute named "my_attribute1" of data type compound composed of three members named "id" (of data type long long), "description" (of data type variable-length char), and "position" (of data type compound composed of two members named "x" (of data type short) and "y" (of data type short))
CREATE ATTRIBUTE my_attribute1 AS COMPOUND(id AS BIGINT, description AS VARCHAR, position AS COMPOUND(x AS SMALLINT, y AS SMALLINT))
# show (i.e. get) data types of members of attribute "my_attribute1" (should return 64 (i.e. HDFQL_BIGINT), 2097152 (i.e. HDFQL_VARCHAR), 33554432 (i.e. HDFQL_COMPOUND), 4 (i.e. HDFQL_SMALLINT), 4 (i.e. HDFQL_SMALLINT))
SHOW DATA TYPE my_attribute1/