On Thu, Nov 12, 2015 at 4:52 PM, J Decker <d3ck0r at gmail.com> wrote:
> > So something like "select value from option_map_view where path is > <array or > > set type>"? > > A path name like '/system/device/com port/1' is used as an array of names > > here. Only the indexing with intst and substr is laborious. Maybe some > > future SQLite version includes a group_split function to make this > easier. > > It seems impossible to me in plain SQL to write an efficient view for a > > query like this. As you say below the whole map need to be walked at each > > query to find a match. > > User defined functions, virtual tables or function based indexes may > offer > > an efficient solution. > > > > Hmm a user function could be interesting; hard to see a threadsafe > version but could keep the array of values internally and and return > them as 'getOption(n)' as I descend each layer... > I think this case wants something like a table-valued user function: https://www.sqlite.org/vtab.html#tabfunc2 as used by: https://www.sqlite.org/json1.html That's basically what you just said, except in a way which isn't kludging things together. [I think, apologies if I mis-read things.] -scott