jeudi 10 mars 2016

Unable to update database in android using SQLiteAssetHelper

I'm using SQLiteAssetHelper. I tried to upgrade the database by adding few insertions into the testdb.db file then according to instructions on http://ift.tt/1dBxfAL I renamed this new file to testdb.db_upgrade_1-2.sql and added to the asset folder in the android app. I changed the database version to 2 in the Databasehandler, but still there is an error as shown in the stacktrace which is as follows

I/SQLiteAssetHelper: successfully opened database testdb.db
W/SQLiteAssetHelper: Upgrading database testdb.db from version 1 to 2...
W/SQLiteAssetHelper: processing upgrade: databases/testdb.db_upgrade_1-2.sql
E/SQLiteLog: (1) near "SQLite": syntax error
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main

After this the app crashes.

My asset folder contains both /databases/testdb.db and /databases/testdb.db_upgrade_1-2.sql

I'm using sqlite3 on my computer to generate the database file

Aucun commentaire:

Enregistrer un commentaire