I would like to know how to drop a database with ORMLite. Is there already any API call?
Just dropping all the tables does not delete the whole database.
Thanks in advance.
Edit:
Looks like you figured it out. You do something like:
boolean success =
context.deleteDatabase(
"/data/data/source.package.goes.here/databases/database-name.db");
Edit:
Dropping a database is strange with ORMLite but I think it can be done. Really, when you do a dao.executeRaw(...)
method, you have a connection open to the database engine that can perform just about any operation. You should be able to something like:
fooDao.executeRaw("drop database foo;");
That at least works for me under MySQL and it should under Sqlite.
Yes, ORMLite has the TableUtils
class which allows you to create and drop tables. Here are the javadocs for the method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With