My application allows users to save data to a sqlite file. To ensure a unique table name, I want to just create a table with the name of the (date/time) kind of format when the user presses “Save”. Is there a way to load all of the tables in my sqlite file without explicitly stating the names of all the tables?
I have a list of foods in a sqlite file. The sqlite file contains a bunch of information about each of the food items in it. The user can create their own recipe by going through the sqlite file and adding items to their list. Each item in the list is represented by a cell in a tableview. When the recipe is done, I want the user to be able to save it, and have the system automatically add this recipe as a cell in a different table view. That way, when somebody selects the cell, the entire recipe is displayed (not just the name of the recipe as a cell title) in the next tableview
I don’t think you’re using the SQLite database correctly.
It sounds like you’re using a table per user data item.
The strength of a database is to store the data for multiple users, multiple items or multiple whatever into a few tables and then retrieve the data for just specific users or items later. Tables should have rows added, updated or deleted, but in general, tables should not be created and destroyed as individual data elements.
I suspect what you’re not understanding is the concept of joins.
A design for what you describe might look something like this:
or to get a list of recipes with ingredients:
Using a design like this, whenever a user adds a new recipe, you simply add row(s) to the recipe and recipe_ingredients table. Or, when they add a new ingredient, you add a row to the ingredients table.
Here’s a link to a SQL joins tutorial.