Skip to content

Commit 2e2f52b

Browse files
DatabaseIdentifier (#162)
* support STR_TABLE_ALIAS in SimpleFilter.SQLClause * StringBuilder->SQLFragment also assert in DatabaseIdentifier.toString() to find teamcity failures --------- Co-authored-by: Adam Rauch <adam@labkey.com>
1 parent 30f66ea commit 2e2f52b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

genotyping/src/org/labkey/genotyping/GenotypingQuerySchema.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
import java.util.SortedMap;
6868
import java.util.TreeMap;
6969

70+
import static org.labkey.api.query.ExprColumn.STR_TABLE_ALIAS;
71+
7072
/**
7173
* User: adam
7274
* Date: Oct 4, 2010
@@ -136,7 +138,7 @@ FilteredTable createTable(GenotypingQuerySchema schema, ContainerFilter cf)
136138
{
137139
FilteredTable table = new FilteredTable<>(GS.getSequencesTable(), schema, cf);
138140
table.wrapAllColumns(true);
139-
SQLFragment containerCondition = new SQLFragment("(SELECT Container FROM ").append(GS.getDictionariesTable().getFromSQL("d")).append(" WHERE d.RowId = ").append(GS.getSequencesTable()).append(".Dictionary) = ?");
141+
SQLFragment containerCondition = new SQLFragment("(SELECT Container FROM ").append(GS.getDictionariesTable().getFromSQL("d")).append(" WHERE d.RowId = ").append(STR_TABLE_ALIAS).append(".Dictionary) = ?");
140142
containerCondition.add(schema.getContainer().getId());
141143
table.addCondition(containerCondition);
142144
removeFromDefaultVisibleColumns(table, "Dictionary");
@@ -270,7 +272,7 @@ protected void applyContainerFilter(ContainerFilter filter)
270272

271273
table.wrapAllColumns(true);
272274
table.getMutableColumn("CreatedBy").setFk(new UserIdQueryForeignKey(schema, true));
273-
SQLFragment containerCondition = new SQLFragment("(SELECT Container FROM " + GS.getRunsTable() + " r WHERE r.RowId = " + GS.getAnalysesTable() + ".Run) = ?");
275+
SQLFragment containerCondition = new SQLFragment("(SELECT Container FROM " + GS.getRunsTable() + " r WHERE r.RowId = " + STR_TABLE_ALIAS + ".Run) = ?");
274276
containerCondition.add(schema.getContainer().getId());
275277
table.addCondition(containerCondition);
276278
setDefaultVisibleColumns(table, "RowId, Run, Created, CreatedBy, Description, SequenceDictionary, SequencesView");

genotyping/src/org/labkey/genotyping/view/mhcQuery.jsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
SELECT reads.sampleid,
3030
alleles,
3131
CAST(COUNT(*) AS INT) AS reads,
32-
CAST(COUNT(*) AS REAL)/total_reads AS <%=dialect.getColumnSelectName("percent")%>,
32+
CAST(COUNT(*) AS REAL)/total_reads AS <%=dialect.getColumnSelectName("percent").getRawSQL()%>,
3333
AVG(avg_length) AS avg_length,
3434
CAST(SUM(pos_reads) AS INT) AS pos_reads,
3535
CAST(SUM(neg_reads) AS INT) AS neg_reads,

0 commit comments

Comments
 (0)