sql-js / sql-js/sql.js

Is it possible to use transaction with web worker?

Đang mở
#490 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
JavaScript
Star
13.7k
Fork
1.1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, sqlite
Lĩnh vực
database, web-dev
Loại issue
Tài liệu
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.