Hi,

Adding JSON to SQLite (like in PostgreSQL) ultimately needs a
JavaScript parser - and that seems to be against the goal of SQLite
being slim.

But what about adding a data type "hash table", i.e. set of keyvalue
pairs (also known as hstore, dictionary or associative array)?
Would'nt this still serve your use case?

Hash tables are already used now internally in the SQLite parser (see hash.c).
If not as part of the core it could be first implemented as an extension.
Here's the syntax of hstore in PostgreSQL [1].

Yours, S.

[1] http://www.postgresql.org/docs/current/static/hstore.html


2015-01-18 22:16 GMT+01:00 Simon Slavin <slav...@bigfraud.org>:
>
> On 18 Jan 2015, at 8:29pm, David Barrett <dbarr...@expensify.com> wrote:
>
>>    SELECT createNewJSONCollationFunction( "FooCollationSequence", "foo" );
>>    SELECT createNewJSONCollationFunction( "BarCollationSequence", "bar" );
>
> Those two might be okay depending on what the quoted values are meant to be.
>
>>    CREATE INDEX ON testDataFoo ( "json" FooCollationSequence );
>>    CREATE INDEX ON testDataBar ( "json" BarCollationSequence );
>
> Syntax wrong.
>
> CREATE INDEX indexname ON tablename (columnname COLLATE collatefunction)
>
> Indexes need a name each.  Inside the brackets goes the name of the column 
> you're indexing on, then COLLATE, then the collation function to use (which 
> can be your own).  You cannot make the  collation function take a parameter 
> at this point.
>
>> Before giving that a shot, however, I'm hoping someone here can give me a
>> sense of whether that'll work?  Specifically, if I'm generating these
>> dynamic collation sequences on the fly, how does sqlite store the index on
>> disk?
>
> SQLite uses the simplest most obvious way to do it: the values returned by 
> your COLLATE function are stored in the index when a new row is added to a 
> table.  If your COLLATE function changes after rows have been added to the 
> index, SQLite does not understand the problem and can corrupt the index as it 
> tries to change it assuming that the old values are correct.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to