diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/amazon/carbonado/qe/StandardQuery.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/main/java/com/amazon/carbonado/qe/StandardQuery.java b/src/main/java/com/amazon/carbonado/qe/StandardQuery.java index 3137d3c..71ad1e6 100644 --- a/src/main/java/com/amazon/carbonado/qe/StandardQuery.java +++ b/src/main/java/com/amazon/carbonado/qe/StandardQuery.java @@ -222,6 +222,8 @@ public abstract class StandardQuery<S extends Storable> extends AbstractQuery<S> Filter<S> orderFilter = Filter.getClosedFilter(storableType);
Filter<S> lastSubFilter = Filter.getOpenFilter(storableType);
+ Object[] values = new Object[orderings.size()];
+
for (int i=0;;) {
OrderedProperty<S> property = orderings.get(i);
RelOp operator = RelOp.GT;
@@ -229,15 +231,27 @@ public abstract class StandardQuery<S extends Storable> extends AbstractQuery<S> operator = RelOp.LT;
}
String propertyName = property.getChainedProperty().toString();
- Object value = start.getPropertyValue(propertyName);
- orderFilter = orderFilter.or(lastSubFilter.and(propertyName, operator, value));
+
+ values[i] = start.getPropertyValue(propertyName);
+
+ orderFilter = orderFilter.or(lastSubFilter.and(propertyName, operator));
+
if (++i >= orderings.size()) {
break;
}
- lastSubFilter = lastSubFilter.and(propertyName, RelOp.EQ, value);
+
+ lastSubFilter = lastSubFilter.and(propertyName, RelOp.EQ).bind();
+ }
+
+ Query<S> query = this.and(orderFilter);
+
+ for (int i=0; i<values.length; i++) {
+ for (int j=0; j<=i; j++) {
+ query = query.with(values[j]);
+ }
}
- return and(orderFilter);
+ return query;
}
public Cursor<S> fetch() throws FetchException {
|