Page tree









Insert a new field into a table


H5TB_INSERT_FIELD (loc_id, dset_name, field_name, field_type, position, fill_data, data )


herr_t H5TBinsert_field(hid_t loc_id,
                        const char *dset_name,
                        const char *field_name,
                        hid_t field_type,
                        hsize_t position,
                        const void *fill_data,
                        const void *buf)

subroutine h5tbinsert_field_f(loc_id, dset_name, field_name, field_type, &
                              field_index, buf, errcode )
  implicit none
  integer(HID_T), intent(IN) :: loc_id           ! file or group identifier 
  character(LEN=*), intent(IN) :: dset_name      ! name of the dataset 
  character(LEN=*), intent(IN) :: field_name     ! name of the field
  integer(HID_T), intent(IN)   :: field_type     ! field type
  integer, intent(IN) :: field_index             ! field_index
  , intent(IN), dimension(*) :: buf        ! data buffer 
  integer :: errcode                             ! error code
end subroutine h5tbinsert_field_f

hid_t loc_idIN: Identifier of the file or group in which the table is located
const char *dset_nameIN: The name of the table
const char *field_nameIN: The name of the field to insert
hid_t field_typeIN: The data type of the field
hsize_t positionIN: The zero based index position where to insert the field
void *fill_dataIN: Fill value data for the field. This parameter can be NULL
const void *dataIN: Buffer with data


H5TB_INSERT_FIELD inserts a new field named field_name into the table dset_name. Note: this function requires the table to be re-created and rewritten in its entirety, and this can result in some unused space in the file, and can also take a great deal of time if the table is large. 


Returns a non-negative value if successful; otherwise returns a negative value.


hl / examples / ex_table_11.c [95:98]
 1.10/master  HDFFV/hdf5  Copy
 /* Insert the new field at the end of the field list */
 position = NFIELDS;
 H5TBinsert_field( file_id, TABLE_NAME, "New Field", field_type_new, position,
  fill_data_new, data );

hl / fortran / test / tsttable.F90 [449:449]
 hdf5_1_12  HDFFV/hdf5  Copy
  CALL h5tbinsert_field_f(file_id,dsetname1,"field5",field_types(4),4,bufr,errcode)

--- Last Modified: December 19, 2019 | 10:20 AM