[android-developers] Re: DataBaseHelpers and multiple tables?
On Dec 9, 4:43 pm, Chris crehb...@gmail.com wrote: On Thursday, December 8, 2011 3:38:51 PM UTC-5, petter wrote: No guidelines or code samples for using databases with multiple tables? Simple. Eg:, from the link you gave: For example to run a query() you can do the following: return database.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_CATEGORY, KEY_SUMMARY, KEY_DESCRIPTION }, null, null, null, null, null); Replace DATABASE_TABLE with DATABASE_TABLE1 or DATABASE_TABLE2 and you're good to go. Cheers, - C Thanks. I was thinking if it's more common to do like this, e.g. one Adapter/OpenHelper file for all the tables, or a separate Adapter/ OpenHelper for each table? In the former you have to create all the tables from the single interface, in the latter one have to ensure the different Adapter/OpenHelper's implements consistency between the different tables. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: DataBaseHelpers and multiple tables?
On Saturday, December 10, 2011 4:06:03 AM UTC-5, petter wrote: in the latter one have to ensure the different Adapter/OpenHelper's implements consistency between the different tables. A single helper for multiple tables seems like a bad idea due to poor encapsulation. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: DataBaseHelpers and multiple tables?
On Sun, Dec 11, 2011 at 2:11 AM, Chris crehb...@gmail.com wrote: On Saturday, December 10, 2011 4:06:03 AM UTC-5, petter wrote: in the latter one have to ensure the different Adapter/OpenHelper's implements consistency between the different tables. A single helper for multiple tables seems like a bad idea due to poor encapsulation. Except that SQLiteOpenHelper is designed to manage a *database*, not a *table*. A helper class to manage database creation and version management. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: DataBaseHelpers and multiple tables?
On Thursday, December 8, 2011 3:38:51 PM UTC-5, petter wrote: No guidelines or code samples for using databases with multiple tables? Simple. Eg:, from the link you gave: For example to run a query() you can do the following: return database.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_CATEGORY, KEY_SUMMARY, KEY_DESCRIPTION }, null, null, null, null, null); Replace DATABASE_TABLE with DATABASE_TABLE1 or DATABASE_TABLE2 and you're good to go. Cheers, - C -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: DataBaseHelpers and multiple tables?
On Nov 2, 3:06 pm, petter petter.gus...@gmail.com wrote: Most of the DataBaseHelper examples I've seen only have a single table (e.g.http://www.vogella.de/articles/AndroidSQLite/article.html). Are there any guidelines for making DataBaseHelpers where the database have multiple tables? The number of tables in your database is not directly related to the DatabaseHelper. If you want additional tables, you simply repeat the same steps for your first table to create additional data objects and tables. The OrmLite documentation also includes details for using foreign object relationships if you choose to do so. Is there some specific question or issue that you are having that you need more documentation or samples? If so, it might help to describe those details of your situation here. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: DataBaseHelpers and multiple tables?
No guidelines or code samples for using databases with multiple tables? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en