WebDAV Database

Published by Matthew Turner on

Replicating a subset of behaviour for NoSQL Databases on a WebDAV-enabled (static) website.

Background

For a lot of my personal database usage, I find that I use single tables with no joins. I have been finding it easy and convenient alternative to spreadsheets for structured storage with more powerful search, filtering, and analysis capabilities. However, running MySQL, Postgres, or SQL Server (or, often enough for me, SQLite) is a lot of overhead and not particularly advisable for non-technical users. Except for SQLite within SVN, these solutions do not lend themselves well for history without additional historization logic--often having to be tailored to the data--a feature that gives me the cozy feeling of asking “what did my life look like at such-and-such time?” Of course, SQLite does not lend itself to network access and trying to merge databases through SVN (so far avoided) is a headache waiting to happen.

Wait, HTML?

HTML, the front-end of the internet, already has a database-like structure built-in: tables. This conveniently corresponds very similarly to the output of relational databases on the command-line, but can be configured with a much more digestible presentation.

What is also very convenient is that with anchors, the concept of joins does not have to be lost! (Though it requires more manual effort.)

Implementing

See the example to interact with an oversimplified table (submissions will be Forbidden). You can copy and modify the HTML source to create your own tables, paying attention to two key areas: defining your columns and giving default values. Make sure you include the updateHTML call so that changes will be included in the submission!

			<tr>
				<th></th>
				<th>Name</th>
				<th>Value</th>
			</tr>
			<tr id="blank" hidden="">
				<td class="e-content"><button class="delete" onclick="deleteItem(this)">Delete</button></td>
				<td class="e-content"><input class="p-name" type="text" value="" onblur="updateHTML(this)"></td>
				<td class="e-content"><input class="p-value" type="number" value="0" onblur="updateHTML(this)" onmouseup="updateHTML(this)"></td>
			</tr>

 

Webmentions Received

Comments