Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SQLite Async API#59109

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
geeksilva97 wants to merge2 commits intonodejs:main
base:main
Choose a base branch
Loading
fromgeeksilva97:sqlite-async
Draft

Conversation

geeksilva97
Copy link
Contributor

@geeksilva97geeksilva97 commentedJul 18, 2025
edited
Loading

Closes#54307

This PR implements an async API fornode:sqlite module. So far, it contains a very minimal implementation ofexec method, misses some tests, docs and refactoring but it is good enough to share the whole theory I have for it; with that, anybody can share thoughts about it.


Desing

On C++ land, I plan to have theDatabase class determine whether the operations will be asynchronous.

Public API

For the public API, I plan to have classes such asDatabase,Statement, etc., as counterparts to' DatabaseSync', ' StatementSync', and so on.

himself65 and miguelmarcondesf reacted with thumbs up emojihimself65, SuperchupuDev, and miguelmarcondesf reacted with hooray emojimiguelmarcondesf reacted with heart emojimiguelmarcondesf reacted with rocket emoji
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/sqlite

@nodejs-github-botnodejs-github-bot added c++Issues and PRs that require attention from people who are familiar with C++. needs-ciPRs that need a full CI run. sqliteIssues and PRs related to the SQLite subsystem. labelsJul 18, 2025
@geeksilva97
Copy link
ContributorAuthor

Concurrency Control

For concurrency control, SQLiteprovides a few options. Multi-threaded seems to be a good fit.

Multi-thread. In this mode, SQLite can be safely used by multiple threads provided that no singledatabase connection nor any object derived from database connection, such as aprepared statement, is used in two or more threads at the same time.

We just need a way to guarantee that no two threads will be usingconnection orstatements at the same time. Since we have a threadpool, hence no control over which thread a work will be executed, seems like we need a mutex. Please share your thoughts.

@geeksilva97
Copy link
ContributorAuthor

We just need a way to guarantee that no two threads will be usingconnection orstatements at the same time. Since we have a threadpool, hence no control over which thread a work will be executed, seems like we need a mutex. Please share your thoughts.

I wonder if, for the first version of this API if theserialized mode is good enough

Serialized. In serialized mode, API calls to affect or use any SQLitedatabase connection or any object derived from such a database connection can be made safely from multiple threads. The effect on an individual object is the same as if the API calls had all been made in the same order from a single thread. The name "serialized" arises from the fact that SQLite uses mutexes to serialize access to each object.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
c++Issues and PRs that require attention from people who are familiar with C++.needs-ciPRs that need a full CI run.sqliteIssues and PRs related to the SQLite subsystem.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

sqlite async API
2 participants
@geeksilva97@nodejs-github-bot

[8]ページ先頭

©2009-2025 Movatter.jp