sql-js / sql-js/sql.js

Is it possible to use transaction with web worker?

オープン
#490 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
JavaScript
スター
13.7k
フォーク
1.1k
PR マージ指標
30日以内にマージされた PR はありません

説明

I am just curious, will the transaction work as expected if I do this:

    worker.postMessage({
      id: 2,
      action: "exec",
      sql: "BEGIN TRANSACTION"
    });

    worker.postMessage({
      id: 3,
      action: "exec",
      sql: "INSERT ...",
      params: { "$id": 1 }
    });

    worker.postMessage({
      id: 4,
      action: "exec",
      sql: "INSERT ...",
      params: { "$id": 2 }
    });


    worker.postMessage({
      id: 5,
      action: "exec",
      sql: "COMMIT"
    });

How can I be sure, that only id 3, 4 will be committed in the current transaction? I mean, after the transaction started I can't guarantee that other async codes could be executed that could not relate to the current transaction(for example, when setTimeout happens). Is there something like the ID of the transaction, under which other queries should be executed?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

The issue names no files, tests, or entry points. Start by reviewing how web-worker exec messages are handled and how SQLite transactions span asynchronous calls. Done would require a documented answer or a clearly scoped change, but the issue does not define which.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, sqlite
領域
database, web-dev
issue の種類
ドキュメント
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。