kripken/sql.js — pull request #11 by gurjeet (2012-10-25 06:57:13+00:00)
Title: Results in an HTML table

Hi Alon,

The results of my changes can be seen here: http://gurjeet.singh.im/sqljsdemo.html

I have modified and added some stuff to make the results show up as HTML table.

Primary modification is that the exec() function's result is now a 2-dimensional array. First row of this array contains the column-headers, and the rest of the rows contain the respective data.

I have then modified the demo.html to use d3js library and generate a clean-looking HTML table for the result-set emitted by exec().

Please note that the sql.js that I compiled always threw I/O error, and because I don't know enough of Emscripten/LLVM internals to fix it, I mirrored the changes I made in post.js in to the pre-generated file sql.js (git version of it). Look for the variable named columns_header in sql.js.

It'd be great if you could help me understand what I did wrong, so I can get a locally generated sql.js and play around with my custom modifications. Another goal of mine is to compile Postgres database (single-user mode ) to JS, so that Postgres' advanced SQL features can be easily taught on the web.

PS: Thanks for the innovative approach to bring native apps to JS world.

Best regards,