-
Notifications
You must be signed in to change notification settings - Fork 574
Handle multiple target types for ReferenceSearchParam #5285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| ResourceVersionTypes = ResourceVersionType.Latest, | ||
| }; | ||
|
|
||
| var output = _queryGenerator.VisitSqlRoot(sqlExpression, searchOptions); |
Check warning
Code scanning / CodeQL
Useless assignment to local variable Warning
output
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 19 days ago
In general, to fix a "useless assignment to local variable" where you still need the side effect of the right-hand side, you remove the unused local variable and keep just the expression statement (method call). If you do not need the side effect either, you remove the entire statement.
Here, the test clearly needs to execute _queryGenerator.VisitSqlRoot(sqlExpression, searchOptions) to populate _strBuilder, because generatedSql is read from _strBuilder immediately afterward. However, the variable output is never used. The best fix is therefore to remove the var output = part and keep the method call as a standalone statement. This preserves all existing behavior and cleans up the unused assignment.
Concretely, in src/Microsoft.Health.Fhir.SqlServer.UnitTests/Features/Search/SqlQueryGeneratorTests.cs, replace the line:
185: var output = _queryGenerator.VisitSqlRoot(sqlExpression, searchOptions);with:
185: _queryGenerator.VisitSqlRoot(sqlExpression, searchOptions);No additional methods, imports, or definitions are needed.
-
Copy modified line R185
| @@ -182,7 +182,7 @@ | ||
| ResourceVersionTypes = ResourceVersionType.Latest, | ||
| }; | ||
|
|
||
| var output = _queryGenerator.VisitSqlRoot(sqlExpression, searchOptions); | ||
| _queryGenerator.VisitSqlRoot(sqlExpression, searchOptions); | ||
|
|
||
| string generatedSql = _strBuilder.ToString(); | ||
|
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description
Updates SQL generator to handle multiple target types for ReferenceSearchParam.
Related issues
Addresses [issue AB#177046].
Testing
Describe how this change was tested.
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)