Re: [sqlite] How to recover the SQLITE_CORRUPT error in C programming ?
On Mon, Jun 27, 2011 at 16:15:16 +0800, baiydavid wrote: > Thanks for you help. > > when an SQLITE_CORRUPT error is returned, we can use ".dump" command to > exports the data into a sql script, and then exec this sql in a new database, > But how to dump the data into a sql script with C programming Interface? > Is there any other better method to solve this problem? You shouldn't be doing automatically. When you get SQLITE_CORRUPT error, it means something has gone very, very wrong and you should definitely investigate what. Besides since the database is corrupt, you may not be able to recover all data, so you have to carefuly check the dump, so again need manual intervention. -- Jan 'Bulb' Hudec___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to recover the SQLITE_CORRUPT error in C programming ?
Perhaps you could look at the code in shell.c and see how it does the .dump, then copy paste or something similar into your own app. I'm not sure if there might be issues with functions declared SQLITE_API vs SQLITE_INTERNAL, which may require some additional working around, but hopefully not. -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Monday, June 27, 2011 8:06 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] How to recover the SQLITE_CORRUPT error in C programming ? On 27 Jun 2011, at 9:15am, baiydavid wrote: >when an SQLITE_CORRUPT error is returned, we can use ".dump" command to exports the data into a sql script, and then exec this sql in a new database, >But how to dump the data into a sql script with C programming Interface? Is there any other better method to solve this problem? Sorry, David, but there is no built-in way to dump a SQLite database as SQL commands. If you need to worry about this, this suggests you are getting corrupt databases very often. This should not happen: SQLite should not be corrupting its databases. Perhaps you could investigate this problem with your setup. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to recover the SQLITE_CORRUPT error in C programming ?
On 27 Jun 2011, at 9:15am, baiydavid wrote: >when an SQLITE_CORRUPT error is returned, we can use ".dump" command to > exports the data into a sql script, and then exec this sql in a new database, >But how to dump the data into a sql script with C programming Interface? > Is there any other better method to solve this problem? Sorry, David, but there is no built-in way to dump a SQLite database as SQL commands. If you need to worry about this, this suggests you are getting corrupt databases very often. This should not happen: SQLite should not be corrupting its databases. Perhaps you could investigate this problem with your setup. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] How to recover the SQLITE_CORRUPT error in C programming ?
Thanks for you help. when an SQLITE_CORRUPT error is returned, we can use ".dump" command to exports the data into a sql script, and then exec this sql in a new database, But how to dump the data into a sql script with C programming Interface? Is there any other better method to solve this problem? Thanks! David chen 2011-06-27 baiydavid ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users