开发者

android multi table adapters queries

开发者 https://www.devze.com 2023-04-09 07:50 出处:网络
I\'ve been 开发者_Go百科reading about having multiples tables in a SQLite database in Android. One approach is to have 1 adapter class for each table, and each adapter will implement CRUDs methods fo

I've been 开发者_Go百科reading about having multiples tables in a SQLite database in Android. One approach is to have 1 adapter class for each table, and each adapter will implement CRUDs methods for each table.

My questions are:

  1. Is this the best aproach to handling differents tables in one SQLite database?.
  2. In this case, how can I execute sql queries between tables?.


Make various instances of SQLiteHelper sqLiteHelper1, sqLiteHelper2;

sqLiteHelper1 =  SQLiteHelper(context, MYDATABASE_NAME1, null,MYDATABASE_VERSION);
sqLiteHelper2 =  SQLiteHelper(context, MYDATABASE_NAME2, null,MYDATABASE_VERSION);
sqLiteDatabase1 = sqLiteHelper1.getWritableDatabase();
sqLiteDatabase2 = sqLiteHelper2.getWritableDatabase();

using sqLiteDatabase1, sqLiteDatabase2, access the data of different tables..

I hope this works :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号