dimanche 29 novembre 2015

How to execute a simple SQL script line in Android

I have the following command to drop all tables, to be performed in onUpgrade:

String query = "select 'drop table ' || name || ';' from sqlite_master " +
            "where type = 'table';";
db.rawQuery(query, null);

However it doesn't seem to do anything. All my old tables are still there. How do I execute this query properly?

Aucun commentaire:

Enregistrer un commentaire