3 ms·
In HTML5 we are stuck with NoSQL (IndexedDB), Mozilla refused to implement WebSQL. Safari, Chrome and Opera implement WebSQL using the public domain SQLite lib
by frik 13y ago
In HTML5 we are stuck with NoSQL (IndexedDB), Mozilla refused to implement WebSQL.
Safari, Chrome and Opera implement WebSQL using the public domain SQLite library. This means WebSQL is available on almost all smartphones/tablets and on the majority of PCs.
Btw. Mozilla implemented their "NoSQL" IndexedDB on top of SQLite in the first place. Various features like bookmarks are also stored in a SQLite database. As well as in FirefoxOS.
https://news.ycombinator.com/item?id=7574533 https://news.ycombinator.com/item?id=7574533
- acjohnson55 13y agoSerious question -- why do you need SQL in the web browser? It seems like for the amount of data a person is likely to store locally, it's not worth it. But I'm open to being proven otherwise.
- SchizoDuckie 13y agohttp://schizoduckie.github.io/DuckieTV/ http://schizoduckie.github.io/DuckieTV/ My user's Databases regularly exceed 3 MB. It's relational data : Serie -> Seasons -> Episodes (sometimes hundreds, sometimes thousands) Here's a 5MB example: https://dl.dropboxusercontent.com/u/44645464/DuckieTV.sqlite https://dl.dropboxusercontent.com/u/44645464/DuckieTV.sqlite The project is still in beta, so the database will most likely grow with more tables, easily linking into the existing episodes table with an actors table, for instance.
- frik 13y agoShort: WebSQL enables more powerful web applications. It allows some online features to be used offline. It's not about SQL it's about a proper relational database with tables, indexes, ACID, etc. You may remember Google Gears (http://en.wikipedia.org/wiki/Google_Gears http://en.wikipedia.org/wiki/Google_Gears ), even back in 2007 one could use the Google Mail (GMail) web interface during a flight, train ride, etc. to read mails, write mails, edit drafts, etc. As soon as the connection had reestablished the data synced between client and server. Later Google rewrote it to HTML5. There was a trend to move everything to the "cloud". But with the arise of peer-to-peer web applications (WebRTC, etc) and thanks to the bad NSA news we need good client side cache and data storage APIs. I haven't seen a SQL library as shim on top of IndexedDB. It would be pervert anyway as IndexedDB is implemented on top of SQLite in Firefox. I would like to ask Mozilla to finally implement WebSQL. With a relational database, more powerful web applications with optional offline support would be possible.
- SchizoDuckie 13y agoI would immediately support this. This conversation needs to be started again. I'm gonna ping some people on twitter. I've just searched for a WebSQL on IndexedDB adapter yesterday and it's certainly possible, but it's a nightmare from the perspective of any sane person. This polyfill I found runs SQLite compiled with CLANG to javascript, which means running 2MB of javascript to support something that they already support 'under the hood'. I refuse to work with that. https://github.com/Philzen/WebSQL-Polyfill https://github.com/Philzen/WebSQL-Polyfill
- frik 13y agoGreat. We would need a blog post that lands on the HN front page and some other HN readers that are equal minded. Or a contact to Mozilla devs. There is also a similar one called SQL.js - SQLite compiled to JavaScript through Emscripten (probably a big library too): https://github.com/kripken/sql.js https://github.com/kripken/sql.js