sql-js / sql-js/sql.js

persistent file storage with NODEFS

Offen
#92 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
JavaScript
Sterne
13.7k
Forks
1.1k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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 / ...

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, sqlite, wasm
Bereich
databases, web-dev
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.