On 29.10.2012 20:44, Rose, John B wrote:
1) We are looking for simple examples, with source code,  of a UI using HTML5 
to query and add data to an SQLite database
2) We are also looking for examples using Javascript to query an existing 
SQLite database. And maybe add data to an existing database. We do not care of 
the database is on a server or local. We just want to put together a simple 
mechanism using javascript as a query interface to an SQLite database.

We have read a bit about WebSQL, Web Storage and IndexedDB. We are a bit 
confused.

Are one of those a requirement to interact with SQLite via Javascript? After a 
reasonable bit of googling we have not found a simple javascript/SQLite example.


I am assuming that you are talking about client side SQLite DBs.

Unfortunately, the sad reality is that Web SQL Database [1] (i.e. SQLite presence in any modern browser) has been abandoned as a standard in favor of IndexedDB.

The main reasons (cited in various official and semi-official sources by the Mozilla guys) are:

 * Internet badly needs browser convergence over HTML5, but Microsoft
   will never include exactly SQLite in IE for Windows, (the proposed
   standard [1] roughly says "WebSQL in terms of query language and
   behavior is ... SQLite 3.6.19")

 * SQL is not the perfect language for the average JS developer.

Mozilla (Firefox) continues to use (quite inefficiently) SQLite as IndexedDB backend, Chrome switched to LevelDB recently.

Meantime, you have the following options:

 * Stick with IndexedDB, which do not support any query language - you
   will need to render your queries to low level API calls manually,
   like in the pre-SQL dark ages :-) (but IndexedDB is already supported
   in all recent versions, natively [2] or by shim [3] on top of
   SQLite/WebSQL [4]).

 * Test for a project (and contribute to - e.g. filling bugs) Emscripten
   SQLite [5] (C SQLite code compiled as JS using the new HTML5 typed
   arrays as memory representation).

Sorry,
Alek

P.S. I am keeping the hope, that it is still possible to bring back SQLite in the standard JS APIs, will be glad to discuss how we could try to achieve the goal if anyone is interested.

[1] http://www.w3.org/TR/webdatabase/
[2] http://caniuse.com/#search=IndexedDB
[3] http://nparashuram.com/IndexedDBShim/
[4] http://caniuse.com/#search=WebSQL
[5] http://syntensity.com/static/sql.html

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to