Creating a column now uses the function to create the indexer name if
one was not provided
This commit is contained in:
@ -549,7 +549,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
|||||||
index_t minimum_line_count;
|
index_t minimum_line_count;
|
||||||
OBIType_t returned_data_type;
|
OBIType_t returned_data_type;
|
||||||
OBIType_t stored_data_type;
|
OBIType_t stored_data_type;
|
||||||
char final_indexer_name[INDEXER_MAX_NAME];
|
char* final_indexer_name;
|
||||||
|
|
||||||
new_column = NULL;
|
new_column = NULL;
|
||||||
|
|
||||||
@ -569,13 +569,35 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
|||||||
obidebug(1, "\nCan't create column because of invalid data type");
|
obidebug(1, "\nCan't create column because of invalid data type");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the column directory structure associated to the column
|
||||||
|
column_directory = obi_column_directory(dms, column_name);
|
||||||
|
if (column_directory == NULL)
|
||||||
|
{
|
||||||
|
obi_set_errno(OBICOLDIR_UNKNOWN_ERROR);
|
||||||
|
obidebug(1, "\nError opening a column directory structure");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the latest version number
|
||||||
|
version_number = obi_get_new_version_number(column_directory, true);
|
||||||
|
if (version_number < 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the indexer name if needed
|
||||||
if (((data_type == OBI_STR) || (data_type == OBI_SEQ)) && (strcmp(indexer_name, "") == 0))
|
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);
|
final_indexer_name = obi_build_indexer_name(column_name, version_number);
|
||||||
strcat(final_indexer_name, "_indexer"); // TODO _version_indexer
|
if (final_indexer_name == NULL)
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
final_indexer_name = (char*) malloc((strlen(indexer_name)+1)*sizeof(char));
|
||||||
strcpy(final_indexer_name, indexer_name);
|
strcpy(final_indexer_name, indexer_name);
|
||||||
|
}
|
||||||
|
|
||||||
returned_data_type = data_type;
|
returned_data_type = data_type;
|
||||||
if ((data_type == OBI_STR) || (data_type == OBI_SEQ))
|
if ((data_type == OBI_STR) || (data_type == OBI_SEQ))
|
||||||
@ -623,27 +645,11 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the column directory structure associated to the column
|
|
||||||
column_directory = obi_column_directory(dms, column_name);
|
|
||||||
if (column_directory == NULL)
|
|
||||||
{
|
|
||||||
obi_set_errno(OBICOLDIR_UNKNOWN_ERROR);
|
|
||||||
obidebug(1, "\nError opening a column directory structure");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate the size needed
|
// Calculate the size needed
|
||||||
header_size = obi_get_platform_header_size();
|
header_size = obi_get_platform_header_size();
|
||||||
data_size = obi_array_sizeof(stored_data_type, nb_lines, nb_elements_per_line);
|
data_size = obi_array_sizeof(stored_data_type, nb_lines, nb_elements_per_line);
|
||||||
file_size = header_size + data_size;
|
file_size = header_size + data_size;
|
||||||
|
|
||||||
// Get the latest version number
|
|
||||||
version_number = obi_get_new_version_number(column_directory, true);
|
|
||||||
if (version_number < 0)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the column file name
|
// Get the column file name
|
||||||
column_file_name = build_column_file_name(column_name, version_number);
|
column_file_name = build_column_file_name(column_name, version_number);
|
||||||
if (column_file_name == NULL)
|
if (column_file_name == NULL)
|
||||||
|
Reference in New Issue
Block a user