Web Storage is nothing
more than a danged database. Heck, I’d been working with databases
for over 20 years. Databases aren’t hard. Except, WebStorage threw
me a few curves, and everything I read was wrong! Every article
about WebStorage kept saying, “WebStorage is not a relational
database (with rows and columns), but rather a hierarchical database
with nodes and children.” Wrong!
Web Storage is BOTH
relational and hierarchical at the same time, simultaneously!
Let’s look at a regular
old relational database. Each database has “Tables” and each table has
rows and columns.
Simple to understand. I’ve
used tons of ADO code with connections, recordsets, and fields to get at
Relational data. I knew how ADO worked.
What does a hierarchical
database look like? When I began reading, I got the impression
hierarchical meant an upside-down tree. Which really confused me because
what does a dawg-darn tree have to do with technology?
I finally realized the
upside-down tree was simply a metaphor (metaphor is one of those $10
word!). Which simply means “like.” So like a tree, we need to start with
one trunk. A tree has ONLY one trunk, so our hierarchical database
starts with one (and only one) “thing”,
That one thing can parent
child things …
And so on, until we have a
trunk and branches like an upside-down tree.
Does the above
hierarchical diagram remind you of anything?
How about the File System?
Right, the file system is
a hierarchical structure, too. As you will see later, the similarity
between a hierarchical database and the file system did not escape the
Microsoft designers either.
Relational and Hierarchical Combined!
So now we have two
techniques, Relational and Hierarchical. I said earlier that the
WebStorage is both Relational and Hierarchical, simultaneously.
How? That’s easy, because
each “Thing” in the hierarchical database can be considered one “Table”
from a relational database. So throw away the buzz words and corn husks
Are you starting to get
the picture? But, now you’re asking, how is each table named? How do you
get down the tree and find what you want? Well, let’s use another
buzzword URL (Uniform Resource Locator). I know, another big word, but
keep reading. It ain’t really that hard.
URLs, Hierarchical Nodes and the TLH
Each table (in
hierarchical lingo a “Node”) is assigned two things when it is created.
These two things must be assigned or the table (node) cannot be created.
Can you guess the two things? Right, “Name” is the first thing each node
must have. But what’s the second must-have?
A “Parent”! Each node must
have a parent node! The only node without a parent, is the node at the
very top of the tree. There’s a special name for the top node of the
tree, TLH (Top Level Hierarchy). Buzzwords reduced to idiot-proof
acronyms. Isn’t technology great … groan!
The TLH is the very top of
the hierarchy tree. Creation of a TLH isn’t simple but I’ll try to cover
it in later articles. For now, just remember the TLH is the only node
without a parent. Otherwise, every node has a “name” and a “parent”.