Skip to content

Commit 3c72eac

Browse files
authored
Use helper methods to create IN clauses (#219)
## Rationale Using helpers to generate SQL IN clauses is more convenient and prevents broken SQL & injection risks ## Related Pull Requests - LabKey/platform#8187
1 parent b8ee76d commit 3c72eac

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎genotyping/src/org/labkey/genotyping/view/haplotypeAssignmentReport.jsp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,13 @@
213213
214214
getIdInClauseStr: function(idArr)
215215
{
216+
if (!idArr || idArr.length === 0)
217+
return "NULL";
218+
216219
var str = "";
217220
var sep = "";
218221
Ext4.each(idArr, function(id){
219-
str += sep + "'" + id + "'";
222+
str += sep + "'" + id.replace(/'/g, "''") + "'";
220223
sep = ", ";
221224
});
222225
return str;

0 commit comments

Comments
 (0)