#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "example_fcns.h"
#include "core05_structs.h"
#include "core05_cat.h"
const char *const description = "Demonstrates using an index for ordering";
{
PERSON person_rec;
print_error (rc);
{
int ii;
printf ("Adding 5 new person records\n");
for (ii = 0; ii < 5; ii++)
{
unsigned int value;
value = (unsigned int) rand () % 10000;
sprintf (person_rec.last_four_ssn, "%04u", value);
hDB, TABLE_PERSON, &person_rec, sizeof (person_rec), NULL);
print_error (rc);
printf ("\t%s\n", person_rec.last_four_ssn);
}
else
print_error (rc);
}
return rc;
}
{
PERSON person_rec;
print_error (rc);
{
printf ("\nList all records in index order\n");
print_error (rc);
{
{
cursor, &person_rec, sizeof (person_rec), NULL);
print_error (rc);
printf ("%s\n", person_rec.last_four_ssn);
}
}
{
}
else
{
print_error (rc);
}
}
return rc;
}
int main_core05 (int argc, const char *const *argv)
{
srand ((unsigned int) time (NULL));
print_error (rc);
{
rc = exampleOpenDatabase (&hTFS, &hDB, "core05", core05_cat);
{
rc = insertFiveRows (hDB);
{
rc = readAllRows (hDB);
}
exampleCleanup (hTFS, hDB);
}
}
return (int) rc;
}