views:

4595

answers:

4

I understand that HTML5 "localStorage" is a key:value store but I am wondering if there is a Javascript library available that offers a more SQL-ish API?

+1  A: 

HTML5 local database storage comes with a SQL interface by default, if I'm not mistaken

Here is a Webkit post with some examples: http://webkit.org/blog/126/webkit-does-html5-client-side-database-storage/

Currently, Chrome forces you to use Gears, which is slightly different, but still SQL-based. Future versions of Chrome will follow the HTML5 spec, however.

Matt
See 4.11. Client-side database storage - http://www.whatwg.org/specs/web-apps/2007-10-26/#sql
Kevin Hakanson
seems rather "experimental"...
jldupont
+3  A: 

Check out Will HTML5 be SQL-free? and DOM Storage: a Cure for the Common Cookie for some links and opinions.

Kevin Hakanson
Good reading in those links, thanks! I am also just going to add an article linked to in one of those that gave a good perspective on the usage of SQL for the browser storage > http://blog.vlad1.com/2009/04/06/html5-web-storage-and-sql
WmasterJ
+2  A: 

W3C Database specification says:

User agents must implement the SQL dialect supported by Sqlite 3.6.19.

As of now, at least Google Chrome supports SQL dialect. I have checked myself.

N 1.1
I am using 5.0.342.1 dev version of Chrome.
N 1.1
+1  A: 

You should use HTML5 database storage (it supports SQL through transactions). a tutorial here: http://www.html5rocks.com/tutorials/webdatabase/todo/

Ionut Popa