I need to recreate a SQLite database programmatically under iOS from a malformed database using this command. Which is original from: How to recover a corrupt SQLite3 database?
$ sqlite3 mydata.db ".dump" | sqlite3 new.db
or a equivalent command like this.
$ sqlite3 test.db '.dump' > dbbackup
Scenario: I need a function in my App which could detect the malformed Sqlite database and repair it self.
I used the sqlite3_backup-
functions to recreate it, but the recreated database also malformed. But the database which was created with the help of the first command seems to be ok.
But the command is only for terminal and how can I trigger using iOS programmatically?
NB: Any other way to solve the problem also welcomed.