Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about close DataBase #53

Open
Elyft opened this issue Dec 2, 2019 · 4 comments
Open

Question about close DataBase #53

Elyft opened this issue Dec 2, 2019 · 4 comments

Comments

@Elyft
Copy link

Elyft commented Dec 2, 2019

Hello how can i check if a transaction is in progress before to close the database,because on my code i can have multiple insertion at the same moment

@brodycj
Copy link
Contributor

brodycj commented Dec 3, 2019

The plugin JavaScript should wait for all transactions to finish before actually closing a database.

@Elyft
Copy link
Author

Elyft commented Dec 5, 2019

ok so if i don't use the closeDb function explicitly when the transactions will be over the plugin will close the Database...am i right?

@brodycj
Copy link
Contributor

brodycj commented Dec 5, 2019

If you open a database, the plugin and underlying SQLite implementation keeps the resources open so that you can read and write to the database until you actually close it.

Can you give me an idea why you wanted to close the database in the first place?

It should be safe to just leave the database open. According to https://www.sqlite.org/lockingv3.html, SQLite should be ACID Wikipedia: ACID which means that it should never lose any data from changes that have been committed. I have also made some updates with extra durable build settings (see storesafe/cordova-sqlite-storage#736) to be extra safe.

@Elyft
Copy link
Author

Elyft commented Dec 7, 2019

I closed the database after each request because I thought that was the right thing to do.
Thank you for opening my eyes to this. I won't shut up anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants