문제

I've been 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 :)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top