Problem :
I have to create a number of tables for caching some amount of textual data, obtained by reading XMLs. These tables need to be created only once - on the initial run of the application. The data in the tables should be cleared after fixed time period. There should be a class exposed to other classes that would allow CRUD operations on this database.
Googling found me some links to tutorials for creating databases and Data Access logic.
I have some questions, please help:
- How many DataBaseHelper(DBAdapter) classes should I have, I am guessing only one? Is it okay to have all the SQL DDL and DML statements, DB name, Table Names as static strings of this class?
- How do I ensure that the tables are created only once?
- Is it possible to clear the DataBase after a fixed time interval?
- Are there any best practices to be followed when designing the database?
- The data in the database is to be displayed in Lists. I have data in ArrayLists(created when parsing XML) as well as Database(after these lists are persisted). What adapter should I use to back the list up? Should I use ListAdapter or CursorAdapter?
Thanks.