Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts
Monday, December 22, 2014
IndexDB... There is potential here.
Originally posted 2014-12-22
I have recently been looking into IndexDB which is available on most newer browsers. IndexDB is the only database that both Firefox and IE support for local/client database storage . Chrome supports both IndexDB and WebSQL. Firefox has sworn never to support WebSQL and WebSQL has been depreciated in standards groups.
At first I can tell you I thought IndexDB sucked. I am from old school and know SQL and relational databases. IndexDB doesn't have any of the relational structures that I am used too and it is missing all types of functions. Personally I thought it was a key/value/value design on steroids but not a database. I could not understand what the big deal was about and was quite upset that both IE and Firefox would choose this crap as their one and only local/client-side database.
IndexDB uses "new" terms for things(sort of)... Tables are Stores, Fields are Properties. However, Properties are Fields on steroids. This is where I saw the huge advantage. You can store arrays in a property. Even better, you can search arrays.
So what?
Look at how current relational databases handle fields that need arrays(multiple entries)... They create "related" tables. Here is a perfect example... Contacts. Often we create separate tables to track multiple occurrences of something(like phone numbers, addresses,etc). We then need the whole relationship deal happening. Not in IndexDB... We can store the phone numbers as a multidimensional array... All in the same store!!!! Who needs relations and their complexity? The very few exceptions are outweighed by the benefits under most situations. The ability to group all the related stuff together as an "object" is huge in my opinion.
Of course you know there had to be a down side... For some reason IE does not support storing arrays at this time? Go figure. It is part of the standard so I expect IE will support it soon. The other issues... very different from SQL design/code requires learning, the lack of built in functions that come with SQL, reports-unless object centric... When IE starts to support the ability to store arrays IndexDB is a clear winner... The speed benefits others talk about could be available if we didn't have to handle relationships. Until then be patient. You can use custom libraries like Dojo to simplify the process and add functionality missing in IndexDB but I try and avoid using these libraries personally. I find I only want to use 2 functions out of the 400 they provide so they create bloatware which hurts us all.
I am sure I will find other advantages/disadvantages in the future(like security) but that is a future update ;)
At this point start getting into it but I think it has a ways to go for most mainstream applications.
Thursday, February 18, 2010
HTML5 - JavaScript LOCAL SQL Databases
I just built a demo at http://wmoore.ca/basic/localdbdemo.htm to show some of the possibilities with the new client side databases(that's right databases on customers device) that are part of HTML5(sort of). It shows you most of the common database functions and the code to do it. You can easily learn to utilize databases in offline mode so you can allow customers to work while they are offline and update the online systems later. Or you might want to create a 100% offline tool. If your solution requires a local database you can now use this database structure natively in JavaScript. I am already working on ideas.
Subscribe to:
Posts (Atom)
