I'm writing a calorie tracking app. Users will be able to create their own 'meals' using foods from the food database. e.g. hamburger = beef+cheese+bun. I'm a little undecided as to the best way of storing the recipes.
a) I can have a DB called Meals which stores the name of each meal in it's own record. I have another DB called MealIngredients which stores the uniqueID of the food record for that ingredient and also the unique ID of the meal record in MealsDB. To get all the ingredients for a given meal, I simply search for all records in the MealIngredients DB which contain the meals uniqueID b) I can have one database called meals, which stores a UInt16 holding the number of ingredients, followed by the uniqueID's (from the foodsDB) of all the ingredients, followed by the name. I'm more inclined to go with B) because presumably there's less overhead but what happens when a user deletes a food from the foods database? I'd have to iterate through every Meal record, unpacking and searching each one for the foods uniqueID. In the same scenario with option A, i can just run a DmComparF function to see if the food is in use. is either of these approaches more suited than the other to this particular app. Is there another way of doing it that I've missed? any input appreciated -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
