sql-js / sql-js/sql.js

async operations

Offen
#525 2 Kommentare 1 Reaktion 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

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

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

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, sqlite
Bereich
database, web-dev
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

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