Class SortTable {
bool connect(const char* aUserName, const char* aPassword);
bool disconnect();
bool openTable(const char* aTableName);
void setDistinct();
bool sort();
void* fetch();
bool closeTable();
}
SortTable Guidelines
%%
SortTable Usage
int main() {
bool ret;
SortTable sTable;
ret = sTable.connect("root", "manager");
ret = sTable.openTable("T1");
sTable.setDistinct();
sTable.sort();
void* record;
printf("Sorted Records\n");
while (true) {
record = sTable.fetch();
if (record == NULL) break;
printf("Record Value %d\n", *(int*) record);
}
sTable.closeTable();
sTable.disconnect();
return 0;
}
Assumption: Table T1 with field f1 of type int already exists in database.