Skip to content

Commit

Permalink
Merge pull request #796 from sgaertner/ERXExistsQualifier_patch3
Browse files Browse the repository at this point in the history
prevent wrong SQL generation in ERXExistsQualifier
  • Loading branch information
darkv authored Sep 8, 2016
2 parents 78da1b7 + c9ac955 commit 279345a
Showing 1 changed file with 0 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,6 @@ public String sqlStringForSQLExpression(EOQualifier qualifier, EOSQLExpression e
// (AR) Write the IN clause
sb.append(srcEntityForeignKey);
sb.append(" IN ( ");

// (AR) Rewrite first SELECT part of subExprStr
EOAttribute destPK = destEntity.primaryKeyAttributes().lastObject();
String destEntityPrimaryKey = expression.sqlStringForAttribute(destPK);
int indexOfFirstPeriod = destEntityPrimaryKey.indexOf(".");
destEntityPrimaryKey = destEntityPrimaryKey.substring(indexOfFirstPeriod);
subExprStr = StringUtils.replaceOnce(
subExprStr,
"SELECT " + EXISTS_ALIAS + "0" + destEntityPrimaryKey + " FROM",
"SELECT " + EXISTS_ALIAS + "0" + destEntityForeignKey + " FROM");
} else {
sb.append(" EXISTS ( ");
}
Expand Down

0 comments on commit 279345a

Please sign in to comment.