New OBIDMS method to list the columns of an OBIDMS

This commit is contained in:
Celine Mercier
2015-09-15 17:09:31 +02:00
parent 90bf15186e
commit 2698022aaf
7 changed files with 130 additions and 69 deletions

View File

@ -216,54 +216,6 @@ 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);
if (dir == NULL)
{
obidebug(1, "\nError reading in the OBIDMS directory");
return -1;
}
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)