Posted by ilumanty 5 days ago
One thing that initially confused me was how exactly the pages worked w.r.t. the first page on disk... I misunderstood the SQLite documentation in different ways, but it's really rather simple: the very first page is just treated as containing the file header in it, and it pushes down the rest of the data, making the page shorter than the other pages. You can see that illustrated clearly if you click into the first page of a database using this tool: the database header comes first, then the page header.
This tool will undoubtedly come in handy for anyone who has a reason to be dealing with SQLite data structures directly for whatever reason, especially since the SQLite documentation is a bit terse at times.
My plan is to create a miniature .wasm module to read .sqlite files that works in the browser. It will be in the tens of kilobytes rather than the 1 megabyte that the official fantastic sqlite.wasm is. The reduced download means even on 3G you ought to be able to load within a few seconds. You can use SQLite files as your network payloads then, and perhaps even as the working mutable state synced between server and clients.
index-CGfYebmt.js:85 Uncaught RangeError: Offset is outside the bounds of the DataView
at DataView.prototype.getUint32 (<anonymous>)
at R0 (index-CGfYebmt.js:85:4683)
at X0 (index-CGfYebmt.js:85:7966)
at index-CGfYebmt.js:85:8157
at Array.map (<anonymous>)
at Q0 (index-CGfYebmt.js:85:8150)
at index-CGfYebmt.js:85:8240
at Object.useMemo (index-CGfYebmt.js:48:46087)
at My.$.useMemo (index-CGfYebmt.js:17:7276)
at V0 (index-CGfYebmt.js:85:8228)
R0 @ index-CGfYebmt.js:85
X0 @ index-CGfYebmt.js:85
(anonymous) @ index-CGfYebmt.js:85
Q0 @ index-CGfYebmt.js:85
(anonymous) @ index-CGfYebmt.js:85
useMemo @ index-CGfYebmt.js:48
My.$.useMemo @ index-CGfYebmt.js:17
V0 @ index-CGfYebmt.js:85
tc @ index-CGfYebmt.js:48
bc @ index-CGfYebmt.js:48
lo @ index-CGfYebmt.js:48
No @ index-CGfYebmt.js:48
wm @ index-CGfYebmt.js:48
Xc @ index-CGfYebmt.js:48
Ao @ index-CGfYebmt.js:48
Qo @ index-CGfYebmt.js:48
me @ index-CGfYebmt.js:25
I will try to fix it
However, I am not a fan of uploading databases to "strange" sites on the internet, so I will probably never use this.
1. Permanently restrict the browser tab from accessing the network.
2. Show an indication of this in the browser UI outside of the content area.
It would be perfect for this kind of app.
But you can get sort of what you want by:
1. Loading a site.
2. Go into the Web Dev Tools.
3. Select the Network tab.
4. Click on the "No Throttling" dropdown and check "Offline".
5. You should now see a yellow warning icon in your Network tab and it should prevent all network access. If you reload the tab you should get the "No Internet Connection" error page.
The pledge would have to be persistent, which would make e.g. service worker updates difficult - ideally the browser should show you that an update is available, and offer to delete all stored information so nothing can be saved to localStorage etc. to be uploaded afterwards.
I loaded up my Star Trek database into the program to toy with: https://chiselapp.com/user/chungy/repository/startrek-db/uvl...
A note: the table that describes the data structures (Field # | Description | Value) should also list the data type (uint8 uint16 int32 text etc.). If it's an enum ("Table Leaf"), reference other possible enum values. If its length depends on another field, reference that field No.
It would be nice if it tied the format in a bit more to the schema and data being shown, but that is a very minor gripe given how nice a tool this is.