The browser based WebSQL specification was an in browser database and has been supported by Chrome and a number of other browsers for some time. However, the specification has been dropped in favour of IndexedDB and chrome will be dropping support for it in a future version. As you have invested some time into developing a WebSQL system this isn’t great news as it is unlikely that IE will implement it in the future.
Ido Green a developer Advocate at Google Chrome has written a nice post this week showing you how to convert a WebSQL database into an IndexedDB one which you can find here.
IndexedDb and WebSQL are fundamentally different types of database below is a table that tries to explain some of the differences in the concepts between the two approaches:
|
Concept
|
Relational DB
|
IndexedDB
|
|
Database
|
Database
|
Database
|
|
Tables
|
Tables contain columns and rows
|
objectStore contains Javascript objects and keys
|
|
Query Mechanism, Join, and Filters
|
SQL
|
Cursor APIs, Key Range APIs, and Application Code
|
|
Transaction Types and Locks
|
Lock can happen on databases, tables, or rows on READ_WRITE Transactions
|
Lock can happen on database on VERSION_CHANGE transaction, on an objectStores on READ_ONLY and READ_WRITE transactions. There is no object level locking.
|
|
Transaction Commits
|
Transaction creation is explicit. Default is to rollback unless I call commit.
|
Transaction creation is explicit. Default is to commit unless I call abort or there is an exception that is not caught.
|
|
Property Lookups
|
SQL
|
Indexes are required to query object properties directly
|
|
Records/Data
|
Normal form and single valued properties
|
De-normal form and can have multi-valued properties
|