#566 - Refactor internals - SpiExpression, add prepareExpression() to merge queryAutoTuneHash() and queryPlanHash() - initial

This commit is contained in:
Robin Bygrave committed 2016-02-13 20:13:16 +13:00
1 parent 0d456b2ad6
commit 769e4bb488
29 files changed
+239 -239

No files matched your search

@@ -17,32 +17,26 @@ public interface SpiExpression extends Expression {
* </p>
*/
void containsMany(BeanDescriptor<?> desc, ManyWhereJoins whereManyJoins);
/**
/**
* Prepare the expression. For example, compile sub-query expressions etc.
*/
void prepareExpression(BeanQueryRequest<?> request);
/**
* Calculate a hash value used to identify a query for AutoTune tuning.
* <p>
* That is, if the hash changes then the query will be considered different
* from an AutoTune perspective and get different tuning.
* </p>
*/
void queryAutoTuneHash(HashQueryPlanBuilder builder);
/**
* Calculate a hash value for the expression.
* This includes the expression type and property but should exclude
* the bind values.
* <p>
* This is used where queries are the same except for the bind values, in which
* case the query execution plan can be reused.
* </p>
*/
void queryPlanHash(BeanQueryRequest<?> request, HashQueryPlanBuilder builder);
void queryPlanHash(HashQueryPlanBuilder builder);
/**
* Return the hash value for the values that will be bound.
*/
int queryBindHash();
/**
* Add some sql to the query.
* <p>
@@ -61,7 +55,7 @@ public interface SpiExpression extends Expression {
/**
* Add the parameter values to be set against query. For each ? place holder
* there should be a corresponding value that is added to the bindList.
*
*
* @param request
* the associated request.
*/
@@ -1,13 +1,12 @@
package com.avaje.ebeaninternal.api;
import java.util.ArrayList;
import java.util.List;
import com.avaje.ebean.ExpressionFactory;
import com.avaje.ebean.ExpressionList;
import com.avaje.ebean.event.BeanQueryRequest;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
import java.util.List;
/**
* Internal extension of ExpressionList.
*/
@@ -59,13 +58,18 @@ public interface SpiExpressionList<T> extends ExpressionList<T> {
*
* @return the list of all the bind values in order.
*/
ArrayList<Object> buildBindValues(SpiExpressionRequest request);
List<Object> buildBindValues(SpiExpressionRequest request);
/**
* Prepare the expressions contained in the list. For example, compile sub-query expressions etc.
*/
void prepareExpression(BeanQueryRequest<?> request);
/**
* Calculate a hash based on the expressions but excluding the actual bind
* values.
*/
void queryPlanHash(BeanQueryRequest<?> request, HashQueryPlanBuilder builder);
void queryPlanHash(HashQueryPlanBuilder builder);
/**
* Validate all the properties/paths used in this expression list.