android - Additional table not created -


i'm trying add second table application i'm not having luck. 2 tables own classes , singletons. pass in reference of database in onupgrade method , again instance variable.

@override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) {     transtable = transactiontable.getinstance(db);     systable = systemtable.getinstance(db);      oncreate( db );      transtable.updatetable();     systable.updatetable(); } 

the oncreate method calls create methods in tables.

@override public void oncreate(sqlitedatabase db) {     transtable.createtable();     systable.createtable(); } 

the second table, systable, doesn't throw , exception while executing following create statement.

public void createtable() {     db.rawquery("create table if not exists " + tablename + " ("             + "_id integer primary key autoincrement, " + lastused             + " integer, " + balance + " integer, " + accountname             + " text, unique ( " + accountname + " ) )", null); } 

but, when run simple query such following:

 db.rawquery("select * " + tablename, null); 

i error stating

 android.database.sqlite.sqliteexception: no such table: system_t: ,   while compiling: select * system_t 

there no issue first table being dropped or created. ideas?

change createtable method code:

 db.rawquery 

to

db.execsql() 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -