sql-js / sql-js/sql.js

persistent file storage with NODEFS

Aperta
#92 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
JavaScript
Stelle
13.7k
Fork
1.1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, sqlite, wasm
Ambito
databases, web-dev
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.