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

Different API to node-sqlite3 #113

Open
JumpLink opened this issue Nov 23, 2023 · 5 comments
Open

Different API to node-sqlite3 #113

JumpLink opened this issue Nov 23, 2023 · 5 comments

Comments

@JumpLink
Copy link

I tried to use this package under Deno with TypeORM which did not work because they differ in API's to node-sqlite3.

Is it an option for you to make the APIs more compatible and would you accept PRs for this?

I also wrote a simple wrapper that makes the API's more compatible. So far I have only tried this with a very simple TypeORM entry, but at least that worked. Maybe this is also useful for someone else.

@DjDeveloperr
Copy link
Member

DjDeveloperr commented Nov 24, 2023

The current API is inspired from Node.js better-sqlite3 module, as a result of rewrite that took place a while ago: #44

It's a pretty simple and synchronous API that allows making best of sqlite3 performance. I see that node-sqlite3 is callback based & non-blocking/asynchronous, which could be a bottleneck.

So I think a separate wrapper is a preferable option, since the current API seems better in terms of simplicity and performance (see https://www.npmjs.com/package/better-sqlite3 for some performance comparison, and this module performs even better than better-sqlite3). Currently, the high performance sqlite3 bindings in Node.js (better-sqlite3), Deno (sqlite3) and Bun (bun:sqlite) ecosystems all have this similar API.

@JumpLink
Copy link
Author

JumpLink commented Nov 24, 2023

@DjDeveloperr Thanks for the answer, that is very good to know that the API is based on better-sqlite3!

There are also drivers in TypeORM for better-sqlite3, so maybe I should just output this package as better-sqlite3, if that would work I could have saved myself the wrapper 😅. Do you think there are still big differences regarding better-sqlite3?

Edit:
Okay, I tested it once, there seem to be some differences in the return values, so that would also need adjustments, the question is which is more complex...

@DjDeveloperr
Copy link
Member

@JumpLink Using better-sqlite3 driver sounds like a great idea. I can try to help get that to work. There shouldn't be much big differences, which one are you running into here?

@JumpLink
Copy link
Author

@DjDeveloperr I can create a simple example for this issue, than other developers like you can test it by himself

@JumpLink
Copy link
Author

JumpLink commented Nov 28, 2023

@DjDeveloperr Here the example: https://github.com/JumpLink/deno-typeorm-sqlite-example with preconfigured settings for debugging Deno and Node.js in VSCode.

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