Badass JavaScript

A showcase of awesome JavaScript that pushes the boundaries of what's possible on the web, by @devongovett.

SQL.js: SQLite Compiled to JavaScript via Emscripten

March 6th 2012

Alon Zakai, the creator of Emscripten is back at it again, this time releasing SQL.js, which is a compilation of SQLite to JavaScript using his own tool.  The demo page shows it in use, and if you view source, just how easy he’s made it to use after it has been compiled.  

var db = SQL.open();
var data = db.exec(command);

You can run any SQL queries you can think of and it will work just like it does natively.  Pretty cool!  Perhaps he can even get it to work such that data is stored in IndexedDB, giving us a WebSQL polyfill at some point?  Anyway, I thought this was worth a quick mention!  Nice work.