Obiblob_indexer API

This commit is contained in:
Celine Mercier
2016-04-12 14:53:33 +02:00
parent cd4e65e190
commit d8107533d8
21 changed files with 252 additions and 131 deletions

View File

@ -29,7 +29,7 @@
#include "obierrno.h"
#include "obidebug.h"
#include "obilittlebigman.h"
#include "obiavl.h"
#include "obiblob_indexer.h"
#include "utils.h"
@ -519,7 +519,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
index_t nb_lines,
index_t nb_elements_per_line,
const char* elements_names,
const char* avl_name,
const char* indexer_name,
const char* comments
)
{
@ -554,9 +554,9 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
obidebug(1, "\nCan't create column because of invalid data type");
return NULL;
}
if (((data_type == OBI_STR) || (data_type == OBI_SEQ)) && (avl_name == NULL))
if (((data_type == OBI_STR) || (data_type == OBI_SEQ)) && (indexer_name == NULL))
{
obidebug(1, "\nCan't create column because of empty avl name");
obidebug(1, "\nCan't create column because of empty indexer name");
return NULL;
}
@ -724,19 +724,19 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
if (comments != NULL)
strncpy(header->comments, comments, COMMENTS_MAX_LENGTH);
// If the data type is OBI_STR or OBI_SEQ, the associated obi_avl is opened or created
// If the data type is OBI_STR or OBI_SEQ, the associated obi_indexer is opened or created
if ((returned_data_type == OBI_STR) || (returned_data_type == OBI_SEQ))
{
new_column->avl = obi_avl_group(dms, avl_name);
if (new_column->avl == NULL)
new_column->indexer = obi_indexer(dms, indexer_name);
if (new_column->indexer == NULL)
{
obidebug(1, "\nError opening or creating the AVL group associated with a column");
obidebug(1, "\nError opening or creating the indexer associated with a column");
munmap(new_column->header, header_size);
close(column_file_descriptor);
free(new_column);
return NULL;
}
strncpy(header->avl_name, avl_name, AVL_MAX_NAME);
strncpy(header->indexer_name, indexer_name, INDEXER_MAX_NAME);
}
// Fill the data with NA values
@ -876,13 +876,13 @@ OBIDMS_column_p obi_open_column(OBIDMS_p dms,
column->writable = false;
// If the data type is OBI_STR or OBI_SEQ, the associated AVL tree is opened
// If the data type is OBI_STR or OBI_SEQ, the associated indexer is opened
if (((column->header)->returned_data_type == OBI_STR) || ((column->header)->returned_data_type == OBI_SEQ))
{
column->avl = obi_open_avl_group(dms, (column->header)->avl_name);
if (column->avl == NULL)
column->indexer = obi_open_indexer(dms, (column->header)->indexer_name);
if (column->indexer == NULL)
{
obidebug(1, "\nError opening the AVL tree associated with a column");
obidebug(1, "\nError opening the indexer associated with a column");
munmap(column->header, header_size);
close(column_file_descriptor);
free(column);
@ -940,7 +940,7 @@ OBIDMS_column_p obi_clone_column(OBIDMS_p dms,
nb_lines,
nb_elements_per_line,
(column_to_clone->header)->elements_names,
(column_to_clone->header)->avl_name,
(column_to_clone->header)->indexer_name,
(column_to_clone->header)->comments
);
@ -1016,10 +1016,10 @@ int obi_close_column(OBIDMS_column_p column)
}
}
// If the data type is OBI_STR or OBI_SEQ, the associated AVL group is closed
// If the data type is OBI_STR or OBI_SEQ, the associated indexer is closed
if (((column->header)->returned_data_type == OBI_STR) || ((column->header)->returned_data_type == OBI_SEQ))
{
if (obi_close_avl_group(column->avl) < 0)
if (obi_close_indexer(column->indexer) < 0)
return -1;
}