syncbase: syncQL: queries can drill into maps,sets,arrays,lists.

map/set/array/list used in the where clause
-------------------------------------------

example:
select v.Name from Customer where v.Foo["bar"] = 42

If Foo field is a map:
        The expression will evaluate to true and the record will be
        selected if the key "bar" exists in Foo and the
        corresponding value is 42.  In all other cases (no "bar" key,
        the value is not 42), the expression will evaluate to false and
        the record will not be selected.

example:
select v.Name from Customer where v.Foo["bar"] = true
If Foo is a set:
        The expression will evaluate to true and the record selected
        if Foo contains "bar".

example:
select v.Name from Customer where v.Foo[2] = 123.45

If Foo is an array or list with length >= 3:
        The expression will evaluate to true and the record will be
        selected if the value at index 2 is 123.45.  In all other cases,
        expression will evaluate to false and the record will not be
        selected.

In the examples above, if Foo is not an array, list, map or set; the expresion will
evaluate to false and no records will be selected.

map/set/array/list used in select clause
----------------------------------------

example:
select v.Foo["bar"] from Customer

If Foo is a map:
        a map lookup of "bar" will be performed.  If it exists, the resulting
        value will be returned, else a nil vdl.Value will be returned.

If Foo is a set:
        a set lookup of "bar" will be performed.  If it exists, true
        will be returned, else false will be returned.

example:
select v.Foo[2] from Customer

If Foo is an array or list with length >= 3:
       The value at index 2 will be returned, else a nil vdl.Value will be
       returned.

In both examples above, if Foo is not an array, list, map or set; nil will be returned.

Note: For simplicity, the above examples show literals as keys/indexes.  They need not be.
For example, fields and functions (or some combination thereof) will also work
For example,
select v.Foo[v.Bar] from Customer
select v.Address.Street where v.Addresses[UpperCase("primary")] == "100 Main St."

Complex function
----------------
I needed to add the Complex function so that complex literals as keys could be
specified in queries.

Change-Id: I5547827de7804c73f1abcf3e8bf6f7901bf1ecb3
13 files changed
tree: 51f0b5d801a5e477117514da5599a18901bc071d
  1. v23/
  2. x/
  3. .gitignore
  4. AUTHORS
  5. CONTRIBUTORS
  6. LICENSE
  7. PATENTS
  8. VERSION