schematic icon indicating copy to clipboard operation
schematic copied to clipboard

@InexactContentUri whereColumns joined via OR

Open adrianrdzv opened this issue 7 years ago • 3 comments

Currently I'm trying to set a @InexactContentUri where the whereColumn can be any of 2 columns in my table. I would requiere the where clause to be: WHERE whereColumn1 = pathSegment OR whereColumn2 = pathSegment

This seems to be impossible with the current setup because whereColumn are joined with an AND. Would be good to have an option to join them via an OR Or alternatively make the where work without require the whereColumn parameter. I tried to use the where parameter but currently it doesn't allow the whereColumn clause to be empty. Also couldn't find a way on how the where clause could use the path segments.

adrianrdzv avatar Oct 22 '16 11:10 adrianrdzv

Yeah, that's not possible right now. I think it's too hard to do anything but the simplest use-cases with a single annotation.

Maybe @InexactContentUri should just be killed, and @ContentUri on a method should always be accompanied with a @Where annotated method.

SimonVT avatar Oct 24 '16 19:10 SimonVT

As well as the previous suggestion, some convenience annotations could be added. E.g. @IdContentUri and @RangeContentUri.

SimonVT avatar Oct 24 '16 20:10 SimonVT

I also noticed that whereColumn and pathSegment are mandatory in InexactContentUri.

I was planning to have a very custom where clause with question marks in it and than have path segments or query params of the Uri to be selectionArgs.

It's of course not straightforward to do. But instead of RangeContentUri, to solve the issue described here, we could have a where clause with OR in it and have arguments coming from method params.

tasomaniac avatar Oct 24 '16 20:10 tasomaniac