Khan Khan - 2 months ago 7
Android Question

Create database after deleting by syntax this.deletedatabase("database_name") where database_name is my database name

I have deleted my database with:

this.deletedatabase("database_name");


in Android example and now I want to create database of same name or any other name with adding more column or table should it possible and how and it is possible to add another table in database without upgrading database version how? And how to set limit to number of rows in database?

Answer

In regard to your last part of the question, this is not as simple as you want it to be. You have to programmatically limit the amount of rows. Like something with the following pseudocode

if number_of_rows in <table> > limit
    do not insert
    OR
    remove oldest row and insert new
else
    insert row

But why would you ever want to limit the amount of rows in a table?

EDIT:

You can infact remove your database programmatically. You have to use a reference to the context to remove it with deleteDatabase

Comments