Setting NA values is now handled properly for OBI_SEQ, OBI_STR and
OBI_QUAL columns
This commit is contained in:
@ -32,32 +32,38 @@ int obi_column_set_obiseq_with_elt_idx(OBIDMS_column_p column, index_t line_nb,
|
||||
if (obi_column_prepare_to_set_value(column, line_nb) < 0)
|
||||
return -1;
|
||||
|
||||
// TODO NA
|
||||
|
||||
// Add the value in the indexer
|
||||
idx = obi_index_dna_seq(column->indexer, value);
|
||||
if (idx == -1) // An error occurred
|
||||
if (value == OBISeq_NA)
|
||||
{
|
||||
if (obi_errno == OBI_READ_ONLY_INDEXER_ERROR)
|
||||
idx = OBIIdx_NA;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the value in the indexer
|
||||
idx = obi_index_dna_seq(column->indexer, value);
|
||||
if (idx == -1) // An error occurred
|
||||
{
|
||||
// TODO PUT IN A COLUMN FUNCTION
|
||||
// If the error is that the indexer is read-only, clone it
|
||||
new_indexer_name = obi_build_indexer_name((column->header)->name, (column->header)->version);
|
||||
if (new_indexer_name == NULL)
|
||||
return -1;
|
||||
column->indexer = obi_clone_indexer(column->indexer, new_indexer_name); // TODO Need to lock this somehow?
|
||||
strcpy((column->header)->indexer_name, new_indexer_name);
|
||||
free(new_indexer_name);
|
||||
obi_set_errno(0);
|
||||
if (obi_errno == OBI_READ_ONLY_INDEXER_ERROR)
|
||||
{
|
||||
// TODO PUT IN A COLUMN FUNCTION
|
||||
// If the error is that the indexer is read-only, clone it
|
||||
new_indexer_name = obi_build_indexer_name((column->header)->name, (column->header)->version);
|
||||
if (new_indexer_name == NULL)
|
||||
return -1;
|
||||
column->indexer = obi_clone_indexer(column->indexer, new_indexer_name); // TODO Need to lock this somehow?
|
||||
strcpy((column->header)->indexer_name, new_indexer_name);
|
||||
free(new_indexer_name);
|
||||
obi_set_errno(0);
|
||||
|
||||
// Add the value in the new indexer
|
||||
idx = obi_index_dna_seq(column->indexer, value);
|
||||
if (idx == -1)
|
||||
// Add the value in the new indexer
|
||||
idx = obi_index_dna_seq(column->indexer, value);
|
||||
if (idx == -1)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Add the value's index in the column
|
||||
*(((index_t*) (column->data)) + (line_nb * ((column->header)->nb_elements_per_line)) + element_idx) = idx;
|
||||
|
||||
|
Reference in New Issue
Block a user