On 23.09.2012 23:59, Simon Slavin wrote:
On 23 Sep 2012, at 9:55pm, Alek Paunov <a...@declera.com> wrote:
This feature is very useful for storing hierarchical data - XML, JSON, ASTs,
objects in the script engines (e.g. Lua, Python, ...), etc.
Really ? I don't know about ASTs, but aren't XML and JSON encodings just
strings ? You could encode anything in JSON and keep it in a TEXT column.
In some cases they arrive as strings, in other not - i.e. when they are
generated or parsed as object structures in the host application
already. In both cases you usually want to do something meaningful with
the data afterwards - i.e. need to perform queries (for example to
select just given class of subnodes and attributes) - so it is not
feasible to store them as BLOBs, especially if the volume is significant.
Instead you need to "shred" them as sqlite rows (following your favorite
tree encoding scheme), containing "value" attribute (column) for the
scalars (the leafs of the hierarchy). Here comes the convenience of the
sqlite feature in the question - the "value" attribute can contain
values of any of the basic scalar types in single table.
Contrary, in other (relational) databases you need several tables in the
form fact_int(..., value integer), fact_float(..., value float), etc -
which additionally complicates the query code.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users