C sources modified to add the handling of OBIDM columns with the type

OBI_INT, and the handling of multiple types in general
This commit is contained in:
celinemercier
2015-07-31 18:03:48 +02:00
parent a6abc74500
commit 5f62cd8526
6 changed files with 684 additions and 10 deletions

View File

@ -14,6 +14,10 @@
#include "obidms.h"
#include "obierrno.h"
#include "obidebug.h"
#include "obidmscolumn.h"
#define DEBUG_LEVEL 0
/**************************************************************************
@ -148,6 +152,7 @@ OBIDMS_p obi_open_dms(const char* dms_name)
directory = opendir(directory_name);
if (directory == NULL)
{
obidebug(1, "Can't open DMS");
switch (errno)
{
case ENOENT:
@ -206,6 +211,49 @@ OBIDMS_p obi_dms(const char* dms_name)
}
int obi_list_columns(OBIDMS_p dms)
{
DIR *d;
struct dirent *dir;
char* dir_name;
char* extension;
OBIType_t data_type;
obiversion_t latest_version;
d = dms->directory;
dir = readdir(d);
fprintf(stderr, "Column name\tData type\tLatest version");
while (dir != NULL)
{
dir_name = strdup(dir->d_name);
if (dir_name == NULL)
{
obidebug(1, "\nError strdup-ing a directory name");
return -1;
}
dir_name = strtok(dir_name, ".");
extension = strtok(NULL, ".");
if ((extension != NULL) && (strcmp("obicol", extension) == 0))
// Found a column directory
{
data_type = obi_column_get_data_type_from_name(dms, dir_name);
latest_version = obi_column_get_latest_version_from_name(dms, dir_name);
fprintf(stderr, "\n%s\t%d\t%d", dir_name, data_type, latest_version);
}
dir = readdir(d);
}
rewinddir(d);
return(0);
}
int obi_close_dms(OBIDMS_p dms)
{
if (dms != NULL)