Skip to content

SqlFragment no longer implements CharSequence - #8185

Merged
labkey-matthewb merged 4 commits into
developfrom
fb_sqlfragment_not_implements
Oct 16, 2026
Merged

labkey-matthewb merged 4 commits into
developfrom
fb_sqlfragment_not_implements

Conversation

@labkey-matthewb

Copy link
Copy Markdown
Contributor

Rationale

We "disabled" auto-convert from SQLFragment to String by poisoning .toString(). However, SQLFragment implements CharSequence. That enables some unexpected/ambiguous usages. For instance a ? SQLFragment() : String) unexpectedly casts to CharSequence which may not be correct.

Related Pull Requests

Changes

.append(" P.").append(cohortFilter.getType() == CohortFilter.Type.PTID_CURRENT ? "CurrentCohortId" : "InitialCohortId")
.append(" = ?\n").append(qcStates != null ? "AND " + qcStates.getStateInClause(DatasetTableImpl.QCSTATE_ID_COLNAME) + "\n" : "");
sql.add(cohortFilter.getCohortId());
.append(" = ").appendValue(cohortFilter.getCohortId()).append("\n");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keep the parameter marker for cohortFilter.getCohortId()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just style. I occasionally see .add() calls that get pretty far from the parameter marker. I think it's nice to not have to match them up.

@labkey-matthewb
labkey-matthewb merged commit 876d385 into develop Oct 16, 2026
9 of 10 checks passed
@labkey-matthewb
labkey-matthewb deleted the fb_sqlfragment_not_implements branch October 16, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants