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
Prepared statements: Support bound parameters of type CharSequence #2057
Prepared statements: Support bound parameters of type CharSequence #2057
Conversation
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.
The addition looks good - thanks. It would be nice to add a test case for this as well, just to make sure everything works and stays working.
good morning @stevenschlansker |
3c8afb0
to
a473a83
Compare
Hi @stevenschlansker, |
@Override | ||
protected Argument build(CharSequence value, ConfigRegistry config) { | ||
return (position, statement, ctx) -> { | ||
StatementBinder<String> binder = PreparedStatement::setString; |
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.
I'm not sure why the binder
here is helpful. Wouldn't it be simpler to just call statement.setString(position, Objects.toString(value, null));
?
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.
You're right! Fixed.
…ement CharSequence
9fabe76
to
917d62d
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This small pull request adds support for bound parameters of type
CharSequence
in prepared statements.Such parameters are to be treated same as
String
.