What's the proper way to use sqlite at xCode?

Posted by Elliot Chen on Stack Overflow See other posts from Stack Overflow or by Elliot Chen
Published on 2010-05-27T09:12:32Z Indexed on 2010/05/27 9:21 UTC
Read the original article Hit count: 208

Filed under:
|
|
|

Hi, Experts:

Can you please give some suggestions on sqlite using at xcode? Within my application, I use a sqlite DB to store all local data. Two methods can be used to retrieve those data during running time.

1, Load all the data into memory at initialization stage. (More memory used, less DB open/close operation needed)

2, Read corresponding records when necessary, free the occupied memory after using. (Good habit for memory using, but much DB open/close operations needs).

I prefer to use method 2, but not sure whether too many DB opening/closing operations could affect app's efficiency. Or do you think I can 'upgrade' method 2 by opening DB when app launches and closing DB when app quits?

Thanks for your suggestions very much!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa