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

implement a pkg:realm:Transaction like class, simplifying commit and rollback #198

Closed
gintominto5329 opened this issue Nov 27, 2023 · 3 comments

Comments

@gintominto5329
Copy link

Hi,

MongoDB's Realm package, has a Transaction class, returned by its Database-equivalent's beginWrite method.

But, we should name it beginWriteTransaction, instead of beginWrite.

thanks

@simolus3
Copy link
Owner

This is a fairly low level library around sqlite3, so I think users should manage transactions themselves by calling BEGIN and COMMIT as necessary.

If we support transactions, every call on the database would have to wait for a transaction to be complete because transactions aren't separate connections (and so the call outside of the transaction would read data written in the transaction). With a synchronous API, this isn't possible.

@gintominto5329
Copy link
Author

gintominto5329 commented Nov 28, 2023

hi,

your are so quick, i must say.

This is a fairly low level library around sqlite3.

How may I access the actual ffi bind-ed functions, if possible? if not, can those be exposed publically.

users should manage transactions themselves by calling BEGIN and COMMIT as necessary.

Using db.execute right?

You may think otherwise, but I tell you, that Im a beginner to both SQL and SQLite; Hope you understand.

thanks

@simolus3
Copy link
Owner

How may I access the actual ffi bind-ed functions, if possible

Why would you want to do that? It requires allocating and freeing memory yourself, which this library takes care of. You can call methods from this package which directly correspond to sqlite3 calls except that they wrap them in Dart types.

Using db.execute right?

Exactly.

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

No branches or pull requests

2 participants