-
Notifications
You must be signed in to change notification settings - Fork 819
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
refactor: merge PgPreparedStatement#setBinaryStream int and long methods #3165
refactor: merge PgPreparedStatement#setBinaryStream int and long methods #3165
Conversation
checkClosed(); | ||
|
||
if (value == null) { | ||
setNull(parameterIndex, Oid.BYTEA); |
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.
this was setNull(parameterIndex, Types.VARBINARY); in the first method
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 see, but in method setNull(int parameterIndex, int sqlType), “Types.VARBINARY” and “Oid.BYTEA” are equivalent.
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
oid = Oid.BYTEA;
break;
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.
Good catch, I'll withdraw my criticism
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.
glad to help with the improvement of PG
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.
This should be a constant from java.sql.Types
, not an Oid
.
So Oid.BYTEA
is not valid here, and it causes tests to fail.
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.
Thank you for the reminder. I made a mistake.
I confused PrepareStatement.setNull
and preparedParameters.setNull
, PrepareStatement.setNull
should never use oid
as a parameter.
The content of the two setBinaryStream methods is almost identical. Combine them to reduce code complexity