On 25 Aug 2011, at 11:00pm, François wrote: > I just have a last question: you are telling that opening connection > at app launch and close it only at app exit (scenario A) may be less > secure than open/close database at each transaction (scenario B), on a > data integrity point of view. But you gave the contrary advice at the > beginning of our exchanges. Why?
I'm not sure what you mean by 'secure'. Opening and closing database connections takes far more time than just doing a transaction. It's just like opening and closing a data file on disk: you don't tend to do it unnecessarily. > Let's consider a simple example of a database used by only one iOS > app, which performs many INSERT or UPDATE during a user session. > Therefore it would be better to minimize data loss risk. Generally, open a connection when you know you're going to need the database, and close it again when you know you're not going to need the database again, just as if you were reading or writing a text file. I think you're doing premature optimization. Don't worry too much about data loss. You have to put some trust into the platform you're using, especially a hugely mass-produced item like an iPhone. If you were writing for a life-critical system used in conditions where electronic devices crash often, things would be different. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users