#753 - @History "as of" query errors when executed a second time - invalid bind parameter

This commit is contained in:
Robin Bygrave
2016-06-28 06:46:16 +12:00
parent 1f9ccf1c8b
commit 697f67c14a
2 changed files with 9 additions and 1 deletions
@@ -70,6 +70,8 @@ public class CQueryPlan {
protected final DataTimeZone dataTimeZone;
private final int asOfTableCount;
/**
* Key used to identify the query plan in audit logging.
*/
@@ -86,6 +88,7 @@ public class CQueryPlan {
this.stats = new CQueryPlanStats(this, server.isCollectQueryOrigins());
this.planKey = request.getQueryPlanKey();
this.autoTuned = request.getQuery().isAutoTuned();
this.asOfTableCount = request.getQuery().getAsOfTableCount();
if (sqlRes != null) {
this.sql = sqlRes.getSql();
this.rowNumberIncluded = sqlRes.isIncludesRowNumberColumn();
@@ -111,6 +114,7 @@ public class CQueryPlan {
this.stats = new CQueryPlanStats(this, server.isCollectQueryOrigins());
this.planKey = buildPlanKey(sql, rawSql, rowNumberIncluded, logWhereSql);
this.autoTuned = false;
this.asOfTableCount = 0;
this.sql = sql;
this.sqlTree = sqlTree;
this.rawSql = rawSql;
@@ -151,6 +155,10 @@ public class CQueryPlan {
return dataBind;
}
public int getAsOfTableCount() {
return asOfTableCount;
}
public boolean isAutoTuned() {
return autoTuned;
}
@@ -136,7 +136,7 @@ public class CQueryPredicates {
dataBind.append(", ");
}
int asOfTableCount = query.getAsOfTableCount();
int asOfTableCount = request.getQueryPlan().getAsOfTableCount();
if (asOfTableCount > 0) {
// bind the asOf value for each table alias as part of the from/join clauses
// there is one effective date predicate per table alias