#1683 - Refactor MetaQueryPlan and MetaOrmQueryMetric - rename getQueryPlanHash() to getSqlHash()

This commit is contained in:
rob bygrave
2019-04-26 12:55:40 +12:00
parent 1bb2b1318e
commit b4105ab5d0
5 changed files with 42 additions and 10 deletions
@@ -13,9 +13,9 @@ public interface MetaOrmQueryMetric extends MetaQueryMetric {
boolean isAutoTuned();
/**
* Return a string representation of the query plan hash.
* Return the hash of the sql.
*/
String getQueryPlanHash();
String getSqlHash();
/**
* Return the time of the last query executed using this plan.
+31 -3
View File
@@ -1,23 +1,51 @@
package io.ebean.meta;
import io.ebean.ProfileLocation;
public interface MetaQueryPlan {
/**
* Return the bean type for the query.
*/
Class<?> getBeanType();
/**
* Return a string representation of the query plan hash.
* Return the label of the query.
*/
String getQueryPlanHash();
String getLabel();
/**
* Return the profile location for the query.
*/
ProfileLocation getProfileLocation();
/**
* Return the sql of the query.
*/
String getSql();
/**
* Return the hash of the sql.
*/
String getSqlHash();
/**
* Return a description of the bind values.
*/
String getBind();
/**
* Return the raw plan.
*/
String getPlan();
/**
* Return the query execution time associated with the bind values capture.
*/
long getQueryTimeMicros();
/**
* Return the total count of times bind capture has occurred.
*/
long getCaptureCount();
}
@@ -113,7 +113,7 @@ class DumpMetrics {
appendQueryName(metric, sb);
appendCounters(metric, sb);
if (dumpHash) {
sb.append("\n hash:").append(metric.getQueryPlanHash());
sb.append("\n hash:").append(metric.getSqlHash());
}
appendProfileAndSql(metric, sb);
out(sb.toString());
@@ -238,7 +238,7 @@ public final class CQueryPlanStats {
}
@Override
public String getQueryPlanHash() {
public String getSqlHash() {
return queryPlan.getSqlHash();
}
@@ -30,7 +30,7 @@ class DQueryPlanOutput implements MetaQueryPlan {
}
@Override
public String getQueryPlanHash() {
public String getSqlHash() {
return sqlHash;
}
@@ -50,6 +50,11 @@ class DQueryPlanOutput implements MetaQueryPlan {
return label;
}
@Override
public ProfileLocation getProfileLocation() {
return profileLocation;
}
/**
* Return the sql of query.
*/
@@ -84,8 +89,7 @@ class DQueryPlanOutput implements MetaQueryPlan {
}
/**
* Return the total count of times bind capture has occurred. We don't want this to be
* massive as that implies a high overhead.
* Return the total count of times bind capture has occurred.
*/
@Override
public long getCaptureCount() {