apache / apache/shardingsphere
Consider optimizing AbstractJDBCRowsLoader#loadRowValue logic
@strongduanmu is already working on this.
Since Nov 4, 2022.
- Dominant language
- Java
- Stars
- 20.8k
- Forks
- 6.9k
- Avg merge
- 9h 55m
- Merged PRs (30d)
- 311
Description
Feature Request
Is your feature request related to a problem?
#21926
Describe the feature you would like.
At present, the AbstractJDBCRowsLoader#loadRowValue method seems to only consider the corresponding relationship between SQL Type and Java Type in MySQL, and does not correctly handle other databases such as PostgreSQL and openGauss. Therefore, java.sql.SQLException: Unknown exception: java.lang.Integer cannot be cast to java.lang.Short appeared in #21926, and we need to adapt to different database dialects.
- MySQL Java, JDBC, and SQL Types——https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-type-conversions.html
- PostgreSQL/openGauss Java, JDBC, and SQL Types——https://www.instaclustr.com/blog/postgresql-data-types-mappings-to-sql-jdbc-and-java-data-types/
- Oracle Java, JDBC, and SQL Types——https://docs.oracle.com/cd/A97335_02/apps.102/a83724/basic3.htm
- SQLServer Java, JDBC, and SQL Types——https://learn.microsoft.com/en-us/sql/connect/jdbc/using-basic-data-types?view=sql-server-ver16&ranMID=43674&ranEAID=FE4O7wtxe6g&ranSiteID=FE4O7wtxe6g-uvx0rKCnHTck.NHARU54aA&epi=FE4O7wtxe6g-uvx0rKCnHTck.NHARU54aA&irgwc=1&OCID=AID2200057_aff_7795_1243925&tduid=(ir__9rtvz0paxwkfb3acaazn3r2cd32xqerlg0dhsrmm00)(7795)(1243925)(FE4O7wtxe6g-uvx0rKCnHTck.NHARU54aA)()&irclickid=_9rtvz0paxwkfb3acaazn3r2cd32xqerlg0dhsrmm00
Also, I looked at the JDBC specification, it specifies the mapping between JDBC Type and Java Type, and most databases are implemented based on the specification, so we can implement these common methods in abstract classes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.