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

Some JDBC not working properly with getObject(pos, cls) #282

Open
FDoKE opened this issue Jul 4, 2022 · 0 comments
Open

Some JDBC not working properly with getObject(pos, cls) #282

FDoKE opened this issue Jul 4, 2022 · 0 comments
Labels

Comments

@FDoKE
Copy link

FDoKE commented Jul 4, 2022

Version

4.3.1 (last used version without an issue is 4.1.1)

Context

Looks like changes made in JDBCDecoderImpl break two of jdbc's in our project (HSQL, Clickhouse).
In new version it uses cs.getObject(pos, cls) to retrieve result which act wierd with some types in HSQL, Clickhouse

Clickhouse:
for example in case of double
getObject(pos) returns null, getObject(pos, cls) return 0.0

Hsql:
Could not pinpoint root cause, but looks like something wierd happened there:
getObject(pos) returns null
getObject(pos, cls) return 2 (I don't know where that coming from, fun fact that if I do getObject(pos) with debug just before vertx-jdbc retrieving it with getObject(pos,cls) as param it return correct value)

But looks like noone really made getObject(pos, cls) work properly.

My current workaraund, I replaced JDBCDecoderImpl with my own that always retrieve columns by getObject(col)
But I bit worried that it will produce some unexpected behaivor later.

 @Override
    public Object parse(ResultSet rs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup) throws SQLException {
        return decode(jdbcTypeLookup.apply(pos), cls -> rs.getObject(pos));
    }

    @Override
    public Object parse(CallableStatement cs, int pos, JDBCColumnDescriptorProvider jdbcTypeLookup) throws SQLException {
        return decode(jdbcTypeLookup.apply(pos), cls -> cs.getObject(pos));
    }

I would like to hear your thoughs and why logic changed from getObject(col) to getObject(col,cls)

Do you have a reproducer?

--

Extra

Java 8

@FDoKE FDoKE added the bug label Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant