-
Notifications
You must be signed in to change notification settings - Fork 359
Use JDBCType.NULL for null if possible #2069
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
Not all databases support the JDBCSqlType.NULL. Therefore this handling was made dialect dependent, with SQL Server and DB2 using the old approach, while all others use JDBCSqlType.NULL In the process modified AbstractJdbcConfiguration to use JdbcDialect instead of Dialect. Original pull request #2068 See #1935 See #2031
* Implementation that always uses {@link JDBCType#NULL}. Suitable for all databases that actually support this | ||
* {@link JDBCType}. | ||
*/ | ||
NullTypeStrategy DEFAULT = sqlType -> JDBCType.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.
We should have more meaningful names. Something like NULL_VALUE
instead of DEFAULT
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 quite sure this is the best way to approach the problem because we're introducing configuration complexity on our side how to massage the JDBC driver.
In R2DBC, we've solved the issue of writing null values by considering these in the SQL statement using NULL
instead of a parameter bind marker. That seems much easier than figuring out (and potentially asking the database to obtain) a SQL type number for a null
value.
* {@link SQLType} to use for {@literal null} values. | ||
* | ||
* @param sqlType a fallback value that is considered suitable by the caller. | ||
* @return Guaranteed not to be {@literal 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.
🤣
This is based on #2068.
Not all databases support the JDBCSqlType.NULL.
Therefore this handling was made dialect dependent, with SQL Server and DB2 using the old approach, while all others use JDBCSqlType.NULL
In the process modified AbstractJdbcConfiguration to use JdbcDialect instead of Dialect.
Closes #1935