Working with Objective-C, I am having difficulty passing an array as a parameter to a query in CBL v3.2.1
My query looks like this:
NSString* queryString = @"SELECT meta().id AS `_id`, name "
"FROM _default "
"WHERE ( meta().id IN [ $customer_ids_array ] ) "
"ORDER BY lower(name) ASC";
The code that passes the parameter before query execution is:
QueryParameters* parameters = [[QueryParameters alloc] init];
[parameters setParameter:@"customer_ids_array" withArrayValue:@[@"c1"]];
I have tried several variations of the IN [ $customer_ids_array ]
expression, including IN ( $customer_ids_array )
and IN $customer_ids_array
… nothing works.
The result is no rows are returned by the query. I know that one row should be returned because if I use a scalar I do get the row I’m after …i.e. with meta().id = $customer_id
in the query and QueryParameters
method setParameter:withStringValue:
in the code I do see a row being returned.
How do I successfully parameterize the array I’m using on the RHS of the IN operator?