jeudi 31 mars 2016

Android sqlite view can be created but not selected

I am facing a strange problem with my sqlite in an Android app.

My sqlite_master table shows these contents:

type    name
---------------------------------------------------
table   android_metadata
table   LOCALLOG_CALLERPATH
index   sqlite_autoindex_LOCALLOG_CALLERPATH_1
table   sqlite_sequence
table   LOCALLOG_EXCEPTIONTYPE
index   sqlite_autoindex_LOCALLOG_EXCEPTIONTYPE_1
table   LOCALLOG
view    V_ALL
view    V_E_F_STACKTRACE

But when I do a

database.rawQuery("SELECT * FROM sqlite_master", null) 

the cursor returned contains 7 rows (not 9, as expected), and the two indices are missing, as well as the two views are reported as "table", not as "view".

I tried then to do a

database.rawQuery("CREATE VIEW TEST AS SELECT * FROM sqlite_master",null);

which succeeded. But a

database.rawQuery("SELECT * FROM TEST", null);

right afterwards reported me an exception "Error compiling SELECT * FROM TEST. No such table".

Any idea what I am doing wrong here? Why can't I access my views in the database?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire