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

Reply via email to