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

[Request]: Bring back sync execute #173

Open
pranshuchittora opened this issue Oct 25, 2024 · 2 comments
Open

[Request]: Bring back sync execute #173

pranshuchittora opened this issue Oct 25, 2024 · 2 comments

Comments

@pranshuchittora
Copy link

pranshuchittora commented Oct 25, 2024

What do you need?

Hey, I am using op-sqlite and in the newest version the execute api was changed from sync to async.
My use-case requires sync query execution in some cases which can't be changed to async.

1dbc828#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80R127

Is there any possibility to bring back the sync execute? or any workaround for the same?

Thanks

@Volland
Copy link
Contributor

Volland commented Oct 29, 2024

we had a similar request some of our api is sync only

@ospfranco
Copy link
Contributor

@rflopezm

Here was the change:

https://github.com/OP-Engineering/op-sqlite/pull/142/files#diff-cd0866c167878907e99d1e94024bc05e6f673d0e5228bf11448932f2aaa4d0c2L320

Now there are a couple of differences, before you go re-implementing this interface:

  • Don't use SmartHostObject or execute_with_host_objects, the abstraction will cost too much on runtime, use the same as current execute but just don't execute it in a thread.
  • Create a test (or maybe some tests cases) on queries.spec.ts. Make sure it returns the correct data
  • Also create the same function for libsql. The tests already run automatically here, so as soon as you have created the test on queries.spec.ts it will let you know if something is missing.
  • No need to modify the transactions for now. It's too much work to keep both interfaces working within the async context and now it might mess up with reactive queries. Bringing a simple .execute should be enough.
  • If you need more info on interacting with the JSI there are guides and tutorials on my website

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

3 participants