From 7643355f4c35e3db494c9040f67aed3823efa103 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Mon, 14 Apr 2008 15:47:43 +0000 Subject: Renamed overloaded slice fetch method to fetchSlice for clarity. --- src/main/java/com/amazon/carbonado/Query.java | 2 +- .../java/com/amazon/carbonado/qe/AbstractQueryExecutor.java | 2 +- .../java/com/amazon/carbonado/qe/DelegatedQueryExecutor.java | 4 ++-- src/main/java/com/amazon/carbonado/qe/EmptyQuery.java | 2 +- src/main/java/com/amazon/carbonado/qe/QueryExecutor.java | 2 +- src/main/java/com/amazon/carbonado/qe/StandardQuery.java | 5 +++-- src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java | 10 ++++++---- .../java/com/amazon/carbonado/repo/logging/LoggingQuery.java | 6 +++--- 8 files changed, 18 insertions(+), 15 deletions(-) (limited to 'src/main/java/com/amazon/carbonado') diff --git a/src/main/java/com/amazon/carbonado/Query.java b/src/main/java/com/amazon/carbonado/Query.java index 36a8117..0636655 100644 --- a/src/main/java/com/amazon/carbonado/Query.java +++ b/src/main/java/com/amazon/carbonado/Query.java @@ -301,7 +301,7 @@ public interface Query { * @throws FetchException if storage layer throws an exception * @since 1.2 */ - Cursor fetch(long from, Long to) throws FetchException; + Cursor fetchSlice(long from, Long to) throws FetchException; /** * Fetches results for this query after a given starting point, which is diff --git a/src/main/java/com/amazon/carbonado/qe/AbstractQueryExecutor.java b/src/main/java/com/amazon/carbonado/qe/AbstractQueryExecutor.java index 8a8a127..92e9004 100644 --- a/src/main/java/com/amazon/carbonado/qe/AbstractQueryExecutor.java +++ b/src/main/java/com/amazon/carbonado/qe/AbstractQueryExecutor.java @@ -45,7 +45,7 @@ public abstract class AbstractQueryExecutor implements Query * * @since 1.2 */ - public Cursor fetch(FilterValues values, long from, Long to) throws FetchException { + public Cursor fetchSlice(FilterValues values, long from, Long to) throws FetchException { Cursor cursor = fetch(values); if (from > 0) { cursor = new SkipCursor(cursor, from); diff --git a/src/main/java/com/amazon/carbonado/qe/DelegatedQueryExecutor.java b/src/main/java/com/amazon/carbonado/qe/DelegatedQueryExecutor.java index 3ec209d..e0b1be5 100644 --- a/src/main/java/com/amazon/carbonado/qe/DelegatedQueryExecutor.java +++ b/src/main/java/com/amazon/carbonado/qe/DelegatedQueryExecutor.java @@ -95,8 +95,8 @@ public class DelegatedQueryExecutor implements QueryExecutor return applyFilterValues(values).fetch(); } - public Cursor fetch(FilterValues values, long from, Long to) throws FetchException { - return applyFilterValues(values).fetch(from, to); + public Cursor fetchSlice(FilterValues values, long from, Long to) throws FetchException { + return applyFilterValues(values).fetchSlice(from, to); } public long count(FilterValues values) throws FetchException { diff --git a/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java b/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java index 83c09a6..f34500d 100644 --- a/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java +++ b/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java @@ -219,7 +219,7 @@ public final class EmptyQuery extends AbstractQuery { /** * Always returns an {@link EmptyCursor}. */ - public Cursor fetch(long from, Long to) { + public Cursor fetchSlice(long from, Long to) { checkSliceArguments(from, to); return EmptyCursor.the(); } diff --git a/src/main/java/com/amazon/carbonado/qe/QueryExecutor.java b/src/main/java/com/amazon/carbonado/qe/QueryExecutor.java index 6b5a864..358bda2 100644 --- a/src/main/java/com/amazon/carbonado/qe/QueryExecutor.java +++ b/src/main/java/com/amazon/carbonado/qe/QueryExecutor.java @@ -50,7 +50,7 @@ public interface QueryExecutor { * * @since 1.2 */ - Cursor fetch(FilterValues values, long from, Long to) throws FetchException; + Cursor fetchSlice(FilterValues values, long from, Long to) throws FetchException; /** * Counts the query results using the given filter values. diff --git a/src/main/java/com/amazon/carbonado/qe/StandardQuery.java b/src/main/java/com/amazon/carbonado/qe/StandardQuery.java index f8db1df..3137d3c 100644 --- a/src/main/java/com/amazon/carbonado/qe/StandardQuery.java +++ b/src/main/java/com/amazon/carbonado/qe/StandardQuery.java @@ -248,13 +248,14 @@ public abstract class StandardQuery extends AbstractQuery } } - public Cursor fetch(long from, Long to) throws FetchException { + public Cursor fetchSlice(long from, Long to) throws FetchException { if (!checkSliceArguments(from, to)) { return fetch(); } try { QueryHints hints = QueryHints.emptyHints().with(QueryHint.CONSUME_SLICE); - return executorFactory().executor(mFilter, mOrdering, hints).fetch(mValues, from, to); + return executorFactory().executor(mFilter, mOrdering, hints) + .fetchSlice(mValues, from, to); } catch (RepositoryException e) { throw e.toFetchException(); } diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java index f9bac1f..39d5a5a 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorage.java @@ -649,7 +649,9 @@ class JDBCStorage extends StandardQueryFactory } @Override - public Cursor fetch(FilterValues values, long from, Long to) throws FetchException { + public Cursor fetchSlice(FilterValues values, long from, Long to) + throws FetchException + { if (to != null && (to - from) <= 0) { return EmptyCursor.the(); } @@ -660,17 +662,17 @@ class JDBCStorage extends StandardQueryFactory switch (option) { case NOT_SUPPORTED: default: - return super.fetch(values, from, to); + return super.fetchSlice(values, from, to); case LIMIT_ONLY: if (from > 0 || to == null) { - return super.fetch(values, from, to); + return super.fetchSlice(values, from, to); } select = prepareSelect(values, false); select = mSupportStrategy.buildSelectWithSlice(select, false, true); break; case OFFSET_ONLY: if (from <= 0) { - return super.fetch(values, from, to); + return super.fetchSlice(values, from, to); } select = prepareSelect(values, false); select = mSupportStrategy.buildSelectWithSlice(select, true, false); diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingQuery.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingQuery.java index e737288..6d07801 100644 --- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingQuery.java +++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingQuery.java @@ -141,13 +141,13 @@ class LoggingQuery implements Query { return mQuery.fetch(); } - public Cursor fetch(long from, Long to) throws FetchException { + public Cursor fetchSlice(long from, Long to) throws FetchException { Log log = mStorage.mLog; if (log.isEnabled()) { - log.write("Query.fetch(start, to) on " + this + + log.write("Query.fetchSlice(start, to) on " + this + ", from: " + from + ", to: " + to); } - return mQuery.fetch(from, to); + return mQuery.fetchSlice(from, to); } public Cursor fetchAfter(S start) throws FetchException { -- cgit v1.2.3