Added a function to build indexer names

This commit is contained in:
Celine Mercier
2016-04-22 17:08:23 +02:00
parent ffa4557928
commit 839b3000a8
2 changed files with 36 additions and 0 deletions

View File

@ -15,6 +15,8 @@
#include "obiblob_indexer.h"
#include "obidms.h"
#include "obierrno.h"
#include "obidebug.h"
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);
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;
}