how to drop database in sqlite?

前端 未结 8 1115
终归单人心
终归单人心 2020-12-03 17:05

I\'m using SQLite in android. I want to drop the database.

For example: mysql- drop database dbname

How do I implement this code in SQLite?

相关标签:
8条回答
  • 2020-12-03 17:32

    If you want to delete database programatically you can use deleteDatabase from Context class:

    deleteDatabase(String name)
    Delete an existing private SQLiteDatabase associated with this Context's application package.

    0 讨论(0)
  • 2020-12-03 17:34

    The concept of creating or dropping a database is not meaningful for an embedded database engine like SQLite. It only has meaning with a client-sever database system, such as used by MySQL or Postgres.

    To create a new database, just do sqlite_open() or from the command line sqlite3 databasefilename.

    To drop a database, delete the file.

    Reference: sqlite - Unsupported SQL

    0 讨论(0)
提交回复
热议问题