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

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -