List all tables of ormlite db android -
i want list table names of ormlite db in android
the code create table:
public void oncreate(sqlitedatabase db, connectionsource connectionsource) { try { log.i(databasehelper.class.getname(), "oncreate"); tableutils.createtable(connectionsource, dummy.class); } catch (sqlexception e) { log.e(databasehelper.class.getname(), "can't create database", e); throw new runtimeexception(e); } }
list tables of ormlite db android
there not method in ormlite lists existing tables can use dao.queryraw(...)
methods this. here docs on raw-queries.
something following should work:
genericrawresults<string[]> results = dao.queryraw("select name sqlite_master type = 'table'"); (string[] result : results) { system.out.println("one table is: " + result[0]); }
this work on of dao objects since should connect same database.
Comments
Post a Comment