Joe Richard Joe Richard - 1 year ago 111
Android Question

Table count in SQLite

I copied existing SQLite database from assets to databases folder. When I tried to retrieve data from one of table(gloss) it is giving an error:

android.database.sqlite.SQLiteException: no such table: gloss: , while
compiling: SELECT DISTINCT id, fk, lang, value FROM gloss WHERE value
like '%a%'

I want to make sure that all tables are copied to new db inside 'data/data/package/databases/'
How to get count of tables in SQLite db?

Answer Source

Why are you moving it from /assets? To count tables you should use this query:

SELECT count(*) FROM sqlite_master 
WHERE type = 'table' AND name != 'android_metadata' AND name != 'sqlite_sequence';


It seems that my implementation was wrong. Use the query with the other answer.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download