Skip to content
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

Remove column mapping to JDBC type FLOAT for SQL Server #451

Merged

Conversation

nscuro
Copy link
Contributor

@nscuro nscuro commented Sep 28, 2022

The JDBC driver does not provide this type. According to https://learn.microsoft.com/en-us/sql/connect/jdbc/using-basic-data-types?view=sql-server-ver16, the SQL type FLOAT is mapped to the JDBC type DOUBLE.

dbinfo output of the schema tool is provided for the last three major versions of the JDBC driver.

This addressed #304

The JDBC driver does not provide this type. According to https://learn.microsoft.com/en-us/sql/connect/jdbc/using-basic-data-types?view=sql-server-ver16, the SQL type `FLOAT` is mapped to the JDBC type `DOUBLE`.

dbinfo output of the schema tool is provided for the last three major versions of the JDBC driver.

Signed-off-by: nscuro <[email protected]>
@andyjefferson
Copy link
Member

Thx for the PR. No real issue with this fix, but why not go one step further ... add support for JDBC FLOAT if it isn't provided by the JDBC Driver. You do this by adding an entry for Types.FLOAT in the initialiseTypes method, map it to sqlType of "float", and then you can have entries for the different Java types to allow people to specify it as JDBC type = float

@nscuro
Copy link
Contributor Author

nscuro commented Sep 28, 2022

Sure, I can give that a go.

I see there is already an "artificial" mapping for DOUBLE:

sqlType = new org.datanucleus.store.rdbms.adapter.SQLServerTypeInfo(
"float", (short)Types.DOUBLE, 53, null, null, null, 1, false, (short)2, false, false, false, null, (short)0, (short)0, 2);
addSQLTypeForJDBCType(handler, mconn, (short)Types.DOUBLE, sqlType, true);

It seems like the mapping would be identical for FLOAT, so just adding

addSQLTypeForJDBCType(handler, mconn, (short)Types.FLOAT, sqlType, true);

below the above snippet should do the trick?

@andyjefferson andyjefferson added this to the 6.0.2 milestone Sep 29, 2022
@andyjefferson andyjefferson merged commit 8bdc916 into datanucleus:master Sep 29, 2022
@nscuro nscuro deleted the fix-sqlserver-float-type-mapping branch September 29, 2022 12:56
@nscuro
Copy link
Contributor Author

nscuro commented Sep 29, 2022

Thanks for merging @andyjefferson!

Do you have a rough idea of when 6.0.2 will be released? :) I'm eagerly waiting for #449 to be shipped, as the corresponding bug prevents our users with SQL server from running our project.

@andyjefferson
Copy link
Member

Since only datanucleus-core and datanucleus-rdbms to release (so a plugin release, rather than accessplatform), maybe some time in the next week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants