#include #include #include #include #include #include #include #include #include using namespace std; #include "PackedTable.h" #include "ProductTable.h" #include "AlbumTrackTable.h" #include "AlbumContractTable.h" #include "SaleTable.h" int main(int c, char** argv) { ProductTable theTable; theTable.createAndLoadDataFile("product", "localhost", "root", NULL, "C_RSDEMO"); theTable.resetIDIterator(); tIndex id; while (0 != (id = theTable.nextID())) { struct _product* theProduct = (struct _product*)theTable.getIndexedData(id); printf("product_id %ld product_type_id %d upc: %s\n", theProduct->product_id(),theProduct->product_type_id(), theProduct->upc_ean()); } AlbumTrackTable* atTable; atTable = new AlbumTrackTable; atTable->createAndLoadDataFile("album_track", "localhost", "root", NULL, "C_RSDEMO"); atTable->resetIDIterator(); while (0 != (id = atTable->nextID())) { atTable->setIteratorAtIndex(id); struct _albumTrack* data; while (NULL != (data = atTable->nextItem())) { printf("Got something: album_id %ld track_id %ld\n", data->album_id(), data->track_id()); } } AlbumContractTable acTable; acTable.createAndLoadDataFile("album_contract", "localhost", "root", NULL, "C_RSDEMO"); acTable.resetIDIterator(); while (0 != (id = acTable.nextID())) { struct _albumContract * theAlbumContract= (struct _albumContract*)acTable.getIndexedData(id); printf("album_contract_id %ld album_id %ld artist_contract_id %ld \n", theAlbumContract->album_contract_id(), theAlbumContract->album_id(), theAlbumContract->artist_contract_id()); } SaleTable saleTable; saleTable.createAndLoadDataFile("sale", "localhost", "root", NULL, "C_RSDEMO"); saleTable.resetIDIterator(); while (0 != (id = saleTable.nextID())) { struct _sale* theSale = (struct _sale*)saleTable.getIndexedData(id); printf("sale_id %ld product_id %ld\n", theSale->sale_id(), theSale->product_id()); } }