kripken/sql.js — pull request #12 by gurjeet (2012-10-26 14:23:16+00:00)
Title: Results in an HTML table

Hi Alon,

I had deleted the branch and recreated it, which caused the previous pull request (https://github.com/kripken/sql.js/pull/11) to be closed automatically.

I have made some more changes since the last pull request, like integrating the ACE Editor to replace the textarea, displaying nicely formatted result set, etc.

Please visit my version of demo here http://gurjeet.singh.im/sqljsdemo.html

Best regards.

--- previous pull request message ---
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,