Souleiman
Souleiman

Reputation: 3438

When to close SQLite database (using FMDB)

When should you close the connection to an SQLite database (using [db close] in FMDB)?

Right now I am closing it after running every batch of related queries, but should I rather close when my app closes? What are the pros/cons of doing either way?

Thanks

Upvotes: 6

Views: 2648

Answers (1)

ccgus
ccgus

Reputation: 2916

I'm the guy who wrote FMDB.

Keep it open unless you change your schema. That's the only reason to close it, and constantly re-opening it is a little hit on performance / battery life.

Upvotes: 36

Related Questions