java - One or multiple databases SQLite in Android? -
i'm coding app in android use lot of databases in sqlite next schema:
public class dbuser extends sqliteopenhelper { private static final int version_database = 1; //name of database. private static final string name_database = "nameofdb.db"; //the creation of table in sql. private static final string table_database = "create table example " + "(id int)"; private static final string table_database2 = "create table example2 " + "(id int)"; // more tables... //constructor. public dbuser(context context) { super(context, name_database, null, version_database); } @override public void oncreate(sqlitedatabase db) { db.execsql(table_database); db.execsql(table_database2); //... } @override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) { db.execsql("drop table if exists " + table_database); oncreate(db); } /****now methods****/ }
i've, more or less, 5 or 6 java files write differents methods each database create.
i want know if right way or if must put tables in 1 database , write methods in 1 java file.
thanks!
Comments
Post a Comment