First version for the association of one column to another. Closes #55
This commit is contained in:
@ -527,14 +527,16 @@ size_t obi_get_platform_header_size()
|
||||
}
|
||||
|
||||
|
||||
OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
||||
const char* column_name,
|
||||
OBIType_t data_type,
|
||||
index_t nb_lines,
|
||||
index_t nb_elements_per_line,
|
||||
const char* elements_names,
|
||||
const char* indexer_name,
|
||||
const char* comments
|
||||
OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
||||
const char* column_name,
|
||||
OBIType_t data_type,
|
||||
index_t nb_lines,
|
||||
index_t nb_elements_per_line,
|
||||
const char* elements_names,
|
||||
const char* indexer_name,
|
||||
const char* associated_column_name,
|
||||
obiversion_t associated_column_version,
|
||||
const char* comments
|
||||
)
|
||||
{
|
||||
OBIDMS_column_p new_column;
|
||||
@ -750,6 +752,30 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
||||
if (comments != NULL)
|
||||
strncpy(header->comments, comments, COMMENTS_MAX_LENGTH);
|
||||
|
||||
// Store the associated column reference if needed // TODO discuss cases
|
||||
if (data_type == OBI_QUAL)
|
||||
{
|
||||
if (associated_column_name == NULL)
|
||||
{
|
||||
obidebug(1, "\nError: The name of the associated column when creating a new column is NULL");
|
||||
munmap(new_column->header, header_size);
|
||||
close(column_file_descriptor);
|
||||
free(new_column);
|
||||
return NULL;
|
||||
}
|
||||
strcpy((header->associated_column).column_name, associated_column_name);
|
||||
|
||||
if (associated_column_version == -1)
|
||||
{
|
||||
obidebug(1, "\nError: The version of the associated column when creating a new column is not defined");
|
||||
munmap(new_column->header, header_size);
|
||||
close(column_file_descriptor);
|
||||
free(new_column);
|
||||
return NULL;
|
||||
}
|
||||
(header->associated_column).version = associated_column_version;
|
||||
}
|
||||
|
||||
// If the data type is OBI_STR, OBI_SEQ or OBI_QUAL, the associated obi_indexer is opened or created
|
||||
if ((returned_data_type == OBI_STR) || (returned_data_type == OBI_SEQ) || (returned_data_type == OBI_QUAL))
|
||||
{
|
||||
@ -964,6 +990,8 @@ OBIDMS_column_p obi_clone_column(OBIDMS_p dms,
|
||||
nb_elements_per_line,
|
||||
(column_to_clone->header)->elements_names,
|
||||
(column_to_clone->header)->indexer_name,
|
||||
((column_to_clone->header)->associated_column).column_name,
|
||||
((column_to_clone->header)->associated_column).version,
|
||||
(column_to_clone->header)->comments
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user