I am using FMDB lib to store messages (chat application). It's a objective-c wrapper for sqlite3. I have singleton where all queries implemented.
Just example:
NSString *query = [NSString stringWithFormat:@"UPDATE table_name SET some_col = some_value;"];
[database open];
[database executeUpdate:query];
[database close];
So, should I open database and close for every query, or open only once when my singleton initialized and close when application terminated?
Also, What's the best way to store data (messages)?