The default name of an AVL is now the column name + '_indexer', and when

an AVL is opened (as opposed to created), it is read-only
This commit is contained in:
Celine Mercier
2016-04-15 12:55:26 +02:00
parent e04ea85d1e
commit 02d67c257f
4 changed files with 34 additions and 14 deletions

View File

@ -535,6 +535,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
index_t minimum_line_count;
OBIType_t returned_data_type;
OBIType_t stored_data_type;
char final_indexer_name[INDEXER_MAX_NAME];
new_column = NULL;
@ -554,11 +555,13 @@ 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)) && (indexer_name == NULL))
{
obidebug(1, "\nCan't create column because of empty indexer name");
return NULL;
if (((data_type == OBI_STR) || (data_type == OBI_SEQ)) && (strcmp(indexer_name, "") == 0))
{ // TODO make function in obiblob_indexer.c and discuss the fact that it's here
strcpy(final_indexer_name, column_name);
strcat(final_indexer_name, "_indexer");
}
else
strcpy(final_indexer_name, indexer_name);
returned_data_type = data_type;
if ((data_type == OBI_STR) || (data_type == OBI_SEQ))
@ -727,7 +730,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
// 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->indexer = obi_indexer(dms, indexer_name);
new_column->indexer = obi_indexer(dms, final_indexer_name);
if (new_column->indexer == NULL)
{
obidebug(1, "\nError opening or creating the indexer associated with a column");
@ -736,7 +739,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
free(new_column);
return NULL;
}
strncpy(header->indexer_name, indexer_name, INDEXER_MAX_NAME);
strncpy(header->indexer_name, final_indexer_name, INDEXER_MAX_NAME);
}
// Fill the data with NA values