sql-js / sql-js/sql.js

async operations

Đang mở
#525 2 bình luận 1 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 know you can create a sql instance of an uint8array and make operations on that.
but i wonder: is it possible to just load a simple File instead of a Uint8Array?

i would like to load a read-only database and being able to do:

// load file from <input type="file">
const file = input.files[0]

// Create a database from a file without reading everything into memory
const db = new SQL.Database(file)

// Prepare an sql statement
const stmt = db.prepare("SELECT * FROM sqlite_master")

// Bind values to the parameters and fetch the results of the query
const result = await stmt.getAsObject()
// note: using await

The idea would just be for sql.js to slice the part of the file that is needed without loading the hole thing into memory
and kind of doing: await file.slice(start, end).arrayBuffer() operations instead

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

No file or test is named; start at the SQL.Database constructor and the File.slice(start, end).arrayBuffer() flow described in the issue. Determine whether a File can support the requested read-only database and asynchronous stmt.getAsObject() usage without loading the whole file into memory.

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ính năng
Độ 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.