sql-js / sql-js/sql.js

persistent file storage with NODEFS

Đang mở
#92 6 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ả

To allow persistent file storage with NODEFS, and real time update of a SQLITE file instead of loading the whole thing at startup and writing it down using export, I had to changed the class constructor, the close function and debug an issue related to emscriten :

api.coffee : temporary random filename replaced by NODEFS mount relative filename

    constructor: (data) ->
        @filename = '/extfs/'+data
        FS.mkdir '/extfs'
        FS.mount NODEFS, {root:'.'}, '/extfs'
        @handleError sqlite3_open @filename, apiTemp
        @db = getValue(apiTemp, 'i32')
        @statements = {} # A list of all prepared statements of the database

    'close': ->
        stmt['free']() for _,stmt of @statements
        @handleError sqlite3_close_v2 @db
        @db = null

Makefile: modified to ensure closure don't break NODEFS

    optimized: EMFLAGS= --memory-init-file 0 --closure 0 -O3 -s INLINING_LIMIT=50

emscripten / src / library_nodefs.js : modified to avoid file "DeleteOnClose" bug under windows

    stream.nfd = fs.openSync(path, NODEFS.flagsToPermissionString(stream.flags & 0xFFFF));
    // instead of :
    // stream.nfd = fs.openSync(path, NODEFS.flagsToPermissionString(stream.flags));

Perhaps the constructor could take an optional argument to specify witch file system to use (MEMFS / NODEFS / IDBFS / ...

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

Review api.coffee for the constructor and close changes, Makefile for the optimized flags, and emscripten/src/library_nodefs.js for the Windows DeleteOnClose workaround. Confirm how NODEFS should persist and update a SQLite file in real time, and define whether the constructor should support other filesystems such as MEMFS or IDBFS.

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, wasm
Lĩnh vực
databases, web-dev
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
30/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.