diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2007-10-21 00:46:26 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2007-10-21 00:46:26 +0000 |
commit | 1d23e874281ba111d5cf37c7aef76d45d25a5170 (patch) | |
tree | 91524f91b2b9ab2b60410f6a33517bf6cce5c3d7 /src/main/java/com/amazon/carbonado/cursor | |
parent | 64a9d91c5d3abb7e8d3b31a6c7af2bdd759e83a0 (diff) |
Allow open exists filter to operate on many-to-one join.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/cursor')
-rw-r--r-- | src/main/java/com/amazon/carbonado/cursor/FilteredCursorGenerator.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/com/amazon/carbonado/cursor/FilteredCursorGenerator.java b/src/main/java/com/amazon/carbonado/cursor/FilteredCursorGenerator.java index 745ad7a..04ea2e8 100644 --- a/src/main/java/com/amazon/carbonado/cursor/FilteredCursorGenerator.java +++ b/src/main/java/com/amazon/carbonado/cursor/FilteredCursorGenerator.java @@ -349,6 +349,17 @@ class FilteredCursorGenerator { }
public Object visit(ExistsFilter<S> filter, Object param) {
+ // Load join property value to stack.
+ CodeBuilder b = mIsAllowedBuilder;
+ loadChainedProperty(b, filter.getChainedProperty());
+
+ if (!filter.getChainedProperty().getLastProperty().isQuery()) {
+ // Checking for existence or non-existence of many-to-one join.
+ // Implement by comparing against null.
+ getScope().successIfNullElseFail(b, filter.isNotExists());
+ return null;
+ }
+
// Recursively gather all the properties to be passed to sub-filter.
final List<PropertyFilter> subPropFilters = new ArrayList<PropertyFilter>();
@@ -364,10 +375,6 @@ class FilteredCursorGenerator { }
}, null);
- // Load join property value to stack. It is expected to be a Query.
- CodeBuilder b = mIsAllowedBuilder;
- loadChainedProperty(b, filter.getChainedProperty());
-
final TypeDesc queryType = TypeDesc.forClass(Query.class);
// Refine Query filter, if sub-filter isn't open.
|