On Wed, 15 Jul 2015 17:22:36 +0200
Sergej Jure?ko <sergej.jurecko at gmail.com> wrote:

> An idea I?ve had a while ago was to implement functions for json
> documents (using sqlite3_create_function_v2)
> 
> Json would be stored in a text column. You would need to define 2
> functions:
> - docget(document,key1,subval1,subval2,?)
> - docset(document,key1,subval1,subval2,..,val)
> 
> Last parameter of docset is value you wish to set.
> 
> So for instance one would write
> INSERT INTO mytable VALUES (1,?{key : 10, subdoc : {subkey : ?a"}}?);
> SELECT id,doc FROM mytable WHERE docget(doc,?key") > 10;
> SELECT id,doc FROM mytable WHERE docget(doc,?key?,?subdoc?,?subkey?)
> = ?a?; UPDATE doc FROM mytable WHERE id=1 SET docset(doc,?key?,12);
> 
> One could even implement indexes on keys within documents using
> additional tables.
> 
> What do you guys think? Is it stupid, could it be improved?

Perhaps Dr. Hipps, R. unql implementation should be resurrected or at least, 
used as good/bad example. It has an extension to sql to query unstructured data 
and a layer on top sqlite to store json data. It's abandonware now afaik.

http://unql.sqlite.org/index.html/wiki?name=UnQL
http://www.dataversity.net/unql-a-standardized-query-language-for-nosql-databases/
http://www.couchbase.com/press-releases/unql-query-language


> 
> Sergej


---   ---
Eduardo Morras <emorrasg at yahoo.es>

Reply via email to