Closing the database
Whenever your application is closed or terminated, the database will be closed automatically for you. If your need for the database is fleeting, you might seriously want to consider closing the database manually. You may also want to consider closing databases manually if you find yourself needing to open a lot of databases for short-lived transactions.
You can do so by calling close
. Technically, you could monitor the status of the close
operation by inspecting the returned request object. But usually, there's no need to do so. Do note that the database won't be immediately closed; the operation itself is still asynchronous, so if you need to immediately re-open the database, you'll definitely have to add a success
handler (or a then
handler while using Treo with promises).