Skip to content
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

[BUG] SQLServerConnection#connectInternal extracts SELECT_METHOD twice #981

Closed
ecki opened this issue Mar 9, 2019 · 3 comments
Closed
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly.

Comments

@ecki
Copy link
Contributor

ecki commented Mar 9, 2019

There are two times where the SELECT_METHOD property is extracted, only one checks for values and assigns it to the field. The locations can probably be consolidated

https://github.com/Microsoft/mssql-jdbc/blob/bb72f76374479740c1084c7a321c522609de3961/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java#L1758
https://github.com/Microsoft/mssql-jdbc/blob/bb72f76374479740c1084c7a321c522609de3961/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java#L1482

Suggestion (which also reduces number of case changes and compares):

sPropValue = sPropValue.toLowerCase(Locale.ENGLISH);
selectMethod = null;
if ("cursor".equals(sPropValue) || "direct".equals(sPropValue)) {        
            activeConnectionProperties.setProperty(sPropKey, sPropValue);
            selectMethod = sPropValue;
 } else {

And remove the second occurrence. I can make a PR if you agree.

@ecki ecki added the Bug A bug in the driver. A high priority item that one can expect to be addressed quickly. label Mar 9, 2019
@cheenamalhotra
Copy link
Member

@ecki

Please feel free to create PR for the same. 👍

@peterbae
Copy link
Contributor

This issue has been addressed in PR #987. Closing issue.

@ecki
Copy link
Contributor Author

ecki commented Mar 13, 2019

Looks good, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly.
Projects
None yet
Development

No branches or pull requests

3 participants