In my app, I would like to recognize when the database has been damaged and automatically repair it. Specifically, when the app is first opened I run an ANALYZE command and if it comes back with status 11 (database disk image is malformed), then I would like to have a way of recovering the data.
All the examples I find use the terminal to do a dump and then import of the subsequent SQL command file.
How can I do a dump of the db from within my own code since the command line isn't available on iOS?
Thanks