Skip to content

Commit

Permalink
Merge pull request #115 from OHDSI/fix-insert-into-empty-table-withou…
Browse files Browse the repository at this point in the history
…t-concepts

fix: insert with empty values in case of empty concepts
  • Loading branch information
wivern authored Mar 26, 2020
2 parents f3e4a26 + 185adc3 commit 45e0bf6
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,11 @@ public String getCodesetQuery(ConceptSet[] conceptSets) {
String conceptSetInsert = String.format("SELECT %d as codeset_id, c.concept_id FROM (%s) C", cs.id, conceptExpressionQuery);
codesetInserts.add(conceptSetInsert);
}
codesetQuery = StringUtils.replace(codesetQuery, "@codesetInserts", "INSERT INTO #Codesets (codeset_id, concept_id)\n"
+ StringUtils.join(codesetInserts, " UNION ALL \n")) + ";";
} else {
codesetQuery = StringUtils.replace(CODESET_QUERY_TEMPLATE, "@codesetInserts", StringUtils.EMPTY);
}

codesetQuery = StringUtils.replace(codesetQuery, "@codesetInserts", "INSERT INTO #Codesets (codeset_id, concept_id)\n"
+ StringUtils.join(codesetInserts, " UNION ALL \n")) + ";";
return codesetQuery;
}

Expand Down

0 comments on commit 45e0bf6

Please sign in to comment.