-
Notifications
You must be signed in to change notification settings - Fork 427
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
fix for queries without parameters using preparedStatement #372
fix for queries without parameters using preparedStatement #372
Conversation
…ies without parameter.
Codecov Report
@@ Coverage Diff @@
## RTW_6.2.0 #372 +/- ##
===============================================
- Coverage 40.27% 40.16% -0.12%
+ Complexity 1896 1886 -10
===============================================
Files 107 107
Lines 24486 24487 +1
Branches 4039 4039
===============================================
- Hits 9862 9834 -28
- Misses 12786 12816 +30
+ Partials 1838 1837 -1
Continue to review full report at Codecov.
|
@@ -966,6 +966,7 @@ private boolean doPrepExec(TDSWriter tdsWriter, | |||
if (needsPrepare | |||
&& !connection.getEnablePrepareOnFirstPreparedStatementCall() | |||
&& !isExecutedAtLeastOnce | |||
&& preparedTypeDefinitions.length() > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not make this check here. sp_executesql works fine without arguments. The problem is in the buildExecSQLParams method. Basically this works fine for sp_prepexec/buildPrepExecParams but not for sp_executesql:
tdsWriter.writeRPCStringUnicode((preparedTypeDefinitions.length() > 0) ? preparedTypeDefinitions : null);
So we should just change that to:
if (preparedTypeDefinitions.length() > 0) tdsWriter.writeRPCStringUnicode(preparedTypeDefinitions);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks @TobiasSQL . That was my initial thought too. Will commit the changes.
Fixes #370