Skip to content

Commit

Permalink
Fix querying (historic) plan item instances with local variables on S…
Browse files Browse the repository at this point in the history
…QL Server, DB2 and Oracle
  • Loading branch information
filiphr committed Oct 4, 2024
1 parent aa7d3ee commit e8dda66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@
</select>

<select id="selectHistoricPlanItemInstancesWithLocalVariablesByQueryCriteria" parameterType="org.flowable.cmmn.engine.impl.history.HistoricPlanItemInstanceQueryImpl" resultMap="historicPlanItemInstanceResultMapWithVariables">
<if test="needsPaging">${limitBefore}</if>
SELECT RES.*
<if test="includeLocalVariables">,
VAR.ID_ as VAR_ID_, VAR.NAME_ as VAR_NAME_, VAR.VAR_TYPE_ as VAR_TYPE_, VAR.REV_ as VAR_REV_,
Expand All @@ -355,13 +354,15 @@
VAR.TEXT_ as VAR_TEXT_, VAR.TEXT2_ as VAR_TEXT2_, VAR.LONG_ as VAR_LONG_
</if>
FROM (
<!-- top 100 percent is only needed when doing order by in a subselect -->
<if test="needsPaging">${limitBefore}</if>
SELECT RES.* <if test="needsPaging">${limitBetween}</if>
SELECT <if test="_databaseId == 'mssql'">top 100 percent</if> RES.* <if test="needsPaging">${limitBetween}</if>
<include refid="selectHistoricPlanItemInstancesByQueryCriteriaSql"/>
${orderBy}
<if test="needsPaging">${limitAfter}</if>
) RES
left outer join ${prefix}ACT_HI_VARINST VAR ON RES.ID_ = VAR.SUB_SCOPE_ID_ and VAR.SCOPE_TYPE_= 'cmmn'
${outerJoinOrderBy}
</select>

<select id="selectHistoricPlanItemInstancesCountByQueryCriteria" parameterType="org.flowable.cmmn.engine.impl.history.HistoricPlanItemInstanceQueryImpl" resultType="long">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@
</select>

<select id="selectPlanItemInstancesWithLocalVariablesByQueryCriteria" parameterType="org.flowable.cmmn.engine.impl.runtime.PlanItemInstanceQueryImpl" resultMap="planItemInstanceResultMapWithVariables">
<if test="needsPaging">${limitBefore}</if>
SELECT RES.*
<if test="includeLocalVariables">,
VAR.ID_ as VAR_ID_, VAR.NAME_ as VAR_NAME_, VAR.TYPE_ as VAR_TYPE_, VAR.REV_ as VAR_REV_,
Expand All @@ -375,13 +374,15 @@
VAR.TEXT_ as VAR_TEXT_, VAR.TEXT2_ as VAR_TEXT2_, VAR.LONG_ as VAR_LONG_
</if>
FROM (
<!-- top 100 percent is only needed when doing order by in a subselect -->
<if test="needsPaging">${limitBefore}</if>
SELECT RES.* <if test="needsPaging">${limitBetween}</if>
SELECT <if test="_databaseId == 'mssql'">top 100 percent</if> RES.* <if test="needsPaging">${limitBetween}</if>
<include refid="selectPlanItemInstancesByQueryCriteriaSql"/>
${orderBy}
<if test="needsPaging">${limitAfter}</if>
) RES
left outer join ${prefix}ACT_RU_VARIABLE VAR ON RES.ID_ = VAR.SUB_SCOPE_ID_ and VAR.SCOPE_TYPE_= 'cmmn'
${outerJoinOrderBy}
</select>

<select id="selectPlanItemInstanceCountByQueryCriteria" parameterType="org.flowable.cmmn.engine.impl.runtime.PlanItemInstanceQueryImpl" resultType="long">
Expand Down

0 comments on commit e8dda66

Please sign in to comment.