On 2014/06/05 13:21, Lasse Jansen wrote:
Hi,

we have a Mac app that uses CoreData which internally uses SQLite. Some of
the queries are not expressible within CoreData, so we send them manually
using the sqlite library that comes with Mac OS X. Now some of our users
have reported that their database file got corrupted and after some
researching I think it's because of multiple copies of SQLite being linked
into the same application as described here:

http://www.sqlite.org/howtocorrupt.html

Even though we link CoreData to our application and CoreData uses sqlite
internally we still have to explicitly link libsqlite as the CoreData
version of sqlite is inaccessible due to the usage of two-level-namespacing.

So I have two questions:
1. Can this be solved without dropping CoreData?
2. If not, is there a workaround that we could use until we replaced
CoreData with something of our own?

I'm thinking of this:
As the problem seems to occur due to calling close() and we only use
libsqlite for read-only access, would just not closing the read-only
database connection prevent the corruption?

Closing the DB is not optional, it is implicit. Calling "Close()" simply closes it prematurely, but if you do not call close, it will close anyway when the program/thread terminates.

If I may suggest, in stead of trying trickery or dropping some part of the system, is it not possible to rather update both to the latest release? That way you get to keep everything with all the functionality and all the goodness and without any corruption.

Not sure if you are linking Coredata statically or compiling it as linked code into your app, also I am not that familiar with Coredata, but either way I am sure you can get the latest coredata or if you compile it, link in the latest SQLite.

Trying to dance around the old version is never a good idea but sometimes needed where you cannot control the code that access it... but you seem to not have that problem.

Maybe someone else here already did this with Coredata. Anyone?

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to