Tracking SQLite3 errors

Hi, I have an application that downloads a DB onto my iPad. Everything works fine when the download is not interrupted but when I loose wifi connectivity, the db that is being downloaded gets corrupted and is not usable. I get an error but am unable to use pcall or to test for a nil value. How do I track the error so that I can actually correct the situation. This is the error message I get when trying to sqlite3.open( path )

Runtime error
file is encrypted or is not a database"

Please help. [import]uid: 97768 topic_id: 35440 reply_id: 335440[/import]

Are you trying to download a binary SQL database?

I would use a web service to output JSON data and then inject the records into my local database.

[import]uid: 199310 topic_id: 35440 reply_id: 140829[/import]

I tried that but it was taking way too much time to process. My way takes seconds when the other way we were looking at 1.5 minute. I would have to pass thousands of transactions. I therefore build the new db on the server, and when I transfer data, I keep track of the transaction I need to re-insert in my new DB. This works like a charm but I need to be able to track errors. [import]uid: 97768 topic_id: 35440 reply_id: 140889[/import]

Found it!!! when doing a db = sqlite3.open(path), no errors are returned so you can simply send a bogus query db:exec(“select * from sometable where 1 = 0”) this will return 0 if the OK and an error number if not. Corrupted DB will return a value of 11. [import]uid: 97768 topic_id: 35440 reply_id: 140928[/import]

Are you trying to download a binary SQL database?

I would use a web service to output JSON data and then inject the records into my local database.

[import]uid: 199310 topic_id: 35440 reply_id: 140829[/import]

I tried that but it was taking way too much time to process. My way takes seconds when the other way we were looking at 1.5 minute. I would have to pass thousands of transactions. I therefore build the new db on the server, and when I transfer data, I keep track of the transaction I need to re-insert in my new DB. This works like a charm but I need to be able to track errors. [import]uid: 97768 topic_id: 35440 reply_id: 140889[/import]

Found it!!! when doing a db = sqlite3.open(path), no errors are returned so you can simply send a bogus query db:exec(“select * from sometable where 1 = 0”) this will return 0 if the OK and an error number if not. Corrupted DB will return a value of 11. [import]uid: 97768 topic_id: 35440 reply_id: 140928[/import]