Skip to content

Statement Dialect Extensions and JDBCTransaction.resultFor(statement) #36

Description

@codesplode

First off, I hope the jetbrains team has had a wonderful holiday season and stayed safe & healthy during these times.

JDBCTransaction.resultFor() is a troubling method when creating Dialect Extensions, such as MySQL's extended insert statement.

This is because it performs logic to get the result of a statement, with no access to the generic type in Statement and is checks that depend on specific query classes (InsertValuesStatement, InsertQueryStatement, DeleteQueryStatement, etc.) It also throws an error for anything it does not match, making all new statement types fail by default. This means a query/statement dialect extension could not be made unless it extends an existing query type directly.

We have implemented the MySQL insert statement with multiple values lines by modifying the code to have a StatementWithoutResult flag interface that simply extends Statement in the JDBC module, and added that to the when statement in resultFor. This would work at some level for most queries, but we would like to ask @orangy for his input regarding how best to achieve this in Kotlin if there is a better way without flag interfaces or passing class references around as a contructor arg and which the jetbrains team would prefer, so that we may better our knowledge / reasoning.

We have also continued our development on squash quite a bit and would love to work with you when you surface @orangy !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions