SQLite in QT: Should I close database after running each query or not? What is the implication -


i want understand if should close database after running each query or not? implication.

here metacode:

{ if (m_databaseprovider.opendatabase()) {     qsqlquery query(m_databaseprovider.database());     query.prepare(sql_select_locations);     query.exec();      // iterate result , return list     while (query.next()) {            .....     }   m_databaseprovider.closedatabase(); } else {....} 

}

is there drawbacks approach?

what recmended best practive qt application on android example?

thank you

closing database throws away page cache, , requires database structure re-read when reopen next query.

in practice, unlikely notice difference unless many small queries, or on small device weak cpu or small memory.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -