#921 - Refactor internals - Change internal use of "findRowCount" to "findCount"

This commit is contained in:
Rob Bygrave committed 2016-12-13 19:51:11 +13:00
1 parent f429811f79
commit cf37fda3f4
17 files changed
+36 -41

No files matched your search

@@ -133,12 +133,12 @@ public class CQueryEngine {
/**
* Build and execute the row count query.
*/
public <T> int findRowCount(OrmQueryRequest<T> request) {
public <T> int findCount(OrmQueryRequest<T> request) {
CQueryRowCount rcQuery = queryBuilder.buildRowCountQuery(request);
try {
int rowCount = rcQuery.findRowCount();
int count = rcQuery.findCount();
if (request.isLogSql()) {
logGeneratedSql(request, rcQuery.getGeneratedSql(), rcQuery.getBindLog());
@@ -152,7 +152,7 @@ public class CQueryEngine {
request.getTransaction().end();
}
return rowCount;
return count;
} catch (SQLException e) {
throw CQuery.createPersistenceException(e, request.getTransaction(), rcQuery.getBindLog(), rcQuery.getGeneratedSql());
@@ -69,7 +69,7 @@ class CQueryRowCount {
public String getSummary() {
//noinspection StringBufferReplaceableByString
StringBuilder sb = new StringBuilder(80);
sb.append("FindRowCount exeMicros[").append(executionTimeMicros)
sb.append("FindCount exeMicros[").append(executionTimeMicros)
.append("] rows[").append(rowCount)
.append("] type[").append(desc.getFullName())
.append("] predicates[").append(predicates.getLogWhereSql())
@@ -95,7 +95,7 @@ class CQueryRowCount {
/**
* Execute the query returning the row count.
*/
public int findRowCount() throws SQLException {
public int findCount() throws SQLException {
long startNano = System.nanoTime();
try {
@@ -7,17 +7,17 @@ import io.ebeaninternal.api.SpiQuery;
import java.util.concurrent.Callable;
/**
* Represent the findRowCount query as a Callable.
* Represent the findCount query as a Callable.
*
* @param <T> the entity bean type
*/
public class CallableQueryRowCount<T> extends CallableQuery<T> implements Callable<Integer> {
public class CallableQueryCount<T> extends CallableQuery<T> implements Callable<Integer> {
/**
* Note that the transaction passed in is always a new transaction solely to
* find the row count so it must be cleaned up by this CallableQueryRowCount.
*/
public CallableQueryRowCount(SpiEbeanServer server, SpiQuery<T> query, Transaction t) {
public CallableQueryCount(SpiEbeanServer server, SpiQuery<T> query, Transaction t) {
super(server, query, t);
}
@@ -26,7 +26,7 @@ public class CallableQueryRowCount<T> extends CallableQuery<T> implements Callab
*/
public Integer call() throws Exception {
try {
return server.findRowCountWithCopy(query, transaction);
return server.findCountWithCopy(query, transaction);
} finally {
// cleanup the underlying connection
transaction.end();
@@ -58,10 +58,10 @@ public class DefaultOrmQueryEngine implements OrmQueryEngine {
return queryEngine.update(request);
}
public <T> int findRowCount(OrmQueryRequest<T> request) {
public <T> int findCount(OrmQueryRequest<T> request) {
flushJdbcBatchOnQuery(request);
return queryEngine.findRowCount(request);
return queryEngine.findCount(request);
}
public <A> List<A> findIds(OrmQueryRequest<?> request) {
@@ -11,9 +11,9 @@ import java.util.concurrent.FutureTask;
*/
public class QueryFutureRowCount<T> extends BaseFuture<Integer> implements FutureRowCount<T> {
private final CallableQueryRowCount<T> call;
private final CallableQueryCount<T> call;
public QueryFutureRowCount(CallableQueryRowCount<T> call) {
public QueryFutureRowCount(CallableQueryCount<T> call) {
super(new FutureTask<>(call));
this.call = call;
}