When retrieving the header of a column, the version number of the column
wanted can now be provided.
This commit is contained in:
@ -95,7 +95,7 @@ cdef class OBIDMS :
|
|||||||
column_name = entry.stem
|
column_name = entry.stem
|
||||||
column_name_b = str2bytes(column_name)
|
column_name_b = str2bytes(column_name)
|
||||||
dms[column_name] = {}
|
dms[column_name] = {}
|
||||||
header = obi_column_get_header_from_name(self.pointer, column_name_b)
|
header = obi_column_get_header_from_name(self.pointer, column_name_b, -1)
|
||||||
data_type = bytes2str(name_data_type(header.data_type))
|
data_type = bytes2str(name_data_type(header.data_type))
|
||||||
line_count = header.line_count
|
line_count = header.line_count
|
||||||
creation_date = bytes2str(obi_column_format_date(header.creation_date))
|
creation_date = bytes2str(obi_column_format_date(header.creation_date))
|
||||||
@ -137,7 +137,7 @@ cdef class OBIDMS :
|
|||||||
# Get the header of the latest version of the column if
|
# Get the header of the latest version of the column if
|
||||||
# some needed informations are not provided
|
# some needed informations are not provided
|
||||||
if ((not data_type or not nb_elements_per_line) and not create) :
|
if ((not data_type or not nb_elements_per_line) and not create) :
|
||||||
header = obi_column_get_header_from_name(self.pointer, column_name_b)
|
header = obi_column_get_header_from_name(self.pointer, column_name_b, version_number)
|
||||||
|
|
||||||
# Get the data type if not provided
|
# Get the data type if not provided
|
||||||
if not data_type :
|
if not data_type :
|
||||||
|
@ -63,7 +63,8 @@ cdef extern from "obidmscolumn.h" nogil:
|
|||||||
const_char_p column_name)
|
const_char_p column_name)
|
||||||
|
|
||||||
OBIDMS_column_header_p obi_column_get_header_from_name(OBIDMS_p dms,
|
OBIDMS_column_header_p obi_column_get_header_from_name(OBIDMS_p dms,
|
||||||
const_char_p column_name)
|
const_char_p column_name,
|
||||||
|
obiversion_t version_number)
|
||||||
|
|
||||||
int obi_unmap_header(OBIDMS_column_header_p header)
|
int obi_unmap_header(OBIDMS_column_header_p header)
|
||||||
|
|
||||||
|
@ -1185,14 +1185,13 @@ void obi_ini_to_NA_values(OBIDMS_column_p column,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OBIDMS_column_header_p obi_column_get_header_from_name(OBIDMS_p dms, const char* column_name) // TODO ADD VERSION ARGUMENT
|
OBIDMS_column_header_p obi_column_get_header_from_name(OBIDMS_p dms, const char* column_name, obiversion_t version_number)
|
||||||
{
|
{
|
||||||
OBIDMS_column_header_p header;
|
OBIDMS_column_header_p header;
|
||||||
OBIDMS_column_directory_p column_directory;
|
OBIDMS_column_directory_p column_directory;
|
||||||
char* column_file_name;
|
char* column_file_name;
|
||||||
int column_file_descriptor;
|
int column_file_descriptor;
|
||||||
size_t header_size;
|
size_t header_size;
|
||||||
obiversion_t version_number;
|
|
||||||
|
|
||||||
// Get the column directory structure associated to the column
|
// Get the column directory structure associated to the column
|
||||||
column_directory = obi_open_column_directory(dms, column_name);
|
column_directory = obi_open_column_directory(dms, column_name);
|
||||||
@ -1202,13 +1201,16 @@ OBIDMS_column_header_p obi_column_get_header_from_name(OBIDMS_p dms, const char*
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the latest version number
|
// Get the latest version number if not provided
|
||||||
|
if (version_number < 0)
|
||||||
|
{
|
||||||
version_number = obi_get_latest_version_number(column_directory);
|
version_number = obi_get_latest_version_number(column_directory);
|
||||||
if (version_number < 0)
|
if (version_number < 0)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError getting the latest version number in a column directory");
|
obidebug(1, "\nError getting the latest version number in a column directory");
|
||||||
return NULL;
|
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);
|
||||||
|
@ -169,6 +169,7 @@ size_t obi_get_platform_header_size();
|
|||||||
* @param nb_elements_per_line The number of elements per line.
|
* @param nb_elements_per_line The number of elements per line.
|
||||||
* @param elements_names The names of the elements with ';' as separator.
|
* @param elements_names The names of the elements with ';' as separator.
|
||||||
* @param array_name The name of the array if there is one associated with the column.
|
* @param array_name The name of the array if there is one associated with the column.
|
||||||
|
* @param comments Optional comments associated with the column.
|
||||||
*
|
*
|
||||||
* @returns A pointer on the newly created column structure.
|
* @returns A pointer on the newly created column structure.
|
||||||
* @retval NULL if an error occurred.
|
* @retval NULL if an error occurred.
|
||||||
@ -287,7 +288,7 @@ int obi_truncate_and_close_column(OBIDMS_column_p column);
|
|||||||
* @since August 2015
|
* @since August 2015
|
||||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||||
*/
|
*/
|
||||||
void obi_ini_to_NA_values(OBIDMS_column_p column, index_t first_line_nb, index_t nb_lines); // TO make private?
|
void obi_ini_to_NA_values(OBIDMS_column_p column, index_t first_line_nb, index_t nb_lines); // TODO make private?
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -297,6 +298,8 @@ void obi_ini_to_NA_values(OBIDMS_column_p column, index_t first_line_nb, index_t
|
|||||||
*
|
*
|
||||||
* @param dms A pointer on an OBIDMS.
|
* @param dms A pointer on an OBIDMS.
|
||||||
* @param column_name The name of an OBIDMS column.
|
* @param column_name The name of an OBIDMS column.
|
||||||
|
* @param version_number The version of the column from which the header should be
|
||||||
|
* retrieved (-1: latest version).
|
||||||
*
|
*
|
||||||
* @returns A pointer on the mmapped header of the column.
|
* @returns A pointer on the mmapped header of the column.
|
||||||
* @retval NULL if an error occurred.
|
* @retval NULL if an error occurred.
|
||||||
@ -304,7 +307,7 @@ void obi_ini_to_NA_values(OBIDMS_column_p column, index_t first_line_nb, index_t
|
|||||||
* @since October 2015
|
* @since October 2015
|
||||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||||
*/
|
*/
|
||||||
OBIDMS_column_header_p obi_column_get_header_from_name(OBIDMS_p dms, const char* column_name);
|
OBIDMS_column_header_p obi_column_get_header_from_name(OBIDMS_p dms, const char* column_name, obiversion_t version_number);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user