I'm working on an Android app where the database continues to grow.
To assist with my database I have a MySQLIteHelper class that extends SQLiteOpenHelper and contains strings for defining the tables. I have a dbDataSource class that handles the adding, deleting, reading and writing of the database rows. And a class called dbDataRow that acts as a row of data.
When the tables both contained two columns with the same name (ID and Name), these classes worked fine because the methods in dbDataSource would typically require the table name, and the table name was variable in dbDataRow. But now the tables contain a different number of columns with different names, I'm currently trying to make a decision whether I should duplicate the dbDataSource and dbDataRow classes (one for each table) or figure out how to make them work with very different tables
I'm looking for a pattern or example of data access classes for a database multiple tables within an app.
I'm not certain whether the actual code will help with this question, but let me know what you would like me to include, if anything. Thank you for any help!
Aucun commentaire:
Enregistrer un commentaire