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

RawParameterizedSqlStatement fails to run on JdbcExecutor #4588

Closed
2 tasks done
andrew-simmons opened this issue Aug 2, 2023 · 0 comments · Fixed by #4589
Closed
2 tasks done

RawParameterizedSqlStatement fails to run on JdbcExecutor #4588

andrew-simmons opened this issue Aug 2, 2023 · 0 comments · Fixed by #4589
Labels

Comments

@andrew-simmons
Copy link
Contributor

andrew-simmons commented Aug 2, 2023

Search first

  • I searched and no similar issues were found

Description

Calling JdbcExecutor::queryForObject(SqlStatement sql, Class requiredType) with a RawParameterizedSqlStatement fails on Oracle databases with an error about an "invalid index".

Rewriting the query into it's equivalent with a RawSqlStatement works as expected.

Believe this is due to parameters being incorrectly set on the PreparedStatement.

  • PreparedStatement's documentation hints that the parameterIndex starts at 1; an index of 0 is used for the first parameter.
  • Parameters are retrieved with parameters.get(0) and parameters.get(i); the first looks wrong to me.

Steps To Reproduce

  • Build a Liquibase extension or an executable project using liquibase-core.
  • Call JdbcExecutor::queryForObject(SqlStatement sql, Class requiredType) with a RawParameterizedSqlStatement.
  • Catch and view the exception.

Expected/Desired Behavior

Calling JdbcExecutor::queryForObject(SqlStatement sql, Class requiredType) with a RawParameterizedSqlStatement should return the query's result.

Liquibase Version

4.23.0

Database Vendor & Version

Oracle 18c

Liquibase Integration

CLI

Liquibase Extensions

No response

OS and/or Infrastructure Type/Provider

macOS 13.4

Additional Context

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR (Thank you!)

See #4589 for PR.

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

Successfully merging a pull request may close this issue.

2 participants