#include "SampleLib.h"
int main(int argc, char **argv)
{
uint32_t startingNameLength, collectionNameLength;
const char *startingName, *collectionName;
dpiSodaCollCursor *cursor;
dpiSodaColl *coll;
dpiSodaDb *db;
if (argc < 2) {
startingName = NULL;
startingNameLength = 0;
printf("Iterating all SODA collections\n");
} else {
startingName = argv[1];
startingNameLength = strlen(startingName);
printf("Iterating SODA collections starting with %s\n", startingName);
}
db = dpiSamples_getSodaDb();
if (dpiSodaDb_getCollections(db, startingName, startingNameLength,
DPI_SODA_FLAGS_DEFAULT, &cursor) < 0)
return dpiSamples_showError();
while (1) {
if (dpiSodaCollCursor_getNext(cursor, DPI_SODA_FLAGS_DEFAULT,
&coll) < 0)
return dpiSamples_showError();
if (!coll)
break;
if (dpiSodaColl_getName(coll, &collectionName,
&collectionNameLength) < 0)
return dpiSamples_showError();
printf("Collection: %.*s\n", collectionNameLength, collectionName);
if (dpiSodaColl_release(coll) < 0)
return dpiSamples_showError();
}
dpiSodaCollCursor_release(cursor);
dpiSodaDb_release(db);
printf("Done.\n");
return 0;
}