-
Notifications
You must be signed in to change notification settings - Fork 174
Add support for value substitution in string based queries #2201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit 89ae7f5.
Co-authored-by: Nikola Irinchev <[email protected]>
nirinchev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some final comments mostly related to tests/simplifying the conversion logic as that was quite hard to grasp/follow. In addition to that, some extra tests you might want to add:
- Tests for object matches that use embedded objects. You can use
ObjectWithEmbeddedPropertiesandEmbeddedAllTypesObject. Then, the tests should verify that this works:realm.All<ObjectWithEmbeddedProperties>().Filter("AllTypesObject = $0", theEmbedded) - Test that
nullis passed correctly as a value. e.g.realm.All<Foo>().Filter("Prop = null")should be equivalent byrealm.All<Foo>().Filter("Prop = $0", (int?)null)(assumingPropisint?). Note that you need the explicit cast as implicit null casts don't work yet and may not work due to reasons @papafe will explain on Wednesday.
…edded obj to have Guid, ObjectId and byte[]
| /// var results1 = realm.All<Foo>("Bar.IntValue > 0"); | ||
| /// var results2 = realm.All<Foo>("Bar.IntValue > 0 SORT(Bar.IntValue ASC Bar.StringValue DESC)"); | ||
| /// var results3 = realm.All<Foo>("Bar.IntValue > 0 SORT(Bar.IntValue ASC Bar.StringValue DESC) DISTINCT(Bar.IntValue)"); | ||
| /// var results4 = realm.All<Foo>("Bar.IntValue > $0 || (Bar.String == $1 && Bar.Bool == $2)" 5, "small", true"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// var results4 = realm.All<Foo>("Bar.IntValue > $0 || (Bar.String == $1 && Bar.Bool == $2)" 5, "small", true"); | |
| /// var results4 = realm.All<Foo>("Bar.IntValue > $0 || (Bar.String == $1 && Bar.Bool == $2)", 5, "small", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this posted only now? I do remember not seeing the suggestion after the talk in the call. Anyway, it's already fixed.
Description
Adding support for value substitution meant updating the wrapper to supply an array of mixed value to core. And from the C# side passing a marshable array of PrimitiveValue to the wrappers.
Documentation for the syntax of value substitution can be found here.
Fixes #1822
TODO
Nothing left
=============================
UPDATE:
RealmValueType.Nullto core when an in-memory object is supplied. This will need to be corrected, but not by this PR.