Database Best Practice
Hi
I am facing crashes on my iphone app and I think it is due to database access.
I knew that if I do not close the row object, it will will crash but I have checked every line to make sure that it was really close.
My question is: What is the best practice?
Open the database and execute the SQL and close rows and database on every occasion.
Open the database once in the app, leave it open, and close rows object in between tab windows.
Others?
3 Answers
-
How to check if a DB or a DB has been closed?
if ( db_rows != null ) { db_rows.close(); }
if ( db != null ) { db.close(); }?
-
Hi there Peter
It might depend on the volume and complexity of data you're working with, but I open the db, execute the SQL, process the resultset, then close the db at the end of the function that called it.
cheers,
Chris. -
ow to check if a DB or a DB has been closed?