tags:

views:

497

answers:

4

hi everyone ,

need urgent help.

i am trying to insert 1916 records in sqlite database in iphone, but after inserting 246 records i am getting an error "Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error while inserting data. 'unable to open database file'' ".

plz help me.

is there any setting regarding insert cache or something.???

A: 

Could you post your code for the insert?

Also you could try wrapping it all in a transaction statement

James Raybould
A: 

which version of sqlite u using?

sandy
A: 

There could be a memory limit constraint, you might want to run this is a couple of transactions, say insert 245 records at a time then the next 245 until your finished.

Some more details would help out as well, like Query, sqLITE version, how much data is passed in each field, the table structure, constraints, etc...

Phill Pafford
A: 

For that many INSERTs, you'll want to wrap your write operation in a transaction. I've found that doing otherwise can cause your memory usage to shoot up on the device and lead to overall bad performance. I've provided some code in this answer as an example of how to do this.

Brad Larson