mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#566 - Refactor internals - SpiExpression, add prepareExpression() to merge queryAutoTuneHash() and queryPlanHash() - move to protected calculateQueryPlanHash()
This commit is contained in:
@@ -466,16 +466,6 @@ public interface SpiQuery<T> extends Query<T> {
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Calculate a hash used by AutoTune to identify when a query has changed
|
||||
* (and hence potentially needs a new tuned query plan to be developed).
|
||||
* <p>
|
||||
* Excludes bind values and occurs prior to AutoTune potentially
|
||||
* tuning/modifying the query.
|
||||
* </p>
|
||||
*/
|
||||
HashQueryPlan queryAutoTuneHash(HashQueryPlanBuilder builder);
|
||||
|
||||
/**
|
||||
* Identifies queries that are the same bar the bind variables.
|
||||
* <p>
|
||||
|
||||
@@ -759,13 +759,10 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
/**
|
||||
* Calculate the query hash for either AutoTune query tuning or Query Plan caching.
|
||||
*/
|
||||
private HashQueryPlan calculateHash(HashQueryPlanBuilder builder) {
|
||||
HashQueryPlan calculateQueryPlanHash() {
|
||||
|
||||
// exclude bind values and things unrelated to the sql being generated
|
||||
|
||||
if (builder == null) {
|
||||
builder = new HashQueryPlanBuilder();
|
||||
}
|
||||
HashQueryPlanBuilder builder = new HashQueryPlanBuilder();
|
||||
|
||||
builder.add((type == null ? 0 : type.ordinal() + 1));
|
||||
builder.add(autoTuned).add(distinct).add(sqlDistinct).add(query);
|
||||
@@ -796,15 +793,6 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate a hash used by AutoTune to identify when a query has changed (and hence potentially
|
||||
* needs a new tuned query plan to be developed).
|
||||
*/
|
||||
public HashQueryPlan queryAutoTuneHash(HashQueryPlanBuilder builder) {
|
||||
|
||||
return calculateHash(builder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate a hash that should be unique for the generated SQL across a given bean type.
|
||||
* <p>
|
||||
@@ -818,7 +806,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
|
||||
prepareExpressions(request);
|
||||
|
||||
queryPlanHash = calculateHash(null);
|
||||
queryPlanHash = calculateQueryPlanHash();
|
||||
return queryPlanHash;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user