Added a function to build indexer names
This commit is contained in:
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "obiblob_indexer.h"
|
#include "obiblob_indexer.h"
|
||||||
#include "obidms.h"
|
#include "obidms.h"
|
||||||
|
#include "obierrno.h"
|
||||||
|
#include "obidebug.h"
|
||||||
|
|
||||||
|
|
||||||
inline int obi_indexer_exists(OBIDMS_p dms, const char* name);
|
inline int obi_indexer_exists(OBIDMS_p dms, const char* name);
|
||||||
@ -31,3 +33,22 @@ inline index_t obi_indexer_add(Obi_indexer_p indexer, Obi_blob_p value);
|
|||||||
|
|
||||||
inline Obi_blob_p obi_indexer_get(Obi_indexer_p indexer, index_t idx);
|
inline Obi_blob_p obi_indexer_get(Obi_indexer_p indexer, index_t idx);
|
||||||
|
|
||||||
|
|
||||||
|
char* obi_build_indexer_name(const char* column_name, obiversion_t column_version)
|
||||||
|
{
|
||||||
|
char* indexer_name;
|
||||||
|
|
||||||
|
indexer_name = (char*) malloc(INDEXER_MAX_NAME * sizeof(char));
|
||||||
|
if (indexer_name == NULL)
|
||||||
|
{
|
||||||
|
obi_set_errno(OBI_MALLOC_ERROR);
|
||||||
|
obidebug(1, "\nError allocating the memory for an indexer name");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(indexer_name, column_name);
|
||||||
|
sprintf(indexer_name+strlen(column_name), "_%d_indexer", column_version);
|
||||||
|
|
||||||
|
return indexer_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -159,5 +159,20 @@ inline Obi_blob_p obi_indexer_get(Obi_indexer_p indexer, index_t idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Builds an indexer name in the form columnname_columnversion_indexer.
|
||||||
|
*
|
||||||
|
* @param column_name The name of the column associated with the indexer.
|
||||||
|
* @param column_version The version of the column associated with the indexer.
|
||||||
|
*
|
||||||
|
* @returns A pointer on the indexer name built.
|
||||||
|
* @retval NULL if an error occurred.
|
||||||
|
*
|
||||||
|
* @since April 2016
|
||||||
|
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||||
|
*/
|
||||||
|
char* obi_build_indexer_name(const char* column_name, obiversion_t column_version)
|
||||||
|
|
||||||
|
|
||||||
#endif /* OBIBLOB_INDEXER_H_ */
|
#endif /* OBIBLOB_INDEXER_H_ */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user