Skip to content

TomasHubelbauer/sqlite-javascript

Repository files navigation

SQLite JavaScript

DEMO

A JavaScript SQLite database file reader

Running

Windows:

"C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:%cd% /port:8000

I am using DB browser for SQLite to compare databases as read by this library and by the program.

To-Do

Convert boolean serial type values to numbers in case of numeric column type

For some numeric columns, the cell values 1 (and presumably 0 as well) are stored as booleans in the rows. These cell values should be converted to numbers for display.

Link to the GitHub repository from the demo site

Allow table names with uppercase characters such as the ones generated by EF Core

Fix the PlaylistTrack table not opening due to an invalid data view range

Fix varint where I had to cap it to 8 bytes to not spill over to other values

According to the docs it should take 9 bytes - there must be some gotcha because those 8 bytes were all 0xff so maybe if there is 8 0xff then we're done after the eight bytes? This is in Prague DB on page #5

Parse varint negative values correctly - right now hardcoded -1

Load full payload items when they overflow (allow the page to fetch the overflow page chain)

Handle overflow pages in page view - check constructGraph to see if is one

Extend constructGraph to include links for overflow pages

Finalize SQL parser to support the missing features of Chinook and the Prague database

Corce a sole integer primary key column with no value to the value of row ID

Debug this with the Prague mbtiles database:

  • Page 5 last entry Undefined Cartesian goes completely awry in page view?
  • metadata needs support for loading overflown payload portions

Add getIndices (5 master page columns) and getViews (4 master page columns) and getTriggers

Fix the case when the record misses some cells

(alter table?) and so has less cells than the table has columns - they should get default values but what if one is missing in the middle?

Load information about a column being a key to a different table

Make the value a link based on that instead of the current heuristic

Coerce the ID column (identifier by a constraint) into the row ID fallback value

Finalize constructGraph for all page types (overflow page indices, 0x5 & 0x2 child pointers)

Make clicking on page in database view or node in graph view navigate to it in page view

Figure out the problem on pages 37, 43, 948 with cell pointer being zero - overflow?

Figure out the problem on pages 39, 42, 948 with cell pointer being > page count - overflow?

Finalize page types 2 and 10 and run all pages through parsePage for errors

Finalize the TODOs in parsePage in the serial type prints

Consider returning the flow of requesting pages using an EventTarget event

If the DataView doesn't contain the page range so that when opening by a URL we could read just the first (few) page(s) (depending on how big the file is as per the Content-Length header) and range-request the rest if range supported

Introduce a new class Record which is fed a DataView and reads the serial types and the payload into an API

Replace FileReader.readAsArrayBuffer with Blob.arrayBuffer when supported

Load overflow page indices from the overflowing cells in 0xd, 0xa, 0x2 in constructGraph

Load left child pointers in cells in 0x5, 0x2

Use getVarint from my ESM Varint library

https://github.com/TomasHubelbauer/esm-dataview-getvarint